• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mpp_get_option函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mpp_group_is_gallery_enabled

function mpp_group_is_gallery_enabled($group_id = false)
{
    //is groups component enabled?
    if (mpp_is_active_component('groups')) {
        $is_enabled = true;
    } else {
        $is_enabled = false;
    }
    //if component is not enabled, return false
    if (!$is_enabled) {
        return false;
    }
    if (!$group_id) {
        $group = groups_get_current_group();
        if (!empty($group)) {
            $group_id = $group->id;
        }
    }
    if (!$group_id) {
        return false;
    }
    //check for group settings
    $is_enabled = groups_get_groupmeta($group_id, '_mpp_is_enabled', true);
    //if current group has no preference set, fallback to global preference
    //this global preference can be set by visting Dashboard->MediaPress->Settings->Groups
    if (empty($is_enabled)) {
        $is_enabled = mpp_get_option('enable_group_galleries_default', 'yes');
    }
    return $is_enabled == 'yes';
}
开发者ID:enboig,项目名称:mediapress,代码行数:30,代码来源:mpp-bp-groups-functions.php


示例2: register_post_types

 private function register_post_types()
 {
     $label = _x('Gallery', 'The Gallery Post Type Name', 'mediapress');
     $label_plural = _x('Galleries', 'The Gallery Post Type Plural Name', 'mediapress');
     $_labels = array('name' => $label_plural, 'singular_name' => $label, 'menu_name' => _x('MediaPress', 'MediaPress Admin menu name', 'mediapress'), 'name_admin_bar' => _x('MediaPress', 'MediaPress admin bar menu name', 'mediapress'), 'all_items' => _x('All Galleries', 'MediaPress All galleries label', 'mediapress'), 'add_new' => _x('Add Gallery', 'admin add new gallery menu label', 'mediapress'), 'add_new_item' => _x('Add Gallery', 'admin add gallery label', 'mediapress'), 'edit_item' => _x('Edit Gallery', 'admin edit gallery', 'mediapress'), 'new_item' => _x('Add Gallery', 'admin add new item label', 'mediapress'), 'view_item' => _x('View Gallery', 'admin view galery label', 'mediapress'), 'search_items' => _x('Search Galleries', 'admin search galleries lable', 'mediapress'), 'not_found' => _x('No Galleries found!', 'admin no galleries text', 'mediapress'), 'not_found_in_trash' => _x('No Galleries found in trash!', 'admin no galleries text', 'mediapress'), 'parent_item_colon' => _x('Parent Gallery', 'admin gallery parent label', 'mediapress'));
     // $this->_get_labels( $label, $label_plural );
     $has_archive = false;
     if (mpp_get_option('enable_gallery_archive')) {
         $has_archive = mpp_get_option('gallery_archive_slug');
     }
     $args = array('public' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'menu_position' => 10, 'menu_icon' => 'dashicons-format-gallery', 'show_in_admin_bar' => true, 'capability_type' => 'post', 'has_archive' => $has_archive, 'rewrite' => array('with_front' => false, 'slug' => mpp_get_gallery_post_type_rewrite_slug()), 'supports' => array('title', 'comments', 'custom-fields'));
     $args['labels'] = $_labels;
     register_post_type(mpp_get_gallery_post_type(), $args);
     add_rewrite_endpoint('edit', EP_PAGES);
 }
开发者ID:markc,项目名称:mediapress,代码行数:15,代码来源:mpp-post-type.php


示例3: mpp_filter_comment_settings

/**
 * Filter comment open/close status
 * 
 * If BuddyPress is active, the WordPress comments on gallery/attachment is always disabled and we use the BuddyPress activity instead
 * 
 * @param type $open
 * @param type $post_id
 * @return int
 */
function mpp_filter_comment_settings($open, $post_id)
{
    $is_bp = 0;
    //if BuddyPress is active
    if (mediapress()->is_bp_active()) {
        $is_bp = 1;
    }
    if (mpp_is_valid_gallery($post_id)) {
        if (!mpp_get_option('enable_gallery_comment') || $is_bp) {
            $open = 0;
        }
    } elseif (mpp_is_valid_media($post_id)) {
        if (!mpp_get_option('enable_media_comment') || $is_bp) {
            $open = 0;
        }
    }
    return $open;
}
开发者ID:markc,项目名称:mediapress,代码行数:27,代码来源:mpp-hooks.php


示例4: mpp_group_is_my_galleries_enabled

