validate_page() )
{
return;
}
// actions
add_action('admin_print_scripts', array($this,'admin_print_scripts'));
add_action('admin_print_styles', array($this,'admin_print_styles'));
add_action('admin_footer', array($this,'admin_footer'));
// columns
add_filter( 'manage_edit-acf_columns', array($this,'acf_edit_columns'), 10, 1 );
add_action( 'manage_acf_posts_custom_column' , array($this,'acf_columns_display'), 10, 2 );
}
/*
* validate_page
*
* @description: returns true | false. Used to stop a function from continuing
* @since 3.2.6
* @created: 23/06/12
*/
function validate_page()
{
// global
global $pagenow;
// vars
$return = false;
// validate page
if( in_array( $pagenow, array('edit.php') ) )
{
// validate post type
if( isset($_GET['post_type']) && $_GET['post_type'] == 'acf' )
{
$return = true;
}
if( isset($_GET['page']) )
{
$return = false;
}
}
// return
return $return;
}
/*
* admin_print_scripts
*
* @description:
* @since 3.1.8
* @created: 23/06/12
*/
function admin_print_scripts()
{
wp_enqueue_script(array(
'jquery',
'thickbox',
));
}
/*
* admin_print_styles
*
* @description:
* @since 3.1.8
* @created: 23/06/12
*/
function admin_print_styles()
{
wp_enqueue_style(array(
'thickbox',
'acf-global',
'acf',
));
}
/*
* acf_edit_columns
*
* @description:
* @created: 2/08/12
*/
function acf_edit_columns( $columns )
{
$columns = array(
'cb' => '',
'title' => __("Title"),
'fields' => __("Fields", 'acf')
);
return $columns;
}
/*
* acf_columns_display
*
* @description:
* @created: 2/08/12
*/
function acf_columns_display( $column, $post_id )
{
// vars
switch ($column)
{
case "fields":
// vars
$count =0;
$keys = get_post_custom_keys( $post_id );
if($keys)
{
foreach($keys as $key)
{
if(strpos($key, 'field_') !== false)
{
$count++;
}
}
}
echo $count;
break;
}
}
/*
* admin_footer
*
* @description:
* @since 3.1.8
* @created: 23/06/12
*/
function admin_footer()
{
// vars
$version = apply_filters('acf/get_info', 'version');
$dir = apply_filters('acf/get_info', 'dir');
$path = apply_filters('acf/get_info', 'path');
$show_tab = isset($_GET['info']);
$tab = isset($_GET['info']) ? $_GET['info'] : 'changelog';
?>