Esempio n. 1
0
 function __construct($args = array())
 {
     global $post_type_object, $wpdb;
     fa_load_admin_style('list-tables');
     parent::__construct(array('plural' => 'posts', 'screen' => isset($args['screen']) ? $args['screen'] : null));
     if (isset($_GET['post_type']) && post_type_exists($_GET['post_type'])) {
         $this->post_type = $_GET['post_type'];
     } else {
         $this->post_type = 'post';
     }
     $post_type = $this->post_type;
     $post_type_object = get_post_type_object($post_type);
     if (!current_user_can($post_type_object->cap->edit_others_posts)) {
         $exclude_states = get_post_stati(array('show_in_admin_all_list' => false));
         $this->user_posts_count = $wpdb->get_var($wpdb->prepare("\r\n\t\t\t\tSELECT COUNT( 1 ) FROM {$wpdb->posts}\r\n\t\t\t\tWHERE post_type = %s AND post_status NOT IN ( '" . implode("','", $exclude_states) . "' )\r\n\t\t\t\tAND post_author = %d\r\n\t\t\t", $post_type, get_current_user_id()));
         if ($this->user_posts_count && empty($_REQUEST['post_status']) && empty($_REQUEST['all_posts']) && empty($_REQUEST['author']) && empty($_REQUEST['show_sticky'])) {
             $_GET['author'] = get_current_user_id();
         }
     }
     if ('post' == $post_type && ($sticky_posts = get_option('sticky_posts'))) {
         $sticky_posts = implode(', ', array_map('absint', (array) $sticky_posts));
         $this->sticky_posts_count = $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));
     }
 }
Esempio n. 2
0
/**
 * Enqueues the stylesheet for a given template. Stylesheet should be inside plugin folder:
 * assets/admin/css and should be named template-$template.css
 * 
 * @param string $template
 */
function fa_load_template_style($template)
{
    return fa_load_admin_style('template-' . $template);
}
Esempio n. 3
0
 /**
  * Create extra columns on slider display table for administrators.
  * 
  * @param array $columns
  */
 public function extra_slider_columns($columns)
 {
     $columns = array('cb' => $columns['cb'], 'title' => $columns['title'], 'content' => __('Content Type', 'fapro'), 'theme' => __('Slider Theme', 'fapro'), 'auto_display' => __('Display on', 'fapro'), 'author' => __('Author', 'fapro'), 'date' => $columns['date']);
     fa_load_admin_style('list-tables');
     return $columns;
 }
Esempio n. 4
0
/**
 * Enqueue some functionality scripts on widgets page
 */
function fa_widgets_styles()
{
    fa_load_admin_style('widgets');
}