/**
 * Is my Galleries filter enabled for the groups component
 * 
 * @return boolean
 */
function mpp_group_is_my_galleries_enabled()
{
    return mpp_get_option('groups_enable_my_galleries');
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:9,代码来源:mpp-bp-groups-functions.php


示例5: mpp_get_gallery_grid_column_class

function mpp_get_gallery_grid_column_class($gallery = null)
{
    //we are using 1-24 col grid, where 3-24 repsesents 1/8th and so on
    $col = mpp_get_option('gallery_columns');
    return mpp_get_grid_column_class($col);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:6,代码来源:mpp-gallery-template-tags.php


示例6: setup_globals

 /**
  * Setup everything for BuddyPress Specific installation
  * 
  */
 public function setup_globals($args = array())
 {
     $bp = buddypress();
     $globals = array('slug' => MPP_GALLERY_SLUG, 'root_slug' => isset($bp->pages->mediapress->slug) ? $bp->pages->mediapress->slug : MPP_GALLERY_SLUG, 'notification_callback' => 'mpp_format_notifications', 'has_directory' => mpp_get_option('has_gallery_directory'), 'search_string' => __('Search Galleries...', 'mediapress'), 'directory_title' => isset($bp->pages->mediapress->id) ? get_the_title($bp->pages->mediapress->id) : __('Gallery Directory', 'mediapress'));
     parent::setup_globals($globals);
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:10,代码来源:mpp-bp-component.php


示例7: mpp_is_auto_publish_to_activity_enabled

/**
 * Is autopublishing enable for the given gallery action
 * 
 * @param string $action create_gallery|upload_media
 * @return boolean
 */
function mpp_is_auto_publish_to_activity_enabled($action)
{
    $enabled_types = mpp_get_option('autopublish_activities');
    if (empty($enabled_types)) {
        return false;
    }
    if (in_array($action, $enabled_types)) {
        return true;
    }
    return false;
}
开发者ID:baden03,项目名称:mediapress,代码行数:17,代码来源:functions.php


示例8: load_css

 /**
  * Load CSS on front end
  * 
  */
 public function load_css()
 {
     wp_register_style('mpp-core-css', $this->url . 'assets/css/mpp-core.css');
     wp_register_style('mpp-extra-css', $this->url . 'assets/css/mpp-pure/mpp-pure.css');
     wp_register_style('magnific-css', $this->url . 'assets/vendors/magnific/magnific-popup.css');
     //
     //should we load the css everywhere or just on the gallery page
     //i am leaving it like this for now to avoid design issues on shortcode pages/widget
     //only load magnific css if the lightbox is enabled
     if (mpp_get_option('load_lightbox')) {
         wp_enqueue_style('magnific-css');
     }
     wp_enqueue_style('mpp-extra-css');
     wp_enqueue_style('mpp-core-css');
 }
开发者ID:markc,项目名称:mediapress,代码行数:19,代码来源:mpp-script-loader.php


示例9: mpp_show_gallery_description

/**
 * Should we show gallery description on single gallery pages?
 * 
 * @param type $gallery
 * @return boolean
 */
function mpp_show_gallery_description($gallery = false)
{
    $gallery = mpp_get_gallery($gallery);
    $show = mpp_get_option('show_gallery_description');
    //under theme tab in admin panel
    return apply_filters('mpp_show_gallery_description', $show, $gallery);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:13,代码来源:mpp-gallery-functions.php


示例10: mpp_activity_create_comment_for_activity

function mpp_activity_create_comment_for_activity($activity_id)
{
    if (!$activity_id || !mpp_get_option('activity_comment_sync')) {
        return;
    }
    $activity = new BP_Activity_Activity($activity_id);
    if ($activity->type != 'mpp_media_upload') {
        return;
    }
    $gallery_id = mpp_activity_get_gallery_id($activity_id);
    $media_id = mpp_activity_get_media_id($activity_id);
    //this is not MediaPress activity
    if (!$gallery_id && !$media_id) {
        return;
    }
    //parent post id for the comment
    $parent_id = $media_id > 0 ? $media_id : $gallery_id;
    //now, create a top level comment and save
    $comment_data = array('post_id' => $parent_id, 'user_id' => get_current_user_id(), 'comment_parent' => 0, 'comment_content' => $activity->content, 'comment_type' => mpp_get_comment_type());
    $comment_id = mpp_add_comment($comment_data);
    //update comment meta
    if ($comment_id) {
        mpp_update_comment_meta($comment_id, '_mpp_activity_id', $activity_id);
        mpp_activity_update_associated_comment_id($activity_id, $comment_id);
        //also since there are media attched and we are mirroring activity, let us save the attached media too
        $media_ids = mpp_activity_get_attached_media_ids($activity_id);
        //it is a gallery upload post from activity
        if ($gallery_id && !empty($media_ids)) {
            //only available when sync is enabled
            if (function_exists('mpp_comment_update_attached_media_ids')) {
                mpp_comment_update_attached_media_ids($comment_id, $media_ids);
            }
        }
        //most probably a comment on media
        if (!empty($media_id)) {
            //should we add media as the comment meta? no, we don't need that at the moment
        }
    }
}
开发者ID:markc,项目名称:mediapress,代码行数:39,代码来源:mpp-activity-functions.php


示例11: mpp_show_media_description

/**
 * Should we show mdia description on single media pages?
 * 
 * @param type $media
 * @return boolean
 */
function mpp_show_media_description($media = false)
{
    $media = mpp_get_media($media);
    $show = mpp_get_option('show_media_description');
    //under theme tab in admin panel
    return apply_filters('mpp_show_media_description', $show, $media);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:13,代码来源:mpp-media-functions.php


示例12:

<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * action: mediapress/gallery/gallery_name/ Activity comments
 * Activity Loop to show Single member's gallery Item Activity
 *
 **/
if (!function_exists('bp_is_active') || !bp_is_active('activity')) {
    return;
}
//if gallery comment is not enabled do not load it?
if (!mpp_get_option('enable_gallery_comment')) {
    return;
}
?>

<div class="mpp-activity mpp-media-activity" id="mpp-media-activity-list">
	
	<?php 
if (is_user_logged_in() && mpp_user_can_comment_on_gallery(mpp_get_current_gallery_id())) {
    ?>
		
		<?php 
    mpp_locate_template(array('buddypress/activity/post-form.php'), true);
    ?>

	<?php 
开发者ID:markc,项目名称:mediapress,代码行数:31,代码来源:activity.php


示例13: add_buddypress_panel

 private function add_buddypress_panel($page)
 {
     if (!mediapress()->is_bp_active() || !(mpp_is_active_component('members') || mpp_is_active_component('groups'))) {
         return;
     }
     $panel = $page->add_panel('buddypress', _x('BuddyPress', 'Admin settings BuddyPress panel tab title', 'mediapress'));
     //directory settings
     $panel->add_section('directory-settings', _x('Directory Settings', 'Admin settings section title', 'mediapress'))->add_field(array('name' => 'has_gallery_directory', 'label' => _x('Enable Gallery Directory?', 'Admin settings', 'mediapress'), 'desc' => _x('Create a page to list all galleries?', 'Admin settings', 'mediapress'), 'default' => 1, 'type' => 'radio', 'options' => array(1 => _x('Yes', 'Admin settings option', 'mediapress'), 0 => _x('No', 'Admin settings option', 'mediapress'))))->add_field(array('name' => 'has_media_directory', 'label' => _x('Enable Media directory?', 'Admin settings', 'mediapress'), 'desc' => _x('Create a page to list all photos, videos etc? Please keep it disabled for now )', 'Admin settings', 'mediapress'), 'default' => 1, 'type' => 'radio', 'options' => array(1 => _x('Yes', 'Admin settings option', 'mediapress'), 0 => _x('No', 'Admin settings option', 'mediapress'))));
     //activity settings
     $activity_section = $panel->add_section('activity-settings', _x('Activity Settings', 'Admin settings section title', 'mediapress'));
     $activity_section->add_field(array('name' => 'activity_upload', 'label' => _x('Allow Activity Upload?', 'Admin settings', 'mediapress'), 'desc' => _x('Allow users to uploading from Activity screen?', 'Admin settings', 'mediapress'), 'default' => 1, 'type' => 'radio', 'options' => array(1 => _x('Yes', 'Admin settings option', 'mediapress'), 0 => _x('No', 'Admin settings option', 'mediapress'))));
     $activity_options = array('create_gallery' => _x('New Gallery is created.', 'Admin settings', 'mediapress'), 'add_media' => _x('New Media added/uploaded.', 'Admin settings', 'mediapress'));
     $default_activities = mpp_get_option('autopublish_activities');
     //if( empty( $default_activities ) ) {
     //$default_activities = array_keys( $activity_options );
     //}
     if (!empty($default_activities)) {
         $default_activities = array_combine($default_activities, $default_activities);
     }
     $activity_section->add_field(array('name' => 'autopublish_activities', 'label' => _x('Automatically Publish to activity When?', 'Admin settings', 'mediapress'), 'type' => 'multicheck', 'options' => $activity_options, 'default' => $default_activities));
     //6th section
     //directory settings
     $this->add_activity_views_panel($panel);
     $panel->add_section('misc-settings', _x('Miscellaneous Settings', 'Admin settings section title', 'mediapress'))->add_field(array('name' => 'show_orphaned_media', 'label' => _x('Show orphaned media to the user?', 'Admin settings option', 'mediapress'), 'desc' => _x('Do you want to list the media if it was uploaded from activity but the activity was not published?', 'Admin settings', 'mediapress'), 'type' => 'radio', 'default' => 0, 'options' => array(1 => _x('Yes', 'Admin settings option', 'mediapress'), 0 => _x('No', 'Admin settings option', 'mediapress'))))->add_field(array('name' => 'delete_orphaned_media', 'label' => _x('Delete orphaned media automatically?', 'Admin settings', 'mediapress'), 'desc' => _x('Do you want to delete the abandoned media uploade from activity?', 'Admin settings', 'mediapress'), 'type' => 'radio', 'default' => 1, 'options' => array(1 => _x('Yes', 'Admin settings option', 'mediapress'), 0 => _x('No', 'Admin settings option', 'mediapress'))));
 }
开发者ID:enboig,项目名称:mediapress,代码行数:25,代码来源:mpp-admin.php


示例14:

<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * Single Media Activity list
 *
 * @package mediapress
 */
if (!mpp_get_option('enable_media_comment')) {
    return;
}
?>

<?php 
do_action('mpp_before_activity_loop');
?>

<div class="mpp-activity mpp-media-activity " id="mpp-media-activity-list">
	
	<?php 
if (is_user_logged_in() && mpp_media_user_can_comment(mpp_get_current_media_id())) {
    ?>
		
		<?php 
    mpp_locate_template(array('activity/post-form.php'), true);
    ?>

	<?php 
开发者ID:baden03,项目名称:mediapress,代码行数:31,代码来源:activity.php


示例15: mpp_user_can_delete_media

/**
 * Check if the media can be deleted by the user
 * 
 * @param type $media_id
 * @param type $user_id
 * @return boolean true if allowed false otherwise
 */
function mpp_user_can_delete_media($media_id, $user_id = null)
{
    if (!$user_id) {
        $user_id = get_current_user_id();
    }
    $media = mpp_get_media($media_id);
    if (!$media) {
        return false;
    }
    $gallery = mpp_get_gallery($media->gallery_id);
    $allow = false;
    //do not alow editing by default
    //if the user is gallery creator, allow him to delete media
    if ($gallery->user_id == $user_id) {
        //should we consider context here like members gallery or groups gallery?
        $allow = true;
    } elseif ($user_id == $media->user_id) {
        //since current user is uploader/contributor
        //let us check if the gallery allows deleting for contributor
        $allow_deleting = mpp_get_gallery_meta($gallery->id, '_mpp_contributors_can_delete', true);
        if ($allow_deleting == 'yes') {
            $allow = true;
        } elseif ($allow_deleting != 'no' && mpp_get_option('contributors_can_delete')) {
            //check for global settings & make sure it is not overridden in the local settings
            $allow = true;
        }
    }
    return apply_filters('mpp_user_can_delete_media', $allow, $media, $gallery, $user_id);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:36,代码来源:mpp-permissions.php


示例16: mpp_display_space_usage

function mpp_display_space_usage($component = null, $component_id = null)
{
    if (!mpp_get_option('show_upload_quota')) {
        return;
    }
    if (!$component) {
        $component = mpp_get_current_component();
    }
    if (!$component_id) {
        $component_id = mpp_get_current_component_id();
    }
    $total_space = mpp_get_allowed_space($component, $component_id);
    $used = mpp_get_used_space($component, $component_id);
    if ($used > $total_space) {
        $percentused = '100';
    } else {
        $percentused = $used / $total_space * 100;
    }
    if ($total_space > 1000) {
        $total_space = number_format($total_space / 1024);
        $total_space .= __('GB');
    } else {
        $total_space .= __('MB');
    }
    ?>
	<strong><?php 
    printf(__('You have <span> %1s%%</span> of your %2s space left', 'mediapress'), number_format(100 - $percentused), $total_space);
    ?>
</strong>
	<?php 
}
开发者ID:baden03,项目名称:mediapress,代码行数:31,代码来源:space-stats.php


示例17: setup_globals

 /**
  * Setup everything for BuddyPress Specific installation
  * 
  */
 public function setup_globals($args = array())
 {
     $bp = buddypress();
     //if the 'gallery' slug is not set , set it to mediapress?
     if (!defined('MPP_GALLERY_SLUG')) {
         define('MPP_GALLERY_SLUG', $this->id);
     }
     //get current component/component_id
     $this->component = mpp_get_current_component();
     $this->component_id = mpp_get_current_component_id();
     //override the component id if we are on user page
     if (bp_is_user()) {
         $this->component_id = bp_displayed_user_id();
     }
     $globals = array('slug' => MPP_GALLERY_SLUG, 'root_slug' => isset($bp->pages->mediapress->slug) ? $bp->pages->mediapress->slug : MPP_GALLERY_SLUG, 'notification_callback' => 'mpp_format_notifications', 'has_directory' => mpp_get_option('has_gallery_directory'), 'search_string' => __('Search Galleries...', 'mediapress'), 'directory_title' => isset($bp->pages->mediapress->id) ? get_the_title($bp->pages->mediapress->id) : __('Gallery Directory', 'mediapress'));
     parent::setup_globals($globals);
     //it will call do_action("bp_gallery_setup_global") after setting up the constants properly
     //the only possibility of gallery as component is in case of root galler, gallery directory or user gallery
     //let us setup global queries
     $current_action = '';
     //initialize query objects
     mediapress()->the_gallery_query = new MPP_Gallery_Query();
     mediapress()->the_media_query = new MPP_Media_Query();
     //set the status types allowed for current user
     $this->accessible_statuses = mpp_get_accessible_statuses($this->component, $this->component_id, get_current_user_id());
     //is the root gallery enabled?
     if (mpp_is_root_enabled()) {
         $this->setup_root_gallery();
     }
     //end of root gallery section
     //if it is either member gallery OR Gallery Directory, let us process it
     if (mpp_is_gallery_component()) {
         $this->action_variables = buddypress()->action_variables;
         //add the current action at the begining of the stack, we are doing it to unify the things for User gallery and component gallery
         array_unshift($this->action_variables, bp_current_action());
         $this->setup_user_gallery();
     } elseif (mpp_is_component_gallery()) {
         //are we on component gallery like groups or events etc?
         $this->action_variables = buddypress()->action_variables;
         $this->setup_component_gallery();
     }
     //once we are here, the basic action variables for mediapress are setup and so
     //we can go ahead and test for the single gallery/media
     $mp = mediapress();
     //setup Single Gallery specific things
     if (mpp_is_single_gallery()) {
         $current_action = $this->current_action;
         //setup and see the actions etc to find out what we need to do
         //if it is one of the edit actions, It was already taken care of, don't do anything
         if (in_array($current_action, mpp_get_reserved_actions())) {
             return;
         }
         //check if we are on management screen?
         if ($this->current_action == 'manage') {
             //this is media management page
             $mp->set_editing('gallery');
             $mp->set_action('manage');
             $mp->set_edit_action($this->current_manage_action);
             //on edit bulk media page
             if ($mp->is_edit_action('edit')) {
                 $this->setup_gallery_media_query();
             }
         } elseif ($media = $this->get_media_id($this->current_action, $this->component, $this->component_id)) {
             //yes, It is single media
             $this->setup_single_media_query($media);
         } else {
             //we already know it is single gallery, so let us setup the media list query
             $this->setup_gallery_media_query();
         }
     }
     do_action('mpp_setup_globals');
 }
开发者ID:baden03,项目名称:mediapress,代码行数:76,代码来源:loader.php


示例18: mpp_media_user_can_comment

function mpp_media_user_can_comment($media_id)
{
    //for now, just return true
    return true;
    //in future, add an option in settings and aslo we can think of doing something for the user
    if (mpp_get_option('allow_media_comment')) {
        return true;
    }
    return false;
}
开发者ID:baden03,项目名称:mediapress,代码行数:10,代码来源:functions.php


示例19: mpp_get_default_storage_method

/**
 * Return default storage method
 * local|s3|ftp etc
 * @return string default storage method
 */
function mpp_get_default_storage_method()
{
    return apply_filters('mpp_get_default_storage_method', mpp_get_option('default_storage', 'local'));
}
开发者ID:baden03,项目名称:mediapress,代码行数:9,代码来源:functions.php


示例20: build_params

 /**
  * Map gallery parameters to wp_query native parameters
  * 
  * @param type $args
  * @return string
  */
 public function build_params($args)
 {
     $defaults = array('type' => array_keys(mpp_get_active_types()), 'id' => false, 'in' => false, 'exclude' => false, 'slug' => false, 'status' => array_keys(mpp_get_active_statuses()), 'component' => array_keys(mpp_get_active_components()), 'component_id' => false, 'per_page' => mpp_get_option('galleries_per_page'), 'offset' => false, 'page' => false, 'nopaging' => false, 'order' => 'DESC', 'orderby' => 'date', 'user_id' => false, 'include_users' => false, 'exclude_users' => false, 'user_name' => false, 'scope' => false, 'search_terms' => '', 'year' => false, 'month' => false, 'week' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'yearmonth' => false, 'fields' => false);
     //build params for WP_Query
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     //build the wp_query args
     $wp_query_args = array('post_type' => mpp_get_gallery_post_type(), 'post_status' => 'any', 'p' => $id, 'post__in' => $in, 'post__not_in' => $exclude, 'name' => $slug, 'posts_per_page' => $per_page, 'paged' => $page, 'offset' => $offset, 'nopaging' => $nopaging, 'author' => $user_id, 'author_name' => $user_name, 'author__in' => $include_users, 'author__not_in' => $exclude_users, 'year' => $year, 'monthnum' => $month, 'w' => $week, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second, 'm' => $yearmonth, 'order' => $order, 'orderby' => $orderby, 's' => $search_terms, 'fields' => $fields, '_mpp_mapped_query' => true);
     $tax_query = array();
     $gmeta_query = array();
     //meta
     if (isset($meta_key) && $meta_key) {
         $wp_query_args['meta_key'] = $meta_key;
     }
     if (isset($meta_value)) {
         $wp_query_args['meta_value'] = $meta_value;
     }
     if (isset($meta_query)) {
         $gmeta_query = $meta_query;
     }
     //TODO: SCOPE
     //
     //we will need to build tax query/meta query
     //type, audio video etc
     //if type is given and it is valid gallery type
     //Pass one or more types
     //should we restrict to active types only here? I guss no, Insteacd the calling scope should take care of that
     if (!empty($type) && mpp_are_registered_types($type)) {
         $type = mpp_string_to_array($type);
         $type = array_map('mpp_underscore_it', $type);
         $tax_query[] = array('taxonomy' => mpp_get_type_taxname(), 'field' => 'slug', 'terms' => $type, 'operator' => 'IN');
     }
     //privacy
     //pass ne or more privacy level
     if (!empty($status) && mpp_are_registered_statuses($status)) {
         $status = mpp_string_to_array($status);
         $status = array_map('mpp_underscore_it', $status);
         $tax_query[] = array('taxonomy' => mpp_get_status_taxname(), 'field' => 'slug', 'terms' => $status, 'operator' => 'IN');
     }
     if (!empty($component) && mpp_are_registered_components($component)) {
         $component = mpp_string_to_array($component);
         $component = array_map('mpp_underscore_it', $component);
         $tax_query[] = array('taxonomy' => mpp_get_component_taxname(), 'field' => 'slug', 'terms' => $component, 'operator' => 'IN');
     }
     //done with the tax query
     if (count($tax_query) > 1) {
         $tax_query['relation'] = 'AND';
     }
     $wp_query_args['tax_query'] = $tax_query;
     // print_nice($wp_query_args);
     //meta query
     //now, for component
     if (!empty($component_id)) {
         $meta_compare = '=';
         if (is_array($component_id)) {
             $meta_compare = 'IN';
         }
         $gmeta_query[] = array('key' => '_mpp_component_id', 'value' => $component_id, 'compare' => $meta_compare, 'type' => 'UNSIGNED');
     }
     //reset meta query
     if (!empty($gmeta_query)) {
         $wp_query_args['meta_query'] = $gmeta_query;
     }
     // print_r($wp_query_args);
     return $wp_query_args;
 }
开发者ID:markc,项目名称:mediapress,代码行数:72,代码来源:class-mpp-gallery-query.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mpp_get_status_taxname函数代码示例发布时间:2022-05-15
下一篇:
PHP mpp_get_media函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap