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

PHP mpp_get_gallery函数代码示例

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

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



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

示例1: mpp_gallery_show_publish_gallery_activity_button

function mpp_gallery_show_publish_gallery_activity_button()
{
    if (!mediapress()->is_bp_active()) {
        return;
    }
    $gallery_id = mpp_get_current_gallery_id();
    //if not a valid gallery id or no unpublished media exists, just don't show it
    if (!$gallery_id || !mpp_gallery_has_unpublished_media($gallery_id)) {
        return;
    }
    $gallery = mpp_get_gallery($gallery_id);
    $unpublished_media = mpp_gallery_get_unpublished_media($gallery_id);
    //unpublished media count
    $unpublished_media_count = count($unpublished_media);
    $type = $gallery->type;
    $type_name = _n($type, $type . 's', $unpublished_media_count);
    //if we are here, there are unpublished media
    ?>
	<div id="mpp-unpublished-media-info">
		<p> <?php 
    printf(__('You have %d %s not published to actvity.', 'mediapress'), $unpublished_media_count, $type_name);
    ?>
			<span class="mpp-gallery-publish-activity"><?php 
    mpp_gallery_publish_activity_link($gallery_id);
    ?>
</span>
			<span class="mpp-gallery-unpublish-activity"><?php 
    mpp_gallery_unpublished_media_delete_link($gallery_id);
    ?>
</span>
		</p>
	</div>

	<?php 
}
开发者ID:enboig,项目名称:mediapress,代码行数:35,代码来源:mpp-gallery-template.php


示例2: display

 public function display($gallery)
 {
     $gallery = mpp_get_gallery($gallery);
     $type = $gallery->type;
     $templates = array("gallery/views/grid-{$type}.php", 'gallery/views/grid.php');
     mpp_locate_template($templates, true);
 }
开发者ID:enboig,项目名称:mediapress,代码行数:7,代码来源:class-mpp-gallery-view-default.php


示例3: mpp_shortcode_uploader

