当前位置: 首页>>代码示例>>PHP>>正文


PHP acf_is_screen函数代码示例

本文整理汇总了PHP中acf_is_screen函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_is_screen函数的具体用法?PHP acf_is_screen怎么用?PHP acf_is_screen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了acf_is_screen函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: current_screen

 function current_screen()
 {
     // validate screen
     if (!acf_is_screen('edit-acf-field-group')) {
         return;
     }
     /*
     		customize post stats (draft -> disabled)?
     		global $wp_post_statuses;
     		$wp_post_statuses['draft']->label = 'Disabled';
     		$wp_post_statuses['draft']->label_count[0] = 'Disabled (%s)';
     		$wp_post_statuses['draft']->label_count[1] = 'Disabled (%s)';
     		$wp_post_statuses['draft']->label_count['singular'] = 'Disabled (%s)';
     		$wp_post_statuses['draft']->label_count['plural'] = 'Disabled (%s)';
     		$post_states = apply_filters( 'display_post_states', $post_states, $post );
     */
     // check stuff
     $this->check_duplicate();
     $this->check_sync();
     // actions
     add_action('admin_footer', array($this, 'admin_footer'));
     // columns
     add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1);
     add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2);
 }
开发者ID:bself,项目名称:nuimage-wp,代码行数:25,代码来源:field-groups.php

示例2: current_screen

 function current_screen()
 {
     // validate screen
     if (!acf_is_screen('acf-field-group')) {
         return;
     }
     // disable JSON to avoid conflicts between DB and JSON
     acf_disable_local();
     // actions
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('admin_head', array($this, 'admin_head'));
 }
开发者ID:eea76,项目名称:hammer,代码行数:12,代码来源:field-group.php

示例3: admin_enqueue_scripts

 function admin_enqueue_scripts()
 {
     // validate screen
     if (acf_is_screen('widgets') || acf_is_screen('customize')) {
         // valid
     } else {
         return;
     }
     // load acf scripts
     acf_enqueue_scripts();
     // actions
     add_action('acf/input/admin_footer', array($this, 'admin_footer'));
 }
开发者ID:tofubuddha,项目名称:example,代码行数:13,代码来源:widget.php

示例4: current_screen

 function current_screen()
 {
     // validate screen
     if (!acf_is_screen('edit-acf-field-group')) {
         return;
     }
     // check stuff
     $this->check_duplicate();
     $this->check_sync();
     // actions
     add_action('admin_footer', array($this, 'admin_footer'));
     // columns
     add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1);
     add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2);
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:15,代码来源:field-groups.php

示例5: current_screen

 function current_screen()
 {
     // validate screen
     if (!acf_is_screen('acf-field-group')) {
         return;
     }
     // disable JSON to avoid conflicts between DB and JSON
     acf_disable_local();
     // enqueue scripts
     acf_enqueue_scripts();
     // actions
     add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('acf/input/admin_head', array($this, 'admin_head'));
     add_action('acf/input/form_data', array($this, 'form_data'));
     add_action('acf/input/admin_footer', array($this, 'admin_footer'));
     add_action('acf/input/admin_footer_js', array($this, 'admin_footer_js'));
     // filters
     add_filter('acf/input/admin_l10n', array($this, 'admin_l10n'));
 }
开发者ID:uwmadisoncals,项目名称:vmmm,代码行数:19,代码来源:field-group.php

示例6: current_screen

 function current_screen()
 {
     // validate screen
     if (!acf_is_screen('acf-field-group')) {
         return;
     }
     // disable filters to ensure ACF loads raw data from DB
     acf_disable_filters();
     // enqueue scripts
     acf_enqueue_scripts();
     // actions
     add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('acf/input/admin_head', array($this, 'admin_head'));
     add_action('acf/input/form_data', array($this, 'form_data'));
     add_action('acf/input/admin_footer', array($this, 'admin_footer'));
     add_action('acf/input/admin_footer_js', array($this, 'admin_footer_js'));
     // filters
     add_filter('acf/input/admin_l10n', array($this, 'admin_l10n'));
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:19,代码来源:field-group.php

示例7: current_screen

 function current_screen()
 {
     // validate screen
     if (!acf_is_screen('edit-acf-field-group')) {
         return;
     }
     // customize post_status
     global $wp_post_statuses;
     // modify publish post status
     $wp_post_statuses['publish']->label_count = _n_noop('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', 'acf');
     // reorder trash to end
     $wp_post_statuses['trash'] = acf_extract_var($wp_post_statuses, 'trash');
     // check stuff
     $this->check_duplicate();
     $this->check_sync();
     // actions
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('admin_footer', array($this, 'admin_footer'));
     // columns
     add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1);
     add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2);
 }
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:22,代码来源:field-groups.php

