本文整理汇总了PHP中mpp_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP mpp_get_option函数的具体用法?PHP mpp_get_option怎么用?PHP mpp_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mpp_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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';
}
示例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);
}
示例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;
}
示例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');
}
示例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);
}
示例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);
}
示例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;
}
示例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');
}
示例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);
}
示例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
}
}
}
示例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);
}
示例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
示例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'))));
}
示例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
示例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);
}