function mpp_shortcode_uploader($atts = array(), $content = '')
{
    $default = array('gallery_id' => 0, 'component' => mpp_get_current_component(), 'component_id' => mpp_get_current_component_id(), 'type' => '', 'status' => mpp_get_default_status(), 'view' => '', 'selected' => 0, 'label_empty' => __('Please select a gallery', 'mediapress'), 'show_error' => 1);
    $atts = shortcode_atts($default, $atts);
    //dropdown list of galleries to sllow userselect one
    $view = 'list';
    if (!empty($atts['gallery_id']) && is_numeric($atts['gallery_id'])) {
        $view = 'single';
        //single gallery uploader
        //override component and $component id
        $gallery = mpp_get_gallery($atts['gallery_id']);
        if (!$gallery) {
            return __('Nonexistent gallery should not be used', 'mediapress');
        }
        //reset
        $atts['component'] = $gallery->component;
        $atts['component_id'] = $gallery->component_id;
        $atts['type'] = $gallery->type;
    }
    //the user must be able to upload to current component or galler
    $can_upload = false;
    if (mpp_user_can_upload($atts['component'], $atts['component_id'], $atts['gallery_id'])) {
        $can_upload = true;
    }
    if (!$can_upload && $atts['show_error']) {
        return __('Sorry, you are not allowed to upload here.', 'mediapress');
    }
    //if we are here, the user can upload
    //we still have one issue, what if the user has not created any gallery and the admin intends to allow the user to upload to their created gallery
    $atts['context'] = 'shortcode';
    //from where it is being uploaded,
    $atts['view'] = $view;
    //passing the 2nd arg makes all these variables available to the loaded file
    mpp_get_template('shortcodes/uploader.php', $atts);
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:35,代码来源:mpp-shortcode-media-uploader.php


示例4: display_cols

 /**
  * Display the column data
  * 
  * @param string $col
  * @param int $post_id
  * @return string
  */
 public function display_cols($col, $post_id)
 {
     $allowed = array('type', 'status', 'component', 'user_id', 'media_count', 'cover');
     if (!in_array($col, $allowed)) {
         return $col;
     }
     $gallery = mpp_get_gallery(get_post($post_id));
     switch ($col) {
         case 'cover':
             echo "<img src='" . mpp_get_gallery_cover_src('thumbnail', $post_id) . "' height='100px' width='100px'/>";
             break;
         case 'type':
             echo $gallery->type;
             break;
         case 'status':
             echo $gallery->status;
             break;
         case 'component':
             echo $gallery->component;
             break;
         case 'media_count':
             echo $gallery->media_count;
             break;
         case 'user_id':
             echo mpp_get_user_link($gallery->user_id);
             break;
     }
 }
开发者ID:markc,项目名称:mediapress,代码行数:35,代码来源:class-mpp-admin-gallery-list-helper.php


示例5: display_cols

 public function display_cols($col, $post_id)
 {
     $allowed = array('type', 'status', 'component', 'user_id', 'media_count');
     if (!in_array($col, $allowed)) {
         return $col;
     }
     $gallery = mpp_get_gallery(get_post($post_id));
     switch ($col) {
         case 'type':
             echo $gallery->type;
             break;
         case 'status':
             echo $gallery->status;
             break;
         case 'component':
             echo $gallery->component;
             break;
         case 'media_count':
             echo $gallery->media_count;
             break;
         case 'user_id':
             echo bp_core_get_userlink($gallery->user_id);
             break;
     }
 }
开发者ID:baden03,项目名称:mediapress,代码行数:25,代码来源:class-mpp-gallery-list-helper.php


示例6: mpp_shortcode_show_gallery

function mpp_shortcode_show_gallery($atts = null, $content = '')
{
    $defaults = array('id' => false, 'in' => false, 'exclude' => false, 'slug' => false, 'per_page' => false, 'offset' => false, 'page' => isset($_REQUEST['mpage']) ? absint($_REQUEST['mpage']) : false, 'nopaging' => false, 'order' => 'DESC', 'orderby' => 'date', 'user_id' => false, 'include_users' => false, 'exclude_users' => false, 'user_name' => false, 'scope' => false, 'search_terms' => '', 'meta_key' => '', 'meta_value' => '', 'column' => 4, 'view' => '', 'show_pagination' => 1);
    $defaults = apply_filters('mpp_shortcode_show_gallery_defaults', $defaults);
    $atts = shortcode_atts($defaults, $atts);
    if (!$atts['id']) {
        return '';
    }
    $gallery_id = absint($atts['id']);
    global $wpdb;
    $attachments = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_type = %s ", $gallery_id, 'attachment'));
    array_push($attachments, $gallery_id);
    _prime_post_caches($attachments, true, true);
    $gallery = mpp_get_gallery($gallery_id);
    //if gallery does not exist, there is no proint in further proceeding
    if (!$gallery) {
        return '';
    }
    if (!$atts['meta_key']) {
        unset($atts['meta_key']);
        unset($atts['meta_value']);
    }
    $view = $atts['view'];
    unset($atts['id']);
    unset($atts['view']);
    $atts['gallery_id'] = $gallery_id;
    $shortcode_column = $atts['column'];
    mpp_shortcode_save_media_data('column', $shortcode_column);
    mpp_shortcode_save_media_data('shortcode_args', $atts);
    unset($atts['column']);
    $show_pagination = $atts['show_pagination'];
    unset($atts['show_pagination']);
    $atts = array_filter($atts);
    $atts = apply_filters('mpp_shortcode_show_gallery_query_args', $atts, $defaults);
    $query = new MPP_Media_Query($atts);
    mpp_shortcode_save_media_data('query', $query);
    $content = apply_filters('mpp_shortcode_mpp_show_gallery_content', '', $atts, $view);
    if (!$content) {
        $templates = array('shortcodes/grid.php');
        if ($view) {
            $type = $gallery->type;
            $preferred_templates = array("shortcodes/{$view}-{$type}.php", "shortcodes/{$view}.php");
            //audio-playlist, video-playlist
            $templates = array_merge($preferred_templates, $templates);
            //array_unshift( $templates, $preferred_template );
        }
        ob_start();
        $located = mpp_locate_template($templates, false);
        //load
        if ($located) {
            require $located;
        }
        $content = ob_get_clean();
    }
    mpp_shortcode_reset_media_data('column');
    mpp_shortcode_reset_media_data('query');
    mpp_shortcode_reset_media_data('shortcode_args');
    return $content;
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:59,代码来源:mpp-shortcode-gallery-list.php


示例7: 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


示例8: mpp_get_default_gallery_cover_image_src

/**
 * If there is no cover set for a gallery, use the default cover image
 * 
 * @param type $gallery
 * @param type $cover_type
 * @return type
 */
function mpp_get_default_gallery_cover_image_src($gallery, $cover_type)
{
    $gallery = mpp_get_gallery($gallery);
    //we need to cache the assets to avoid heavy file system read/write etc
    $key = $gallery->type . '-' . $cover_type;
    //let us assume a naming convention like this
    //gallery_type-cover_type.png? or whatever e.g video-thumbnail.png, photo-mid.png
    $default_image = $gallery->type . '-' . $cover_type . '.png';
    $default_image = apply_filters('mpp_default_cover_file_name', $default_image, $cover_type, $gallery);
    return mpp_get_asset_url('assets/images/' . $default_image, $key);
}
开发者ID:enboig,项目名称:mediapress,代码行数:18,代码来源:mpp-gallery-cover-templates.php


示例9: mpp_group_check_gallery_permission

function mpp_group_check_gallery_permission($can, $gallery, $user_id)
{
    $gallery = mpp_get_gallery($gallery);
    //if it is not a group gallery, we  should not be worried
    if ($gallery->component != 'groups') {
        return $can;
    }
    $group_id = $gallery->component_id;
    if (groups_is_user_admin($user_id, $group_id) || groups_is_user_mod($user_id, $group_id)) {
        $can = true;
    }
    return $can;
}
开发者ID:enboig,项目名称:mediapress,代码行数:13,代码来源:mpp-bp-groups-hooks.php


示例10: mpp_custom_restrict_group_upload

function mpp_custom_restrict_group_upload($can_do, $component, $component_id, $gallery)
{
    if ($component != 'groups') {
        return $can_do;
    }
    //we only care about group upload
    $gallery = mpp_get_gallery($gallery);
    if (!$gallery || $gallery->user_id != get_current_user_id()) {
        return false;
        //do not allow if gallery is not given
    }
    return true;
    //the user had created this gallery
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:14,代码来源:bp-custom.php


示例11: mpp_filter_current_component_for_sitewide

function mpp_filter_current_component_for_sitewide($component)
{
    if (!mediapress()->is_bp_active()) {
        return $component;
    }
    if (mpp_admin_is_add_gallery() || mpp_admin_is_edit_gallery()) {
        global $post;
        $gallery = mpp_get_gallery($post);
        if ($gallery && $gallery->component) {
            $component = $gallery->component;
        } else {
            $component = 'sitewide';
        }
    }
    return $component;
}
开发者ID:markc,项目名称:mediapress,代码行数:16,代码来源:mpp-hooks.php


示例12: mpp_activity_inject_attached_media_html

/**
 * Show the list of attached media in an activity
 * Should we add a link to view gallery too?
 * 
 * @return type
 */
function mpp_activity_inject_attached_media_html()
{
    $media_ids = mpp_activity_get_attached_media_ids(bp_get_activity_id());
    if (empty($media_ids)) {
        return;
    }
    $activity_id = bp_get_activity_id();
    $gallery_id = mpp_activity_get_gallery_id($activity_id);
    $gallery = mpp_get_gallery($gallery_id);
    if (!$gallery) {
        return;
    }
    $type = $gallery->type;
    $view = mpp_get_activity_view($type);
    $view->activity_display($media_ids);
}
开发者ID:enboig,项目名称:mediapress,代码行数:22,代码来源:mpp-activity-hooks.php


示例13: map_before_delete_post_action

 /**
  * Maps the before_delete_post action to mpp_before_gallery_delete action
  * It also does the cleanup of attachments as wp_delete_post() does not delete attachments
  * 
  * @param int $gallery_id post id
  * @return unknown
  */
 public function map_before_delete_post_action($gallery_id)
 {
     //is this called or a valid gallery?
     if (!$gallery_id || !mpp_is_valid_gallery($gallery_id)) {
         return;
     }
     $gallery = mpp_get_gallery($gallery_id);
     //we are certain that it is called for gallery
     //fire the MediaPress gallery delete action
     if ($this->is_queued($gallery_id)) {
         //this action is already being executed for the current gallery, no need to do that again
         return;
     }
     $this->add_item($gallery_id, 'gallery');
     do_action('mpp_before_gallery_delete', $gallery_id);
     //after that action, we delete all attachment
     global $wpdb;
     //1// delete all media
     $storage_manager = null;
     $media_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d", $gallery_id));
     //we need the storage manager to notify it that it do do any final cleanup after the gallery delete
     //should we keep a reference to the storage manager for each gallery? what will happen for a gallery that contains local/remote media?
     //for the time being we are not keeping a reference but this method is doing exactly the same and I am not sure which approach will be fbetter for futuer
     if (!empty($media_ids)) {
         $mid = $media_ids[0];
         $storage_manager = mpp_get_storage_manager($mid);
     }
     //delete all media
     foreach ($media_ids as $media_id) {
         wp_delete_attachment($media_id);
         //delete all media
     }
     if (mediapress()->is_bp_active()) {
         //delete all gallery activity
         mpp_gallery_delete_activity($gallery_id);
         //delete all associated activity meta
         //mpp_gallery_delete_activity_meta( $gallery_id );
     }
     //Delete wall gallery meta
     mpp_delete_wall_gallery_id(array('component' => $gallery->component, 'component_id' => $gallery->component_id, 'gallery_id' => $gallery->id, 'media_type' => $gallery->type));
     //do any final cleanup, deletegate to the storage manager
     if ($storage_manager) {
         $storage_manager->delete_gallery($gallery);
     }
     return;
 }
开发者ID:enboig,项目名称:mediapress,代码行数:53,代码来源:class-mpp-deletion-actions-mapper.php


示例14: mpp_activity_inject_attached_media_html

/**
 * Show the list of attached media in an activity
 * Should we add a link to view gallery too?
 * 
 * @return type
 */
function mpp_activity_inject_attached_media_html()
{
    $media_list = mpp_activity_get_attached_media_ids(bp_get_activity_id());
    if (empty($media_list)) {
        return;
    }
    $activity_id = bp_get_activity_id();
    $gallery_id = mpp_activity_get_gallery_id($activity_id);
    $gallery = mpp_get_gallery($gallery_id);
    //in case we are using oembed or other storage method
    $storage_method = mpp_get_media_meta($gallery->id, '_mpp_storage_method', true);
    if ($storage_method == mpp_get_default_storage_method()) {
        $storage_method = '';
    }
    $slug = $gallery->type;
    if (!empty($storage_method)) {
        $slug = $slug . '-' . $storage_method;
    }
    //eg. video-oembed
    //media-loop-audio/media-loop-video,media-loop-photo, media-loop
    mpp_get_template_part('gallery/activity/loop', $slug);
}
开发者ID:baden03,项目名称:mediapress,代码行数:28,代码来源:hooks.php


示例15: fetch_gallery_media

    public function fetch_gallery_media()
    {
        //do we need nonce validation for this request too? no
        $items = array();
        $gallery_id = absint($_POST['gallery_id']);
        $gallery = mpp_get_gallery($gallery_id);
        if (!$gallery_id || empty($gallery)) {
            exit(0);
        }
        $statuses = mpp_get_accessible_statuses($gallery->component, $gallery->component_id, get_current_user_id());
        $media_query = new MPP_Media_Query(array('gallery_id' => $gallery_id, 'posts_per_page' => -1, 'status' => $statuses));
        if ($media_query->have_media()) {
            ?>


			<?php 
            while ($media_query->have_media()) {
                $media_query->the_media();
                ?>

				<?php 
                $items[] = array('src' => $this->get_media_lightbox_entry());
                ?>

			<?php 
            }
            ?>

		<?php 
        }
        ?>
		<?php 
        mpp_reset_media_data();
        ?>
		<?php 
        wp_send_json(array('items' => $items));
        exit(0);
    }
开发者ID:enboig,项目名称:mediapress,代码行数:38,代码来源:class-mpp-ajax-lightbox-helper.php


示例16: 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


示例17: setup_component_gallery

 /**
  * Setup gallery for components like groups/events etc
  */
 public function setup_component_gallery()
 {
     //current_action = mpp_slug(mediapress)
     if (mpp_is_active_component(bp_current_component())) {
         //is Component Gallery enabled? and are we on the Component section?
         $current_action = bp_action_variable(0);
         if ($current_action == 'create' || $current_action == 'upload') {
             mediapress()->set_action($current_action);
             mediapress()->set_edit_action($current_action);
             return;
         }
         //Are we looking at single gallery? or Media?
         //current action in this case is checked for being  a gallery slug
         if ($this->action_variables && ($gallery = mpp_gallery_exists($this->action_variables[0], $this->component, $this->component_id))) {
             //setup current gallery & gallery query
             mediapress()->current_gallery = mpp_get_gallery($gallery);
             mediapress()->the_gallery_query = new MPP_Gallery_Query(array('id' => $gallery->ID));
             $this->current_action = bp_action_variable(1);
             $this->current_manage_action = bp_action_variable(2);
             if (!empty($this->action_variables[1]) && $this->action_variables[1] == 'page' && $this->action_variables[2] > 0) {
                 $this->mpage = (int) $this->action_variables[2];
             }
         } else {
             if ($this->action_variables && $this->action_variables[0] == 'page' && $this->action_variables[1] > 0) {
                 $this->gpage = (int) $this->action_variables[1];
             }
             $args = array('component_id' => $this->component_id, 'component' => $this->component, 'status' => $this->accessible_statuses);
             if ($this->gpage) {
                 $args['page'] = absint($this->gpage);
             }
             //we are on User gallery home page(gallery list)
             //we do need to check for the access level here and pass it to the query
             //how about gallery pagination?
             mediapress()->the_gallery_query = new MPP_Gallery_Query($args);
             //set it is the user galleries list view
             mediapress()->is_gallery_home = true;
         }
         //in this case, we are on the gallery directory, check if we have it enabled?
     }
 }
开发者ID:baden03,项目名称:mediapress,代码行数:43,代码来源:loader.php


示例18: mpp_get_gallery_type

        ?>
		
		<?php 
        $type = mpp_get_gallery_type();
        ?>

		<div class='mpp-g mpp-item-list mpp-media-list mpp-<?php 
        echo $type;
        ?>
-list mpp-single-gallery-media-list mpp-single-gallery-<?php 
        echo $type;
        ?>
-list'>
			
			<?php 
        mpp_get_template_part('gallery/media/loop', mpp_get_media_loop_template_slug(mpp_get_gallery()));
        ?>
			
		</div>

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

        <?php 
        mpp_media_pagination();
        ?>

		<?php 
        do_action('mpp_after_single_gallery_pagination');
        ?>
开发者ID:baden03,项目名称:mediapress,代码行数:31,代码来源:default.php


示例19: mpp_gallery_admin_menu

/**
 * Render gallery menu
 * 
 * @param type $gallery
 */
function mpp_gallery_admin_menu($gallery, $selected = '')
{
    $gallery = mpp_get_gallery($gallery);
    mediapress()->get_menu('gallery')->render($gallery, $selected);
}
开发者ID:baden03,项目名称:mediapress,代码行数:10,代码来源:nav-functions.php


示例20: reset_gallery_data

 function reset_gallery_data()
 {
     parent::reset_postdata();
     if (!empty($this->post)) {
         mediapress()->current_gallery = mpp_get_gallery($this->post);
     }
 }
开发者ID:markc,项目名称:mediapress,代码行数:7,代码来源:class-mpp-gallery-query.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mpp_get_gallery_post_type函数代码示例发布时间:2022-05-15
下一篇:
PHP mpp_get_current_gallery_id函数代码示例发布时间: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