示例8: admin_footer


//.........这里部分代码省略.........
    });


	$('#widgets-right').on('click', '.widget-control-save', function( e ){

		// vars
		var $form = $(this).closest('form');


		// bail early if not active
		if( !acf.validation.active ) {

			return true;

		}


		// ignore validation (only ignore once)
		if( acf.validation.ignore ) {

			acf.validation.ignore = 0;
			return true;

		}


		// bail early if this form does not contain ACF data
		if( !$form.find('#acf-form-data').exists() ) {

			return true;

		}


		// stop WP JS validation
		e.stopImmediatePropagation();


		// store submit trigger so it will be clicked if validation is passed
		acf.validation.$trigger = $(this);


		// run validation
		acf.validation.fetch( $form );


		// stop all other click events on this input
		return false;

	});


	$(document).on('click', '.widget-top', function(){

		var $el = $(this).parent().children('.widget-inside');

		setTimeout(function(){

			acf.get_fields('', $el).each(function(){

				acf.do_action('show_field', $(this));

			});

		}, 250);

	});

	$(document).on('widget-added', function( e, $widget ){

		acf.do_action('append', $widget );

	});

	$(document).on('widget-saved widget-updated', function( e, $widget ){

		// unlock form
		acf.validation.toggle( $widget, 'unlock' );


		// submit
		acf.do_action('submit', $widget );

	});

	<?php 
            if (acf_is_screen('customize')) {
                ?>

	// customizer saves widget on any input change, so unload is not needed
	acf.unload.active = 0;

	<?php 
            }
            ?>

})(jQuery);
</script>
<?php 
        }
开发者ID:ReLiFeD,项目名称:irreversible.eu,代码行数:101,代码来源:widget.php

示例9: get_acf_field_group_filters

 /**
  * Get field group filters based on active screen.
  */
 public function get_acf_field_group_filters()
 {
     global $post, $pagenow, $typenow, $plugin_page;
     $filter = array();
     if ($pagenow === 'post.php' || $pagenow === 'post-new.php') {
         if ($typenow !== 'acf') {
             $filter['post_id'] = $post->ID;
             $filter['post_type'] = $typenow;
         }
     } elseif ($pagenow === 'admin.php' && isset($plugin_page)) {
         if (acf_get_options_page($plugin_page)) {
             $filter['post_id'] = acf_get_valid_post_id('options');
         }
     } elseif ($pagenow === 'edit-tags.php' && isset($_GET['taxonomy'])) {
         $filter['taxonomy'] = filter_var($_GET['taxonomy'], FILTER_SANITIZE_STRING);
     } elseif ($pagenow === 'profile.php') {
         $filter['user_id'] = get_current_user_id();
         $filter['user_form'] = 'edit';
     } elseif ($pagenow === 'user-edit.php' && isset($_GET['user_id'])) {
         $filter['user_id'] = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT);
         $filter['user_form'] = 'edit';
     } elseif ($pagenow === 'user-new.php') {
         $filter['user_id'] = 'new';
         $filter['user_form'] = 'edit';
     } elseif ($pagenow === 'media.php' || $pagenow === 'upload.php') {
         $filter['attachment'] = 'All';
     } elseif (acf_is_screen('widgets') || acf_is_screen('customize')) {
         $filter['widget'] = 'all';
     }
     return $filter;
 }
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:34,代码来源:acf.php

示例10: admin_notices

 function admin_notices()
 {
     // bail ealry if already on update page
     if (acf_is_screen('custom-fields_page_acf-upgrade')) {
         return;
     }
     // view
     $view = array('button_text' => __("Upgrade Database", 'acf'), 'button_url' => admin_url('edit.php?post_type=acf-field-group&page=acf-upgrade'));
     // load view
     acf_get_view('update-notice', $view);
 }
开发者ID:slavic18,项目名称:cats,代码行数:11,代码来源:update.php

示例11: admin_footer


//.........这里部分代码省略.........
			acf.get_fields('', $el).each(function(){
				
				acf.do_action('show_field', $(this));	
				
			});
			
		}, 250);
				
	});
	
	$(document).on('widget-added', function( e, $widget ){
		
		// - use delay to avoid rendering issues with customizer (ensures div is visible)
		setTimeout(function(){
			
			acf.do_action('append', $widget );
			
		}, 100);
		
	});
	
	$(document).on('widget-saved widget-updated', function( e, $widget ){
		
		// unlock form
		acf.validation.toggle( $widget, 'unlock' );
		
		
		// submit
		acf.do_action('submit', $widget );
		
	});
	
	<?php 
            if (acf_is_screen('customize')) {
                ?>
	
	// customizer saves widget on any input change, so unload is not needed
	acf.unload.active = 0;
	
	
	// hack customizer function to remove bug caused by WYSIWYG field using aunique ID
	// customizer compares returned AJAX HTML with the HTML of the widget form.
	// the _getInputsSignature() function is used to generate a string based of input name + id.
	// because ACF generates a unique ID on the WYSIWYG field, this string will not match causing the preview function to bail.
	// an attempt was made to remove the WYSIWYG unique ID, but this caused multiple issues in the wp-admin and altimately doesn't make sense with the tinymce rule that all editors must have a unique ID.
	// source: wp-admin/js/customize-widgets.js
	
	// vars
	var WidgetControl = wp.customize.Widgets.WidgetControl.prototype;
	
	
	// backup functions
	WidgetControl.__getInputsSignature = WidgetControl._getInputsSignature;
	WidgetControl.__setInputState = WidgetControl._setInputState;
	
	
	// modify __getInputsSignature
	WidgetControl._getInputsSignature = function( inputs ) {
		
		// vars
		var signature = this.__getInputsSignature( inputs );
			safe = [];
		
		
		// split
		signature = signature.split(';');
开发者ID:Garth619,项目名称:Femi9,代码行数:67,代码来源:widget.php

示例12: wp_post_revision_fields

 function wp_post_revision_fields($fields, $post = null)
 {
     // validate page
     if (acf_is_screen('revision') || acf_is_ajax('get-revision-diffs')) {
         // allow
     } else {
         // bail early (most likely saving a post)
         return $fields;
     }
     // vars
     $append = array();
     $order = array();
     $post_id = acf_maybe_get($post, 'ID');
     // compatibility with WP < 4.5 (test)
     if (!$post_id) {
         global $post;
         $post_id = $post->ID;
     }
     // get all postmeta
     $meta = get_post_meta($post_id);
     // bail early if no meta
     if (!$meta) {
         return $fields;
     }
     // loop
     foreach ($meta as $name => $value) {
         // attempt to find key value
         $key = acf_maybe_get($meta, '_' . $name);
         // bail ealry if no key
         if (!$key) {
             continue;
         }
         // update vars
         $value = $value[0];
         $key = $key[0];
         // bail early if $key is a not a field_key
         if (!acf_is_field_key($key)) {
             continue;
         }
         // get field
         $field = acf_get_field($key);
         $field_title = $field['label'] . ' (' . $name . ')';
         $field_order = $field['menu_order'];
         $ancestors = acf_get_field_ancestors($field);
         // ancestors
         if (!empty($ancestors)) {
             // vars
             $count = count($ancestors);
             $oldest = acf_get_field($ancestors[$count - 1]);
             // update vars
             $field_title = str_repeat('- ', $count) . $field_title;
             $field_order = $oldest['menu_order'] . '.1';
         }
         // append
         $append[$name] = $field_title;
         $order[$name] = $field_order;
         // hook into specific revision field filter and return local value
         add_filter("_wp_post_revision_field_{$name}", array($this, 'wp_post_revision_field'), 10, 4);
     }
     // append
     if (!empty($append)) {
         // vars
         $prefix = '_';
         // add prefix
         $append = acf_add_array_key_prefix($append, $prefix);
         $order = acf_add_array_key_prefix($order, $prefix);
         // sort by name (orders sub field values correctly)
         array_multisort($order, $append);
         // remove prefix
         $append = acf_remove_array_key_prefix($append, $prefix);
         // append
         $fields = $fields + $append;
     }
     // return
     return $fields;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:76,代码来源:revisions.php


注:本文中的acf_is_screen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。