本文整理汇总了PHP中mediapress函数的典型用法代码示例。如果您正苦于以下问题:PHP mediapress函数的具体用法?PHP mediapress怎么用?PHP mediapress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mediapress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例2: display
public function display()
{
$path = mediapress()->get_path();
if (!class_exists('Browser')) {
require_once $path . 'admin/tools/lib/browser.php';
}
require_once $path . 'admin/tools/debug/mpp-debug-output.php';
}
示例3: mpp_current_component_id_for_user
function mpp_current_component_id_for_user($component_id)
{
if (mediapress()->is_bp_active() && bp_is_user()) {
return bp_displayed_user_id();
//that is displayed user id
}
return $component_id;
}
示例4: mpp_group_extension_load
function mpp_group_extension_load()
{
$files = array('mpp-bp-groups-actions.php', 'mpp-bp-groups-functions.php', 'mpp-bp-groups-hooks.php', 'mpp-bp-groups-group-extension.php');
$path = mediapress()->get_path() . 'modules/buddypress/groups/';
foreach ($files as $file) {
require_once $path . $file;
}
do_action('mpp_group_extension_loaded');
}
示例5: mpp_install_db
/**
* Install tables required by MediaPress
* Currently, we create only one table ( Log table )
*
* @global WPDB $wpdb
*/
function mpp_install_db()
{
global $wpdb;
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$charset_collate = !empty($wpdb->charset) ? "DEFAULT CHARACTER SET {$wpdb->charset}" : '';
$sql = array();
$log_table = mediapress()->get_table_name('logs');
$sql[] = "CREATE TABLE IF NOT EXISTS {$log_table} (\n\t\tid bigint(20) NOT NULL AUTO_INCREMENT,\n\t\tuser_id bigint(20) NOT NULL,\n\t\titem_id bigint(20) NOT NULL,\n\t\taction varchar(16) NOT NULL,\n\t\tvalue varchar(32) NOT NULL,\n\t\tlogged_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,\n\t\tPRIMARY KEY (id)\n\t) {$charset_collate};";
dbDelta($sql);
}
示例6: load
public function load()
{
$path = mediapress()->get_path() . 'modules/buddypress/';
$files = array('mpp-bp-component.php', 'activity/class-mpp-activity-media-cache-helper.php', 'activity/mpp-activity-functions.php', 'activity/mpp-activity-actions.php', 'activity/mpp-activity-template.php', 'activity/mpp-activity-hooks.php', 'groups/mpp-bp-groups-loader.php');
foreach ($files as $file) {
require_once $path . $file;
}
//MediaPress BuddyPress module is loaded now
do_action('mpp_buddypress_module_loaded');
}
示例7: __construct
private function __construct()
{
$this->url = mediapress()->get_url();
//load js on front end
add_action('wp_enqueue_scripts', array($this, 'load_js'));
add_action('wp_enqueue_scripts', array($this, 'add_js_data'));
//load admin js
add_action('admin_enqueue_scripts', array($this, 'load_js'));
add_action('wp_enqueue_scripts', array($this, 'load_css'));
add_action('wp_footer', array($this, 'footer'));
}
示例8: load_ajax_handlers
/**
* Load ajax handlers
*
* @return type
*/
public function load_ajax_handlers()
{
if (!defined('DOING_AJAX')) {
return;
}
$files = array('core/ajax/mpp-ajax.php', 'core/ajax/class-mpp-ajax-comment-helper.php');
$path = mediapress()->get_path();
foreach ($files as $file) {
require_once $path . $file;
}
}
示例9: mpp_shortcode_reset_data
function mpp_shortcode_reset_data($type, $key = null)
{
$data = mediapress()->get_data('shortcode');
//, = $shortcode_column;
if (!$key) {
unset($data[$type]);
} else {
unset($data[$type][$key]);
}
mediapress()->add_data('shortcode', $data);
//save the updated data
}
示例10: mpp_widget_reset_data
function mpp_widget_reset_data($type, $key = null)
{
$data = mediapress()->get_data('widget');
//, = $widget_column;
if (!$key) {
unset($data[$type]);
} else {
unset($data[$type][$key]);
}
mediapress()->add_data('widget', $data);
//save the updated data
}
示例11: mpp_filter_body_class
function mpp_filter_body_class($classes, $class)
{
$new_classes = array();
$component = mpp_get_current_component();
//if not mediapress pages, return
if (!mpp_is_gallery_component() && !mpp_is_component_gallery()) {
return $classes;
}
//ok, It must be mpp pages
$new_classes[] = 'mpp-page';
//for all mediapress pages
//if it is a directory page
if (mpp_is_gallery_directory()) {
$new_classes[] = 'mpp-page-directory';
} elseif (mpp_is_gallery_component() || mpp_is_component_gallery()) {
//we are on user gallery page or a component gallery page
//append class mpp-page-members or mpp-page-groups or mpp-page-events etc depending on the current associated component
$new_classes[] = 'mpp-page-' . $component;
if (mpp_is_media_management()) {
//is it edit media?
$new_classes[] = 'mpp-page-media-management';
$new_classes[] = 'mpp-page-media-management-' . mpp_get_media_type();
//mpp-photo-management, mpp-audio-management
$new_classes[] = 'mpp-page-media-manage-action-' . mediapress()->get_edit_action();
//mpp-photo-management, mpp-audio-management
} elseif (mpp_is_single_media()) {
//is it single media
$new_classes[] = 'mpp-page-media-single';
$new_classes[] = 'mpp-page-media-single-' . mpp_get_media_type();
} elseif (mpp_is_gallery_management()) {
//id gallery management?
$new_classes[] = 'mpp-page-gallery-management';
$new_classes[] = 'mpp-page-gallery-management-' . mpp_get_gallery_type();
$new_classes[] = 'mpp-page-gallery-manage-action-' . mediapress()->get_edit_action();
} elseif (mpp_is_single_gallery()) {
//is singe gallery
$new_classes[] = 'mpp-page-single-gallery';
$new_classes[] = 'mpp-page-single-gallery-' . mpp_get_gallery_type();
$new_classes[] = 'mpp-page-single-gallery-' . mpp_get_gallery_status();
} else {
//it is the gallery listing page of the component
$new_classes[] = 'mpp-page-gallery-list';
//home could have been a better name
$new_classes[] = 'mpp-page-gallery-list-' . $component;
//home could have been a better name
}
}
if (!empty($new_classes)) {
$classes = array_merge($classes, $new_classes);
}
return $classes;
}
示例12: register_taxonomy
private function register_taxonomy($taxonomy, $args)
{
extract($args);
if (empty($taxonomy)) {
return false;
}
$labels = self::_get_tax_labels($label, $labels);
if (empty($slug)) {
$slug = $taxonomy;
}
register_taxonomy($taxonomy, false, array('hierarchical' => $hierarchical, 'labels' => $labels, 'public' => true, 'show_in_menu' => false, 'show_in_nav_menus' => false, 'show_ui' => false, 'show_tagcloud' => true, 'capabilities' => array('manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'read'), 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array('with_front' => true, 'hierarchical' => $hierarchical)));
mediapress()->taxonomies[$taxonomy] = $args;
}
示例13: mpp_admin_load
function mpp_admin_load()
{
if (!is_admin() || is_admin() && defined('DOING_AJAX')) {
return;
}
$path = mediapress()->get_path() . 'admin/';
$files = array('mpp-admin-functions.php', 'mpp-admin.php', 'class-mpp-admin-post-helper.php', 'class-mpp-admin-gallery-list-helper.php', 'tools/debug/mpp-admin-debug-helper.php', 'class-mpp-admin-edit-gallery-panel.php');
foreach ($files as $file) {
require_once $path . $file;
}
//class_alias( 'MPP_Admin_Settings_Page' , 'MPP_Admin_Page' );
do_action('mpp_admin_loaded');
}
示例14: load_dir_list
/**
* Loads directroy gallery list via ajax
*
*/
public function load_dir_list()
{
$type = isset($_POST['filter']) ? $_POST['filter'] : '';
$page = absint($_POST['page']);
$scope = $_POST['scope'];
$search_terms = $_POST['search_terms'];
//make the query and setup
mediapress()->is_directory = true;
//get all public galleries, should we do type filtering
mediapress()->the_gallery_query = new MPP_Gallery_Query(array('status' => 'public', 'type' => $type, 'page' => $page, 'search_terms' => $search_terms));
mpp_get_template('gallery/loop-gallery.php');
exit(0);
}
示例15: mpp_gallery_add_unpublished_media
/**
* Add media to the list of unpublished media
*
* @param int $gallery_id
* @param int|array $media_ids single media id or an array of media ids
*/
function mpp_gallery_add_unpublished_media($gallery_id, $media_ids)
{
if (!mediapress()->is_bp_active()) {
return;
}
$media_ids = (array) $media_ids;
// one or more media is given
$unpublished = mpp_gallery_get_unpublished_media($gallery_id);
$media_ids = array_diff($media_ids, $unpublished);
//add all new media ids to the unpublished list
foreach ($media_ids as $new_media_id) {
mpp_add_gallery_meta($gallery_id, '_mpp_unpublished_media_id', $new_media_id);
}
}