本文整理汇总了PHP中is_rt_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP is_rt_admin函数的具体用法?PHP is_rt_admin怎么用?PHP is_rt_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_rt_admin函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rtmedia_album_edit
/**
* Edit album option
*
* @global RTMediaQuery $rtmedia_query
*
* @param array $options
*
* @return array|void
*/
function rtmedia_album_edit($options)
{
if (!is_rtmedia_album() || !is_user_logged_in()) {
return;
}
if (!is_rtmedia_album_enable()) {
return;
}
global $rtmedia_query;
if (isset($rtmedia_query->media_query) && isset($rtmedia_query->media_query['album_id']) && !in_array(intval($rtmedia_query->media_query['album_id']), array_map('intval', rtmedia_get_site_option('rtmedia-global-albums')), true)) {
if (rtmedia_is_album_editable() || is_rt_admin()) {
$options[] = "<a href='edit/' class='rtmedia-edit' title='" . esc_attr__('Edit Album', 'buddypress-media') . "' ><i class='rtmicon dashicons dashicons-edit'></i>" . esc_html__('Edit Album', 'buddypress-media') . '</a>';
$options[] = '<form method="post" class="album-delete-form rtmedia-inline" action="delete/">' . wp_nonce_field('rtmedia_delete_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_delete_album_nonce') . '<button type="submit" name="album-delete" class="rtmedia-delete-album" title="' . esc_attr__('Delete Album', 'buddypress-media') . '"><i class="dashicons dashicons-trash rtmicon"></i>' . esc_html__('Delete Album', 'buddypress-media') . '</button></form>';
if (is_rtmedia_group_album()) {
$album_list = rtmedia_group_album_list();
} else {
$album_list = rtmedia_user_album_list();
}
if ($album_list) {
$options[] = '<a href="#rtmedia-merge" class="rtmedia-reveal-modal rtmedia-modal-link" title="' . esc_attr__('Merge Album', 'buddypress-media') . '"><i class="dashicons dashicons-randomize"></i>' . esc_html__('Merge Album', 'buddypress-media') . '</a>';
}
}
}
return $options;
}
示例2: rtmedia_media_actions_backbone
function rtmedia_media_actions_backbone($media_array)
{
$context_id = $media_array->context_id;
$user_id = get_current_user_id();
if (is_rt_admin() || function_exists('groups_is_user_mod') && groups_is_user_mod($user_id, $context_id) || $media_array->media_author == get_current_user_id()) {
$media_array->media_actions = "<div class='rtmedia-gallery-item-actions'><a href='" . $media_array->rt_permalink . "edit' class='no-popup' target='_blank' title='" . __('Edit this media', 'buddypress-media') . "'><i class='dashicons dashicons-edit rtmicon'></i>" . __('Edit', 'buddypress-media') . "</a><a href='#' class='no-popup rtm-delete-media' title='" . __('Delete this media', 'buddypress-media') . "' ><i class='dashicons dashicons-trash rtmicon'></i>" . __('Delete', 'buddypress-media') . "</a></div>";
} else {
$media_array->media_actions = "";
}
return $media_array;
}
示例3: remove
function remove($id)
{
do_action('rtmedia_before_remove_comment', $id);
$comment = '';
if (!empty($id)) {
$comment = get_comment($id);
}
if (isset($comment->comment_post_ID) && isset($comment->user_id)) {
$model = new RTMediaModel();
//get the current media from the comment_post_ID
$media = $model->get(array('media_id' => $comment->comment_post_ID));
// if user is comment creator, or media uploader or admin, allow to delete
if (isset($media[0]->media_author) && (is_rt_admin() || intval($comment->user_id) === get_current_user_id() || intval($media[0]->media_author) === get_current_user_id())) {
$comment_deleted = $this->rtmedia_comment_model->delete($id);
do_action('rtmedia_after_remove_comment', $id);
return $comment_deleted;
}
}
return false;
}
示例4: before_render
function before_render()
{
if (!class_exists('BuddyPress') || !bp_is_active('groups')) {
return false;
}
$this->get();
// if group id is not set, don't render "Set featured"
if (empty($this->group_id)) {
return false;
}
$user_id = get_current_user_id();
// if current is not group moderator or group admin, don't render "Set featured"
if (!groups_is_user_mod($user_id, $this->group_id) && !groups_is_user_admin($user_id, $this->group_id) && !is_rt_admin()) {
return false;
}
// if current media is not any group media, don't render "Set featured"
if (!(isset($this->settings[$this->media->media_type]) && $this->settings[$this->media->media_type]) || isset($this->media->context) && 'group' != $this->media->context) {
return false;
}
if (isset($this->action_query) && isset($this->action_query->id) && $this->action_query->id == $this->featured) {
$this->label = $this->undo_label;
}
}
示例5: rtmedia_addon_update_notice
/**
* Define rtmedia addon update notice.
*
* @access public
*
* @param void
*
* @return void
*/
public function rtmedia_addon_update_notice()
{
$site_option = rtmedia_get_site_option('rtmedia-addon-update-notice-3_8');
if (is_rt_admin() && (!$site_option || 'hide' != $site_option)) {
if (!$this->check_for_addon_update_notice()) {
return;
}
rtmedia_update_site_option('rtmedia-addon-update-notice-3_8', 'show');
?>
<div class="error rtmedia-addon-upate-notice">
<p>
<strong><?php
esc_html_e('rtMedia:', 'buddypress-media');
?>
</strong> <?php
esc_html_e('Please update all premium add-ons that you have purchased from rtCamp from', 'buddypress-media');
?>
<a href="https://rtcamp.com/my-account/" target="_blank"><?php
esc_html_e('your account', 'buddypress-media');
?>
</a>. <a href="#" onclick="rtmedia_hide_addon_update_notice()" style="float:right"><?php
esc_html_e('Dismiss', 'buddypress-media');
?>
</a>
</p>
</div>
<script type="text/javascript">
function rtmedia_hide_addon_update_notice() {
var data = {
action: 'rtmedia_hide_addon_update_notice'
};
jQuery.post( ajaxurl, data, function ( response ) {
response = response.trim();
if ( response === "1" )
jQuery( '.rtmedia-addon-upate-notice' ).remove();
} );
}
</script>
<?php
}
}
示例6: activity_privacy
function activity_privacy($sql, $select_sql, $from_sql, $where_sql, $sort, $pag_sql = '')
{
if (is_rt_admin()) {
return $sql;
}
$sql = '';
$where = '';
global $bp, $wpdb;
$rtmedia_model = new RTMediaModel();
if (is_user_logged_in()) {
$user = get_current_user_id();
} else {
$user = 0;
}
$activity_upgrade_done = rtmedia_get_site_option('rtmedia_activity_done_upgrade');
// admin has upgraded rtmedia activity so we can use rt_rtm_activity table for rtmedia related activity filters
if ($activity_upgrade_done) {
$rtmedia_activity_model = new RTMediaActivityModel();
$where .= " (ra.privacy is NULL OR ra.privacy <= 0) ";
if ($user) {
$where .= "OR ((ra.privacy=20)";
$where .= " OR (a.user_id={$user} AND ra.privacy >= 40)";
if (class_exists('BuddyPress')) {
if (bp_is_active('friends')) {
$friendship = new RTMediaFriends();
$friends = $friendship->get_friends_cache($user);
if (isset($friends) && !empty($friends) != "") {
$where .= " OR (ra.privacy=40 AND a.user_id IN ('" . implode("','", $friends) . "'))";
}
}
}
$where .= ')';
}
if (function_exists("bp_core_get_table_prefix")) {
$bp_prefix = bp_core_get_table_prefix();
} else {
$bp_prefix = "";
}
if (strpos($select_sql, "SELECT DISTINCT") === false) {
$select_sql = str_replace("SELECT", "SELECT DISTINCT", $select_sql);
}
$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID LEFT JOIN {$rtmedia_model->table_name} m ON ( a.id = m.activity_id AND m.blog_id = '" . get_current_blog_id() . "' ) LEFT JOIN {$rtmedia_activity_model->table_name} ra ON ( a.id = ra.activity_id and ra.blog_id = '" . get_current_blog_id() . "' ) ";
$where_sql = $where_sql . " AND (NOT EXISTS (SELECT m.activity_id FROM {$bp_prefix}bp_activity_meta m WHERE m.meta_key='rtmedia_privacy' AND m.activity_id=a.id) OR ( {$where} ) )";
$newsql = "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}";
} else {
$where .= " (m.max_privacy is NULL OR m.max_privacy <= 0) ";
if ($user) {
$where .= "OR ((m.max_privacy=20)";
$where .= " OR (a.user_id={$user} AND m.max_privacy >= 40)";
if (class_exists('BuddyPress')) {
if (bp_is_active('friends')) {
$friendship = new RTMediaFriends();
$friends = $friendship->get_friends_cache($user);
if (isset($friends) && !empty($friends) != "") {
$where .= " OR (m.max_privacy=40 AND a.user_id IN ('" . implode("','", $friends) . "'))";
}
}
}
$where .= ')';
}
if (function_exists("bp_core_get_table_prefix")) {
$bp_prefix = bp_core_get_table_prefix();
} else {
$bp_prefix = "";
}
if (strpos($select_sql, "SELECT DISTINCT") === false) {
$select_sql = str_replace("SELECT", "SELECT DISTINCT", $select_sql);
}
$media_table = "SELECT *, max( privacy ) as max_privacy from {$rtmedia_model->table_name} group by activity_id";
$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID LEFT JOIN ( {$media_table} ) m ON ( a.id = m.activity_id AND m.blog_id = '" . get_current_blog_id() . "' ) ";
$where_sql = $where_sql . " AND (NOT EXISTS (SELECT m.activity_id FROM {$bp_prefix}bp_activity_meta m WHERE m.meta_key='rtmedia_privacy' AND m.activity_id=a.id) OR ( {$where} ) )";
$newsql = "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}";
}
return $newsql;
}
示例7: locate_template
/**
* Template Locator
*
* @param type $template
*
* @return string
*/
static function locate_template($template = false, $context = false, $url = false)
{
$located = '';
if (!$template) {
global $rtmedia_query;
if (is_rtmedia_album_gallery()) {
$template = 'album-gallery';
} elseif (is_rtmedia_album() || is_rtmedia_gallery()) {
$template = 'media-gallery';
if (is_rtmedia_album() && isset($rtmedia_query->media_query) && $rtmedia_query->action_query->action == 'edit') {
if (rtmedia_is_album_editable() || is_rt_admin()) {
$template = 'album-single-edit';
}
}
} else {
if (is_rtmedia_single()) {
$template = 'media-single';
if ($rtmedia_query->action_query->action == 'edit') {
$template = 'media-single-edit';
}
} else {
return;
}
}
$template = apply_filters('rtmedia_template_filter', $template);
}
$context = apply_filters('rtmedia_context_filter', $context);
// check and exit if $template contains relative path
if (false !== strpos($template, '.')) {
die('No Cheating');
}
$template_name = $template . '.php';
if ($context === false) {
$context = 'media/';
}
if (!$context === '') {
$context .= '/';
}
$path = 'rtmedia/' . $context;
$ogpath = 'templates/' . $context;
if (file_exists(trailingslashit(STYLESHEETPATH) . $path . $template_name)) {
if ($url) {
$located = trailingslashit(get_stylesheet_directory_uri()) . $path . $template_name;
} else {
$located = trailingslashit(STYLESHEETPATH) . $path . $template_name;
}
} else {
if (file_exists(trailingslashit(TEMPLATEPATH) . $path . $template_name)) {
if ($url) {
$located = trailingslashit(get_template_directory_uri()) . $path . $template_name;
} else {
$located = trailingslashit(TEMPLATEPATH) . $path . $template_name;
}
} else {
if ($url) {
$located = trailingslashit(RTMEDIA_URL) . $ogpath . $template_name;
} else {
$located = trailingslashit(RTMEDIA_PATH) . $ogpath . $template_name;
}
$located = apply_filters('rtmedia_located_template', $located, $url, $ogpath, $template_name);
// filter for rtmedia pro
}
}
return $located;
}
示例8: set_privacy
function set_privacy($profile)
{
if (is_rt_admin()) {
return 60;
}
$user = $this->visitor_id();
$privacy = 0;
if ($user) {
$privacy = 20;
}
if ($profile === false) {
$profile = $this->profile_id();
}
if (class_exists('BuddyPress') && bp_is_active('friends')) {
if (friends_check_friendship_status($user, $profile)) {
$privacy = 40;
}
}
if ($user === $profile) {
$privacy = 60;
}
return $privacy;
}
示例9: privacy_filter
function privacy_filter($where, $table_name)
{
if (is_rt_admin()) {
return $where;
}
$user = $this->get_user();
$where .= " AND ({$table_name}.privacy is NULL OR {$table_name}.privacy=0";
if ($user) {
$where .= " OR ({$table_name}.privacy=20)";
$where .= " OR ({$table_name}.media_author={$user} AND {$table_name}.privacy>=40)";
if (class_exists('BuddyPress')) {
if (bp_is_active('friends')) {
$friends = $this->friendship->get_friends_cache($user);
$where .= " OR ({$table_name}.privacy=40 AND {$table_name}.media_author IN ('" . implode("','", $friends) . "'))";
}
}
}
return $where . ')';
}
示例10: rtmedia_album_edit
function rtmedia_album_edit($options)
{
if (!is_rtmedia_album() || !is_user_logged_in()) {
return;
}
if (!is_rtmedia_album_enable()) {
return;
}
global $rtmedia_query;
?>
<?php
if (isset($rtmedia_query->media_query) && isset($rtmedia_query->media_query['album_id']) && !in_array($rtmedia_query->media_query['album_id'], rtmedia_get_site_option('rtmedia-global-albums'))) {
//if ( isset ( $rtmedia_query->media_query[ 'media_author' ] ) && get_current_user_id () == $rtmedia_query->media_query[ 'media_author' ] ) {
if (rtmedia_is_album_editable() || is_rt_admin()) {
$options[] = "<a href='edit/' class='rtmedia-edit' title='" . __('Edit Album', 'rtmedia') . "' ><i class='rtmicon-edit rtmicon-fw'></i>" . __('Edit Album', 'rtmedia') . "</a>";
$options[] = '<form method="post" class="album-delete-form rtmedia-inline" action="delete/">' . wp_nonce_field('rtmedia_delete_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_delete_album_nonce') . '<button type="submit" name="album-delete" class="rtmedia-delete-album" title="' . __('Delete Album', 'rtmedia') . '"><i class="rtmicon-trash-o rtmicon-fw"></i>' . __('Delete Album', 'rtmedia') . '</button></form>';
if (is_rtmedia_group_album()) {
$album_list = rtmedia_group_album_list();
} else {
$album_list = rtmedia_user_album_list();
}
if ($album_list) {
$options[] = '<a href="#rtmedia-merge" class="rtmedia-reveal-modal rtmedia-modal-link" title="' . __('Merge Album', 'rtmedia') . '"><i class="rtmicon-code-fork rtmicon-fw"></i>' . __('Merge Album', 'rtmedia') . '</a>';
}
}
}
return $options;
}
示例11: activity_privacy_sql_field
/**
* Hooked to `bp_activity_get_user_join_filter` filter. Get activity privacy field inside loop.
*
* Use only if current user has admin capability because for non admin users privacy field will be added in
* privacy filter query itself.
*
* @param $sql
* @param $select_sql
* @param $from_sql
* @param $where_sql
* @param $sort
* @param string $pag_sql
*
* @return string
*/
function activity_privacy_sql_field($sql, $select_sql, $from_sql, $where_sql, $sort, $pag_sql = '')
{
global $wpdb, $bp;
if ($this->can_use_rtm_ac_privacy() && is_rt_admin()) {
$rtmedia_activity_model = new RTMediaActivityModel();
if (strpos($sql, $rtmedia_activity_model->table_name) === false) {
$select_sql .= " ,{$this->rtm_activity_table_alias}.privacy ";
$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID LEFT JOIN {$rtmedia_activity_model->table_name} {$this->rtm_activity_table_alias} ON ( a.id = {$this->rtm_activity_table_alias}.activity_id and ra.blog_id = '" . get_current_blog_id() . "' ) ";
$sql = "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}";
}
}
return $sql;
}
示例12: rmedia_single_comment
/**
* Render single comment,
* And display show all comment link to display all comment
* @param [array] $comment [comment]
* @param [int] $count [default false other ways comment count]
* @param [int] $i [default false other ways increment with loop]
* By: Yahil
*/
function rmedia_single_comment($comment, $count = false, $i = false)
{
$html = '';
$class = '';
if (isset($count) && $count) {
$hide = $count - 5;
if ($i < $hide) {
$class = 'hide';
if (0 == $i) {
echo '<div class="rtmedia-like-info"><span id="rtmedia_show_all_comment"> ' . esc_html('Show all ' . $count . ' comments', 'rtmedia') . ' </span></div>';
}
}
}
global $allowedtags, $rtmedia_media;
$html .= '<li class="rtmedia-comment ' . $class . ' ">';
if ($comment['user_id']) {
$user_link = "<a href='" . esc_url(get_rtmedia_user_link($comment['user_id'])) . "' title='" . esc_attr(rtmedia_get_author_name($comment['user_id'])) . "'>" . esc_html(rtmedia_get_author_name($comment['user_id'])) . '</a>';
$user_name = apply_filters('rtmedia_comment_author_name', $user_link, $comment);
$profile_pic = rtmedia_author_profile_pic($show_link = true, $echo = false, $comment['user_id']);
} else {
$user_name = 'Annonymous';
$profile_pic = '';
}
if (!empty($profile_pic)) {
$html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . '</div>';
}
$html .= "<div class='rtm-comment-wrap'><div class='rtmedia-comment-details'>";
$html .= '<span class ="rtmedia-comment-author">' . $user_name . '</span>';
$html .= '<span class ="rtmedia-comment-date"> ' . apply_filters('rtmedia_comment_date_format', rtmedia_convert_date($comment['comment_date_gmt']), $comment) . '</span>';
$comment_content = $comment['comment_content'];
$activity_comment_content = get_comment_meta($comment['comment_ID'], 'activity_comment_content', true);
if (empty($activity_comment_content)) {
$activity_id = (int) get_comment_meta($comment['comment_ID'], 'activity_id', true);
if ($activity_id) {
$rtmedia_activity_comment = rtmedia_activity_comment($activity_id);
if ($rtmedia_activity_comment['content']) {
$comment_content = $rtmedia_activity_comment['content'];
update_comment_meta($comment['comment_ID'], 'activity_comment_content', $rtmedia_activity_comment['content']);
}
}
} else {
$comment_content = $activity_comment_content;
}
$comment_string = wp_kses($comment_content, $allowedtags);
$html .= '<div class="rtmedia-comment-content">' . wpautop(make_clickable(apply_filters('bp_get_activity_content', $comment_string))) . '</div>';
$html .= '<div class="rtmedia-comment-extra">' . apply_filters('rtmedia_comment_extra', '', $comment) . '</div>';
if (is_rt_admin() || isset($comment['user_id']) && (get_current_user_id() === intval($comment['user_id']) || intval($rtmedia_media->media_author) === get_current_user_id()) || apply_filters('rtmedia_allow_comment_delete', false)) {
// show delete button for comment author and admins
$html .= '<i data-id="' . esc_attr($comment['comment_ID']) . '" class = "rtmedia-delete-comment dashicons dashicons-no-alt rtmicon" title="' . esc_attr__('Delete Comment', 'buddypress-media') . '"></i>';
}
$html .= '<div class="clear"></div></div></div></li>';
return apply_filters('rtmedia_single_comment', $html, $comment);
}
示例13: rtmedia_addon_update_notice
function rtmedia_addon_update_notice()
{
if (!$this->check_for_addon_update_notice()) {
return;
}
if (is_rt_admin()) {
$site_option = rtmedia_get_site_option("rtmedia-addon-update-notice");
if (!$site_option || $site_option != "hide") {
rtmedia_update_site_option("rtmedia-addon-update-notice", "show");
echo '<div class="error rtmedia-addon-upate-notice">
<p> <b>' . __('rtMedia:') . '</b> ' . __('Please update all premium add-ons that you had purchased from rtCamp from your ', 'rtmedia') . ' <a href="https://rtcamp.com/my-account/" target="_blank">' . __('account', "rtmedia") . '</a>. <a href="#" onclick="rtmedia_hide_addon_update_notice()" style="float:right">Hide</a> </p>
</div>';
}
?>
<script type="text/javascript">
function rtmedia_hide_addon_update_notice() {
var data = {
action: 'rtmedia_hide_addon_update_notice'
};
jQuery.post( ajaxurl, data, function ( response ) {
response = response.trim();
if ( response === "1" )
jQuery( '.rtmedia-addon-upate-notice' ).remove();
} );
}
</script>
<?php
}
}