=> 1, ) ); } /** * Renders the field sџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџр чЉV џџџџK8$дчРRю@ џџџџj^RьЩxйї@ id */ public function render_field_advanced_settings( $field ) { acf_render_bidirectional_field_settings( $field ); } /** * Renders the field input HTML. * * @since 3.6џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџ0чЉV џџџџ der_field( $field ) { // Change Field into a select. $field['type'] = 'select'; $field['ui'] = 1; $field['ajax'] = 1; $field['choices'] = array(); $field['nonce'] = wp_create_nonce( 'acf_field_џџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџРчЉV џџџџТvCЇU$Аp#цЉV // Clean value into an array of IDs. $user_ids = array_map( 'intval', acf_array( $field['value'] ) ); // Find users in database (ensures all results are real). $users = acf_get_users( array( 'incluџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџ чЉV џџџџK8$дчРRю@ џџџџj^RьЩxйї@ $user->ID ] = $this->get_result( $user, $field ); } } } // Render. acf_render_field( $field ); } /** * Returns the result text for a given WP_User object. * * џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџHчЉV џџџџ ct. * @param array $field The ACF field related to this query. * @param (int|string) $post_id The post_id being edited. * @return string */ function get_result( $user, $field, $post_id = 0 ) { џџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџичЉV џџџџrВ CJ($тР#цЉV rrent post being edited. $post_id = $post_id ? $post_id : acf_get_form_data( 'post_id' ); /** * Filters the result text. * * @date 21/5/19 * @since 5.8.1 * * @param array $args The queryџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџИчЉV џџџџK8$дчРRю@ џџџџj^RьЩxйї@ dited. */ return apply_filters( 'acf/fields/user/result', $item['text'], $user, $field, $post_id ); } /** * Filters the field value after it is loaded from the database. * џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџpЎцЉV џџџџK8$дчРRю@ џџџџj^RьЩxйї@ t ID where the value is saved. * @param array $field The field array containing all settings. * @return mixed */ function load_value( $value, $post_id, $field ) { // Add coџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџ`чЉV џџџџМWJ9#Іг`$цЉV ; } /** * Filters the field value after it is loaded from the database but before it is returned to the front-end API. * * @date 23/01/13 * @since 3.6.0 * * @param mixed $value The field valueџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџ@чЉV џџџџK8$дчРRю@ џџџџj^RьЩxйї@ settings. * @return mixed */ function format_value( $value, $post_id, $field ) { // Bail early if no value. if ( ! $value ) { return false; } // Clean value into anџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџxчЉV џџџџNђб&я!ёА$цЉV atabase (ensures all results are real). $users = acf_get_users( array( 'include' => $user_ids, ) ); // Bail early if no users found. if ( ! $users ) { return false; } // Format values usiџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџ чЉV џџџџ чЉV џџџџп3{{Ќаьї@ №чЉV џџџџи3Тр3{{Ќ@эї@ №чЉV џџџџлівЏсъЛ0ьї@ @ёчЉV џџџџгећ~\фаx A рёчЉV Ыwdіt2ёї@ ђчЉV џџџџд4VFфy A ѓчЉV иЄЎ8~ЅШђї@ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџXчЉV џџџџK8$дчРRю@ џџџџj^RьЩxйї@ 'user_nicename' => $user->user_nicename, 'display_ring */ protected function remove_default_robots( $robots_txt ) { return \preg_replace( '`User-agent: \*[\r\n]+Disallow: /wp-admin/[\r\n]+Allow: /wp-admin/admin-ajax\.php[\r\n]+`', '', $robots_txt ); } /** * Adds XML sitemap reference to robots.txt. * * @return void */ protected function maybe_add_xml_sitemap() { // If the XML sitemap is disabled, bail. if ( ! $this->options_helper->get( 'enable_xml_sitemap', false ) ) { return; } $this->robots_txt_helper->add_sitemap( \esc_url( WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' ) ) ); } /** * Adds subdomain multisite' XML sitemap references to robots.txt. * * @return void */ protected function add_subdirectory_multisite_xml_sitemaps() { // If not on a multisite subdirectory, bail. if ( ! \is_multisite() || \is_subdomain_install() ) { return; } $sitemaps_enabled = $this->get_xml_sitemaps_enabled(); foreach ( $sitemaps_enabled as $blog_id => $is_sitemap_enabled ) { if ( ! $is_sitemap_enabled ) { continue; } $this->robots_txt_helper->add_sitemap( \esc_url( \get_home_url( $blog_id, 'sitemap_index.xml' ) ) ); } } /** * Retrieves whether the XML sitemaps are enabled, keyed by blog ID. * * @return array */ protected function get_xml_sitemaps_enabled() { $is_allowed = $this->is_sitemap_allowed(); $blog_ids = $this->get_blog_ids(); $is_enabled = []; foreach ( $blog_ids as $blog_id ) { $is_enabled[ $blog_id ] = $is_allowed && $this->is_sitemap_enabled_for( $blog_id ); } return $is_enabled; } /** * Retrieves whether the sitemap is allowed on a sub site. * * @return bool */ protected function is_sitemap_allowed() { $options = \get_network_option( null, 'wpseo_ms' ); if ( ! $options || ! isset( $options['allow_enable_xml_sitemap'] ) ) { // Default is enabled. return true; } return (bool) $options['allow_enable_xml_sitemap']; } /** * Retrieves whether the sitemap is enabled on a site. * * @param int $blog_id The blog ID. * * @return bool */ protected function is_sitemap_enabled_for( $blog_id ) { if ( ! $this->is_yoast_active_on( $blog_id ) ) { return false; } $options = \get_blog_option( $blog_id, 'wpseo' ); if ( ! $options || ! isset( $options['enable_xml_sitemap'] ) ) { // Default is enabled. return true; } return (bool) $options['enable_xml_sitemap']; } /** * Determines whether Yoast SEO is active. * * @param int $blog_id The blog ID. * * @return bool */ protected function is_yoast_active_on( $blog_id ) { return \in_array( 'wordpress-seo/wp-seo.php', (array) \get_blog_option( $blog_id, 'active_plugins', [] ), true ) || $this->is_yoast_active_for_network(); } /** * Determines whether Yoast SEO is active for the entire network. * * @return bool */ protected function is_yoast_active_for_network() { $plugins = \get_network_option( null, 'active_sitewide_plugins' ); if ( isset( $plugins['wordpress-seo/wp-seo.php'] ) ) { return true; } return false; } /** * Retrieves the blog IDs of public, "active" sites on the network. * * @return array */ protected function get_blog_ids() { $criteria = [ 'archived' => 0, 'deleted' => 0, 'public' => 1, 'spam' => 0, 'fields' => 'ids', 'network_id' => \get_current_network_id(), ]; return \get_sites( $criteria ); } }