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


PHP mpp_get_gallery_post_type函数代码示例

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


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

示例1: mpp_is_sitewide_gallery_component

/**
 * Are we on Sitewide gallery page?
 * 
 * @return boolean
 */
function mpp_is_sitewide_gallery_component()
{
    if (is_singular(mpp_get_gallery_post_type()) && mpp_is_sitewide_gallery(get_queried_object_id())) {
        return true;
    }
    return false;
}
开发者ID:markc,项目名称:mediapress,代码行数:12,代码来源:mpp-gallery-conditionals.php

示例2: mpp_admin_is_gallery_list

/**
 * Check if we are on the Dashboard->Gallery listing page
 * 
 * @return boolean
 */
function mpp_admin_is_gallery_list()
{
    $screen_id = 'edit-' . mpp_get_gallery_post_type();
    if (is_admin() && !defined('DOING_AJAX') && function_exists('get_current_screen') && get_current_screen()->id == $screen_id) {
        return true;
    }
    return false;
}
开发者ID:markc,项目名称:mediapress,代码行数:13,代码来源:mpp-admin-functions.php

示例3: dummy_post

 /**
  * Update the global $post with dummy data
  *
  * @since BuddyPress (1.7)
  */
 public function dummy_post()
 {
     // Registration page
     if (mpp_is_gallery_directory()) {
         $title = __('Gallery Directory', 'mediapress');
     }
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_directory_title('mediapress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => mpp_get_gallery_post_type(), 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:markc,项目名称:mediapress,代码行数:13,代码来源:mpp-theme-compat.php

示例4: mpp_filter_gallery_permalink

/**
 * Filter get_permalink for mediapress gallery post type( mpp-gallery)
 * aand make it like site.com/members/username/mediapressslug/gallery-name or site.com/{component-page}/{single-component}/mediapress-slug/gallery-name
 * It allows us to get the permalink to gallery by using the_permalink/get_permalink functions
 */
function mpp_filter_gallery_permalink($permalink, $post, $leavename, $sample)
{
    if (mpp_get_gallery_post_type() != $post->post_type) {
        return $permalink;
    }
    $gallery = mpp_get_gallery($post);
    $slug = $gallery->slug;
    $base_url = mpp_get_gallery_base_url($gallery->component, $gallery->component_id);
    return apply_filters('mpp_get_gallery_permalink', $base_url . '/' . $slug, $gallery);
}
开发者ID:baden03,项目名称:mediapress,代码行数:15,代码来源:hooks.php

示例5: register_taxonomies

 public function register_taxonomies()
 {
     //register type
     //register status
     // register component
     $this->register_taxonomy(mpp_get_type_taxname(), array('label' => _x('Media Type', 'Gallery Media Type', 'mediapress'), 'labels' => _x('Media Types', 'Gallery Media Type Plural Name', 'mediapress'), 'hierarchical' => false));
     $this->register_taxonomy(mpp_get_component_taxname(), array('label' => _x('Component', 'Gallery Associated Type', 'mediapress'), 'labels' => _x('Components', 'Gallery Associated Component Plural Name', 'mediapress'), 'hierarchical' => false));
     $this->register_taxonomy(mpp_get_status_taxname(), array('label' => _x('Gallery Status', 'Gallery privacy/status Type', 'mediapress'), 'labels' => _x('Galery Statuses', 'Gallery Privacy Plural Name', 'mediapress'), 'hierarchical' => false));
     register_taxonomy_for_object_type(mpp_get_type_taxname(), mpp_get_gallery_post_type());
     register_taxonomy_for_object_type(mpp_get_component_taxname(), mpp_get_gallery_post_type());
     register_taxonomy_for_object_type(mpp_get_status_taxname(), mpp_get_gallery_post_type());
     register_taxonomy_for_object_type(mpp_get_type_taxname(), mpp_get_media_post_type());
     register_taxonomy_for_object_type(mpp_get_component_taxname(), mpp_get_media_post_type());
     register_taxonomy_for_object_type(mpp_get_status_taxname(), mpp_get_media_post_type());
 }
开发者ID:baden03,项目名称:mediapress,代码行数:15,代码来源:post-type.php

示例6: mpp_admin_is_gallery_list

/**
 * Check if we are on the Dashboard->Gallery listing page
 * 
 * @return boolean
 */
function mpp_admin_is_gallery_list()
{
    $screen_id = 'edit-' . mpp_get_gallery_post_type();
    //on ajax request, shortcircuit
    if (defined('DOING_AJAX')) {
        return false;
    }
    if (is_admin() && function_exists('get_current_screen')) {
        $screen = get_current_screen();
        if (isset($screen->id) && $screen->id == $screen_id) {
            return true;
        }
    }
    return false;
}
开发者ID:enboig,项目名称:mediapress,代码行数:20,代码来源:mpp-admin-functions.php

示例7: load_js

 /**
  * Load the MediaPress js files/codes  
  * 
  */
 public function load_js()
 {
     //use it to avoid loading mediapress js where not required
     if (!apply_filters('mpp_load_js', true)) {
         return;
         //is this  a good idea? should we allow this?
     }
     //we can further refine it in future to only load a part of it on the pages, depending on current context and user state
     //for now, let us keep it all together
     //Uploader class
     wp_register_script('mpp_uploader', $this->url . 'assets/js/uploader.js', array('plupload', 'plupload-all', 'jquery', 'underscore', 'json2', 'media-models'));
     //'plupload-all'
     //popup
     wp_register_script('magnific-js', $this->url . 'assets/vendors/magnific/jquery.magnific-popup.min.js', array('jquery'));
     //'plupload-all'
     //comment+posting activity on single gallery/media page
     wp_register_script('mpp_activity', $this->url . 'assets/js/activity.js', array('jquery'));
     //'plupload-all'
     //everything starts here
     wp_register_script('mpp_core', $this->url . 'assets/js/mpp.js', array('jquery', 'jquery-ui-sortable'));
     wp_register_script('mpp_settings_uploader', $this->url . 'admin/mpp-settings-manager/core/_inc/uploader.js', array('jquery'));
     //we have to be selective about admin only? we always load it on front end
     //do not load on any admin page except the edit gallery?
     if (is_admin() && function_exists('get_current_screen') && get_current_screen()->post_type != mpp_get_gallery_post_type()) {
         return;
     }
     wp_enqueue_script('mpp_uploader');
     //load lightbox only on edit gallery page or not admin
     if (!is_admin()) {
         //only load the lightbox if it is enabled in the admin settings
         if (mpp_get_option('load_lightbox')) {
             wp_enqueue_script('magnific-js');
         }
         wp_enqueue_script('mpp_activity');
     }
     wp_enqueue_script('mpp_core');
     //we only need these to be loaded for activity page, should we put a condition here?
     wp_enqueue_style('wp-mediaelement');
     wp_enqueue_script('wp-mediaelement');
     //force wp to load _js template for the playlist and the code to
     do_action('wp_playlist_scripts');
     //may not be a good idea
     $this->defult_settings();
     $this->plupload_localize();
     $this->localize_strings();
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:50,代码来源:mpp-script-loader.php

示例8: mpp_filter_archive_page_galleries

function mpp_filter_archive_page_galleries($query)
{
    if (is_admin()) {
        return;
    }
    if (!$query->is_main_query() || !$query->is_post_type_archive(mpp_get_gallery_post_type())) {
        return;
    }
    //confirmed that we are on gallery archive page
    $active_components = mpp_get_active_components();
    $active_types = mpp_get_active_types();
    $status = 'public';
    $tax_query = $query->get('tax_query');
    if (empty($tax_query)) {
        $tax_query = array();
    }
    //it will be always true
    if ($status) {
        $status = mpp_string_to_array($status);
        //future proofing
        $status_keys = array_map('mpp_underscore_it', $status);
        $tax_query[] = array('taxonomy' => mpp_get_status_taxname(), 'field' => 'slug', 'terms' => $status_keys, 'operator' => 'IN');
    }
    //should we only show sitewide galleries here? will update based on feedback
    if (!empty($active_components)) {
        $component_keys = array_keys($active_components);
        $component_keys = array_map('mpp_underscore_it', $component_keys);
        $tax_query[] = array('taxonomy' => mpp_get_component_taxname(), 'field' => 'slug', 'terms' => $component_keys, 'operator' => 'IN');
    }
    if (!empty($active_types)) {
        $type_keys = array_keys($active_types);
        $type_keys = array_map('mpp_underscore_it', $type_keys);
        $tax_query[] = array('taxonomy' => mpp_get_type_taxname(), 'field' => 'slug', 'terms' => $type_keys, 'operator' => 'IN');
    }
    if (count($tax_query) > 1) {
        $tax_query['relation'] = 'AND';
    }
    $query->set('tax_query', $tax_query);
    $query->set('update_post_term_cache', true);
    $query->set('update_post_meta_cache', true);
    $query->set('cache_results', true);
}
开发者ID:markc,项目名称:mediapress,代码行数:42,代码来源:mpp-hooks.php

示例9: mpp_filter_gallery_permalink

/**
 * Filter get_permalink for mediapress gallery post type( mpp-gallery)
 * aand make it like site.com/members/username/mediapressslug/gallery-name or site.com/{component-page}/{single-component}/mediapress-slug/gallery-name
 * It allows us to get the permalink to gallery by using the_permalink/get_permalink functions
 */
function mpp_filter_gallery_permalink($permalink, $post, $leavename, $sample)
{
    //check if BuddyPress is active, if not, we don't filter it yet
    //lightweight check
    if (!mediapress()->is_bp_active()) {
        return $permalink;
    }
    //a little more expensive
    if (mpp_get_gallery_post_type() != $post->post_type) {
        return $permalink;
    }
    //this is expensive if the post is not cached
    //If you see too many queries, just make sure to call _prime_post_caches($ids, true, true ); where $ids is collection of post ids
    //that will save a lot of query
    $gallery = mpp_get_gallery($post);
    // do not modify permalinks for Sitewide gallery
    if ($gallery->component == 'sitewide') {
        return $permalink;
    }
    $slug = $gallery->slug;
    $base_url = mpp_get_gallery_base_url($gallery->component, $gallery->component_id);
    return apply_filters('mpp_get_gallery_permalink', $base_url . '/' . $slug, $gallery);
}
开发者ID:markc,项目名称:mediapress,代码行数:28,代码来源:mpp-gallery-hooks.php

示例10: mpp_is_root_gallery

/**
 * Are we on a root gallry page
 * 
 * @return type
 */
function mpp_is_root_gallery()
{
    $is_gallery = false;
    if (mpp_is_root_enabled() && is_singular(mpp_get_gallery_post_type())) {
        $is_gallery = true;
    }
    return apply_filters('mpp_is_root_gallery', $is_gallery);
}
开发者ID:baden03,项目名称:mediapress,代码行数:13,代码来源:functions.php

示例11: redirect_canonical

 /**
  * Handle http://site.com/gallery/xyzgallery/page/{page_number}/
  * @param type $redirect_url
  * @param type $requested_url
  * @return type
  */
 public function redirect_canonical($redirect_url, $requested_url)
 {
     if (is_singular(mpp_get_gallery_post_type()) && get_query_var('paged')) {
         return $requested_url;
     }
     return $redirect_url;
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:13,代码来源:mpp-core-component.php

示例12: __construct

 private function __construct()
 {
     $this->menu_slug = 'edit.php?post_type=' . mpp_get_gallery_post_type();
 }
开发者ID:baden03,项目名称:mediapress,代码行数:4,代码来源:admin.php

示例13: mpp_get_adjacent_object_id

function mpp_get_adjacent_object_id($args, $post_type)
{
    global $wpdb;
    $post_type_sql = '';
    $sql = array();
    $default = array('component' => '', 'component_id' => false, 'status' => mpp_get_accessible_statuses(mpp_get_current_component(), mpp_get_current_component_id()), 'type' => '', 'post_status' => 'any', 'next' => true, 'object_id' => '', 'object_parent' => 0);
    if ($post_type == mpp_get_gallery_post_type()) {
        $default['post_status'] = 'publish';
        //for gallery, the default post type should be published status
    }
    //if component is set to user, we can simply avoid component query
    //may be next iteration someday
    $args = wp_parse_args($args, $default);
    extract($args);
    //whether we are looking for next post or previous post
    if ($next) {
        $op = '>';
    } else {
        $op = '<';
    }
    //do we have a component set
    if ($component) {
        $sql[] = mpp_get_tax_sql($component, mpp_get_component_taxname());
    }
    //do we have a component set
    if ($status) {
        $sql[] = mpp_get_tax_sql($status, mpp_get_status_taxname());
    }
    //for type, repeat it
    if ($type) {
        $sql[] = mpp_get_tax_sql($type, mpp_get_type_taxname());
    }
    //so let us build one
    /* $term_object_sql = "SELECT object_id FROM (
    	  (SELECT DISTINCT value FROM table_a)
    	  UNION ALL
    	  (SELECT DISTINCT value FROM table_b)
    	  ) AS t1 GROUP BY value HAVING count(*) >= 2; */
    $post_type_sql = $wpdb->prepare("SELECT DISTINCT ID as object_id FROM {$wpdb->posts} WHERE post_type = %s ", $post_type);
    //if a user or group id is given
    if ($component_id) {
        $post_type_sql = $wpdb->prepare("SELECT DISTINCT p.ID  as object_id FROM {$wpdb->posts} AS p INNER JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id WHERE p.post_type= %s  AND pm.meta_key=%s and pm.meta_value=%d", $post_type, '_mpp_component_id', $component_id);
    }
    $post_status_sql = '';
    if ($post_status && $post_status != 'any') {
        $post_status_sql = $wpdb->prepare(" AND post_status =%s", $post_status);
    }
    //$sql[] = $post_type_sql;
    $new_sql = $join_sql = '';
    //array();
    //let us generate inner sub queries
    if ($sql) {
        $join_sql = ' (' . join(' AND object_id IN (', $sql);
    }
    //we need to append the ) for closing the sub queries
    for ($i = 0; $i < count($sql); $i++) {
        $join_sql .= ')';
    }
    $new_sql = $post_type_sql . $post_status_sql;
    //if the join sql is present, let us append it
    if ($join_sql) {
        $new_sql .= ' AND ID IN ' . $join_sql;
    }
    //for next/prev
    //sorted gallery
    //or by date
    //
    $post = get_post($object_id);
    $sorted = false;
    if ($object_parent && mpp_is_gallery_sorted($object_parent)) {
        $new_sql .= $wpdb->prepare(" AND p.menu_order {$op} %d ", $post->menu_order);
        $sorted = true;
    } else {
        $new_sql .= $wpdb->prepare(" AND p.ID {$op} %d ", $object_id);
        $sorted = false;
    }
    if ($object_parent) {
        $new_sql .= $wpdb->prepare(" AND post_parent = %d ", $object_parent);
    }
    $oreder_by_clause = '';
    if ($sorted) {
        $oreder_by_clause = " ORDER BY p.menu_order ";
    } else {
        $oreder_by_clause = "ORDER BY p.ID";
    }
    if (!$next) {
        //for previous
        //find the last element les than give
        $oreder_by_clause .= " DESC ";
    } else {
        $oreder_by_clause .= " ASC";
    }
    if (!empty($new_sql)) {
        $new_sql .= $oreder_by_clause . ' LIMIT 0, 1';
    }
    return $wpdb->get_var($new_sql);
}
开发者ID:markc,项目名称:mediapress,代码行数:97,代码来源:mpp-misc-functions.php

示例14: is_settings_page

 private function is_settings_page()
 {
     global $pagenow;
     //we need to load on options.php otherwise settings won't be reistered
     if ($pagenow == 'options.php') {
         return true;
     }
     if (isset($_GET['page']) && $_GET['page'] == 'mpp-settings' && isset($_GET['post_type']) && $_GET['post_type'] == mpp_get_gallery_post_type()) {
         return true;
     }
     return false;
 }
开发者ID:enboig,项目名称:mediapress,代码行数:12,代码来源:mpp-admin.php

示例15: __construct

 private function __construct()
 {
     $this->post_type = mpp_get_gallery_post_type();
     $this->template_dir = mediapress()->get_path() . 'admin/templates/';
     $this->setup();
 }
开发者ID:markc,项目名称:mediapress,代码行数:6,代码来源:class-mpp-admin-post-helper.php


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