当前位置: 首页>>代码示例>>PHP>>正文


PHP get_rtmedia_user_link函数代码示例

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


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

示例1: rmedia_single_comment

function rmedia_single_comment($comment)
{
    global $allowedtags;
    $html = "";
    $html .= '<li class="rtmedia-comment">';
    if ($comment['user_id']) {
        $user_link = "<a href='" . get_rtmedia_user_link($comment['user_id']) . "' title='" . rtmedia_get_author_name($comment['user_id']) . "'>" . 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 ($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_string = wp_kses($comment['comment_content'], $allowedtags);
    $html .= '<div class="rtmedia-comment-content">' . wpautop(make_clickable(apply_filters('bp_get_activity_content', $comment_string))) . '</div>';
    global $rtmedia_media;
    if (is_rt_admin() || isset($comment['user_id']) && (get_current_user_id() == $comment['user_id'] || $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="' . $comment['comment_ID'] . '" class = "rtmedia-delete-comment dashicons dashicons-no-alt rtmicon" title="' . __('Delete Comment', 'rtmedia') . '"></i>';
    }
    $html .= '<div class="clear"></div></div></div></li>';
    return apply_filters('rtmedia_single_comment', $html, $comment);
}
开发者ID:EfncoPlugins,项目名称:rtMedia,代码行数:29,代码来源:rt-template-functions.php

示例2: check_return_merge

 function check_return_merge()
 {
     global $rtmedia_query;
     if ($rtmedia_query->action_query->action != 'merge') {
         return;
     }
     $nonce = $_REQUEST['rtmedia_merge_album_nonce'];
     if (wp_verify_nonce($nonce, 'rtmedia_merge_album_' . $rtmedia_query->media_query['album_id'])) {
         $media = new RTMediaMedia();
         $model = new RTMediaModel();
         $album_contents = $model->get(array('album_id' => $rtmedia_query->media_query['album_id']), false, false);
         $album_move_details = $model->get_media(array('id' => $_POST['album']), false, false);
         foreach ($album_contents as $album_media) {
             $post_array['ID'] = $album_media->media_id;
             $post_array['post_parent'] = $album_move_details[0]->media_id;
             wp_update_post($post_array);
             $media->update($album_media->id, array('album_id' => $album_move_details[0]->id), $album_media->media_id);
         }
         $media->delete($rtmedia_query->media_query['album_id']);
     }
     if (isset($rtmedia_query->media_query['context']) && $rtmedia_query->media_query['context'] == "group") {
         global $bp;
         $group_link = bp_get_group_permalink($bp->groups->current_group);
         wp_safe_redirect(esc_url_raw(trailingslashit($group_link) . RTMEDIA_MEDIA_SLUG . '/album/'));
     } else {
         wp_safe_redirect(esc_url_raw(trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/album/'));
     }
     exit;
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:29,代码来源:RTMediaTemplate.php

示例3: get_rtmedia_permalink

function get_rtmedia_permalink($id)
{
    $media_model = new RTMediaModel();
    $media = $media_model->get(array('id' => intval($id)));
    global $rtmedia_query;
    // Adding filter to get permalink for current blog
    add_filter('bp_get_root_domain', 'rtmedia_get_current_blog_url');
    if (!isset($media[0]->context)) {
        if (function_exists('bp_get_groups_root_slug') && isset($rtmedia_query->query) && isset($rtmedia_query->query['context']) && 'group' === $rtmedia_query->query['context']) {
            $parent_link = get_rtmedia_group_link($rtmedia_query->query['context_id']);
        } else {
            // check for global album
            $parent_link = parentlink_global_album($id);
            if ('' === $parent_link) {
                $parent_link = get_rtmedia_user_link($media[0]->media_author);
            }
        }
    } else {
        if (function_exists('bp_get_groups_root_slug') && 'group' === $media[0]->context) {
            $parent_link = get_rtmedia_group_link($media[0]->context_id);
        } else {
            // check for global album
            $parent_link = parentlink_global_album($id);
            if ('' === $parent_link) {
                $parent_link = get_rtmedia_user_link($media[0]->media_author);
            }
        }
    }
    $parent_link = trailingslashit($parent_link);
    // Removing filter so that doesn't affect other calls to this function
    remove_filter('bp_get_root_domain', 'rtmedia_get_current_blog_url');
    return trailingslashit($parent_link . RTMEDIA_MEDIA_SLUG . '/' . $id);
}
开发者ID:rtCamp,项目名称:rtMedia,代码行数:33,代码来源:RTMedia.php

示例4: migrate_single_media


//.........这里部分代码省略.........
                 $old_type = 'music';
             } else {
                 if (0 === strpos($mime_type, 'video')) {
                     $media_type = 'video';
                     $old_type = 'videos';
                 } else {
                     $media_type = 'other';
                 }
             }
         }
     }
     $activity_data = $wpdb->get_row($wpdb->prepare("select * from {$bp_prefix}bp_activity where id= %d", $result->activity_id));
     if ('album' != $media_type) {
         $this->importmedia($media_id, $prefix);
     }
     if ($this->table_exists($bp_prefix . 'bp_activity') && class_exists('BP_Activity_Activity')) {
         $bp_activity = new BP_Activity_Activity();
         $activity_sql = $wpdb->prepare("SELECT\n                            *\n                        FROM\n                            {$bp_prefix}bp_activity\n                        where\n                                        id in (select distinct\n                                    a.meta_value\n                                from\n                                    {$wpdb->postmeta} a\n                                        left join\n                                    {$wpdb->posts} p ON (a.post_id = p.ID)\n                                where\n                                    (NOT p.ID IS NULL) and p.ID = %d\n                and a.meta_key = 'bp_media_child_activity')", $media_id);
         $all_activity = $wpdb->get_results($activity_sql);
         remove_all_actions('wp_insert_comment');
         foreach ($all_activity as $activity) {
             $comments = $bp_activity->get_activity_comments($activity->id, $activity->mptt_left, $activity->mptt_right);
             $exclude = get_post_meta($media_id, 'rtmedia_imported_activity', true);
             if (!is_array($exclude)) {
                 $exclude = array();
             }
             if ($comments) {
                 $this->insert_comment($media_id, $comments, $exclude);
             }
         }
     }
     if (0 !== intval($result->parent)) {
         $album_id = $this->migrate_single_media($result->parent, true);
     } else {
         $album_id = 0;
     }
     if (function_exists('bp_activity_get_meta')) {
         $likes = bp_activity_get_meta($result->activity_id, 'favorite_count');
     } else {
         $likes = 0;
     }
     $wpdb->insert($this->bmp_table, array('blog_id' => $blog_id, 'media_id' => $media_id, 'media_type' => $media_type, 'context' => $media_context, 'context_id' => abs(intval($result->context_id)), 'activity_id' => $result->activity_id, 'privacy' => intval($result->privacy) * 10, 'media_author' => $result->media_author, 'media_title' => $result->media_title, 'album_id' => $album_id, 'likes' => $likes), array('%d', '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d'));
     $last_id = $wpdb->insert_id;
     // Photo tag meta migration
     //$photo_tag_meta = get_post_meta($media_id, "bp-media-user-tags", true);
     //        if($photo_tag_meta && !empty($photo_tag_meta)){
     //            $wpdb->insert(
     //                $wpdb->prefix . "rt_rtm_media_meta", array(
     //                    'media_id' => $media_id,
     //                    'meta_key' => "user-tags",
     //                    "meta_value" =>  maybe_serialize($photo_tag_meta)), array('%d', '%s', '%s'));
     //        }
     if ('album' != $media_type && function_exists('bp_core_get_user_domain') && $activity_data) {
         if (function_exists('bp_core_get_table_prefix')) {
             $bp_prefix = bp_core_get_table_prefix();
         } else {
             $bp_prefix = '';
         }
         $activity_data->old_primary_link = $activity_data->primary_link;
         $parent_link = get_rtmedia_user_link($activity_data->user_id);
         $activity_data->primary_link = $parent_link . RTMEDIA_MEDIA_SLUG . '/' . $last_id;
         $this->search_and_replace($activity_data->old_primary_link, $activity_data->primary_link);
         $activity_data->action = str_replace($activity_data->old_primary_link, $activity_data->primary_link, $activity_data->action);
         $activity_data->content = str_replace($activity_data->old_primary_link, $activity_data->primary_link, $activity_data->content);
         global $last_baseurl, $last_newurl;
         $replace_img = $last_newurl;
         //$last_baseurl . "rtMedia/$prefix/";
         if (false === strpos($activity_data->content, $replace_img)) {
             $activity_data->content = str_replace($last_baseurl, $replace_img, $activity_data->content);
         }
         global $wpdb;
         $wpdb->update($bp_prefix . 'bp_activity', array('primary_link' => $activity_data->primary_link, 'action' => $activity_data->action, 'content' => $activity_data->content), array('id' => $activity_data->id));
     } else {
         if ('group' == $media_context) {
             $activity_data->old_primary_link = $activity_data->primary_link;
             $parent_link = get_rtmedia_group_link(abs(intval($result->context_id)));
             $parent_link = trailingslashit($parent_link);
             $activity_data->primary_link = trailingslashit($parent_link . RTMEDIA_MEDIA_SLUG . '/' . $last_id);
             $this->search_and_replace($activity_data->old_primary_link, $activity_data->primary_link);
         } else {
             $activity_data->old_primary_link = $activity_data->primary_link;
             $parent_link = get_rtmedia_user_link($activity_data->user_id);
             $parent_link = trailingslashit($parent_link);
             $activity_data->primary_link = trailingslashit($parent_link . RTMEDIA_MEDIA_SLUG . '/' . $last_id);
             $this->search_and_replace($activity_data->old_primary_link, $activity_data->primary_link);
         }
     }
     if ('' != $old_type) {
         if ('group' == $media_context) {
             $parent_link = get_rtmedia_group_link(abs(intval($result->context_id)));
             $parent_link = trailingslashit($parent_link);
             $this->search_and_replace(trailingslashit($parent_link . $old_type . '/' . $media_id), trailingslashit($parent_link . RTMEDIA_MEDIA_SLUG . '/' . $last_id));
         } else {
             $parent_link = get_rtmedia_user_link($activity_data->user_id);
             $parent_link = trailingslashit($parent_link);
             $this->search_and_replace(trailingslashit($parent_link . $old_type . '/' . $media_id), trailingslashit($parent_link . RTMEDIA_MEDIA_SLUG . '/' . $last_id));
         }
     }
     return $last_id;
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:101,代码来源:RTMediaMigration.php

示例5: 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);
}
开发者ID:rtCamp,项目名称:rtMedia,代码行数:61,代码来源:rtmedia-functions.php

示例6: sub_nav

 public function sub_nav()
 {
     global $rtmedia, $rtmedia_query;
     if (function_exists('bp_is_group') && bp_is_group()) {
         if (isset($rtmedia->options['buddypress_enableOnGroup']) && $rtmedia->options['buddypress_enableOnGroup'] == '0') {
             return;
         }
         global $bp;
         $counts = $this->actual_counts($bp->groups->current_group->id, "group");
     } else {
         if (class_exists('BuddyPress') && isset($rtmedia->options['buddypress_enableOnProfile']) && $rtmedia->options['buddypress_enableOnProfile'] == '0') {
             return;
         }
         $counts = $this->actual_counts();
     }
     $default = false;
     if (function_exists('bp_is_group') && bp_is_group()) {
         $link = get_rtmedia_group_link(bp_get_group_id());
         $model = new RTMediaModel();
         $other_count = $model->get_other_album_count(bp_get_group_id(), "group");
     } else {
         if (function_exists('bp_displayed_user_id') && bp_displayed_user_id()) {
             $link = get_rtmedia_user_link(bp_displayed_user_id());
         } elseif (get_query_var('author')) {
             $link = get_rtmedia_user_link(get_query_var('author'));
         }
         $model = new RTMediaModel();
         $other_count = $model->get_other_album_count(bp_displayed_user_id(), "profile");
     }
     $all = '';
     if (!isset($rtmedia_query->action_query->media_type)) {
         $all = 'class="current selected"';
     }
     echo apply_filters('rtmedia_sub_nav_all', '<li id="rtmedia-nav-item-all-li" ' . $all . '><a id="rtmedia-nav-item-all" href="' . trailingslashit($link) . RTMEDIA_MEDIA_SLUG . '/">' . __("All", "rtmedia") . '<span>' . (isset($counts['total']['all']) ? $counts['total']['all'] : 0) . '</span>' . '</a></li>');
     if (!isset($rtmedia_query->action_query->action) || empty($rtmedia_query->action_query->action)) {
         $default = true;
     }
     //print_r($rtmedia_query->action_query);
     $global_album = '';
     $albums = '';
     if (isset($rtmedia_query->action_query->media_type) && $rtmedia_query->action_query->media_type == 'album') {
         $albums = 'class="current selected"';
     }
     //$other_count = 0;
     if (is_rtmedia_album_enable()) {
         if (!isset($counts['total']["album"])) {
             $counts['total']["album"] = 0;
         }
         $counts['total']["album"] = $counts['total']["album"] + $other_count;
         $album_label = __(defined('RTMEDIA_ALBUM_PLURAL_LABEL') ? constant('RTMEDIA_ALBUM_PLURAL_LABEL') : 'Albums', 'rtmedia');
         echo apply_filters('rtmedia_sub_nav_albums', '<li id="rtmedia-nav-item-albums-li" ' . $albums . '><a id="rtmedia-nav-item-albums" href="' . trailingslashit($link) . RTMEDIA_MEDIA_SLUG . '/album/">' . $album_label . '<span>' . (isset($counts['total']["album"]) ? $counts['total']["album"] : 0) . '</span>' . '</a></li>');
     }
     foreach ($rtmedia->allowed_types as $type) {
         //print_r($type);
         if (!isset($rtmedia->options['allowedTypes_' . $type['name'] . '_enabled'])) {
             continue;
         }
         if (!$rtmedia->options['allowedTypes_' . $type['name'] . '_enabled']) {
             continue;
         }
         $selected = '';
         if (isset($rtmedia_query->action_query->media_type) && $type['name'] == $rtmedia_query->action_query->media_type) {
             $selected = ' class="current selected"';
         } else {
             $selected = '';
         }
         $context = isset($rtmedia_query->query['context']) ? $rtmedia_query->query['context'] : 'default';
         $context_id = isset($rtmedia_query->query['context_id']) ? $rtmedia_query->query['context_id'] : 0;
         $name = strtoupper($type['name']);
         $is_group = false;
         $profile = self::profile_id();
         if (!$profile) {
             $profile = self::group_id();
             $is_group = true;
         }
         if (!$is_group) {
             $profile_link = trailingslashit(get_rtmedia_user_link($profile));
         } else {
             $profile_link = trailingslashit(get_rtmedia_group_link($profile));
         }
         $type_label = __(defined('RTMEDIA_' . $name . '_PLURAL_LABEL') ? constant('RTMEDIA_' . $name . '_PLURAL_LABEL') : $type['plural_label'], 'rtmedia');
         echo apply_filters('rtmedia_sub_nav_' . $type['name'], '<li id="rtmedia-nav-item-' . $type['name'] . '-' . $context . '-' . $context_id . '-li" ' . $selected . '><a id="rtmedia-nav-item-' . $type['name'] . '" href="' . $profile_link . RTMEDIA_MEDIA_SLUG . '/' . constant('RTMEDIA_' . $name . '_SLUG') . '/' . '">' . $type_label . '<span>' . (isset($counts['total'][$type['name']]) ? $counts['total'][$type['name']] : 0) . '</span>' . '</a></li>', $type['name']);
     }
     do_action("add_extra_sub_nav");
 }
开发者ID:saisai,项目名称:rtMedia,代码行数:85,代码来源:RTMediaNav.php

示例7: template_redirect

 /**
  *
  */
 function template_redirect($create_activity = true)
 {
     ob_start();
     if (!count($_POST)) {
         include get_404_template();
     } else {
         $nonce = $_REQUEST['rtmedia_upload_nonce'];
         if (isset($_REQUEST['mode'])) {
             $mode = $_REQUEST['mode'];
         }
         $rtupload = false;
         $activity_id = -1;
         $redirect_url = "";
         if (wp_verify_nonce($nonce, 'rtmedia_upload_nonce')) {
             $model = new RTMediaUploadModel();
             do_action('rtmedia_upload_set_post_object');
             $this->upload = $model->set_post_object();
             if (isset($_POST['activity_id']) && $_POST['activity_id'] != -1) {
                 $this->upload['activity_id'] = $_POST['activity_id'];
                 $activity_id = $_POST['activity_id'];
             }
             //                ////if media upload is being made for a group, identify the group privacy and set media privacy accordingly
             if (isset($this->upload['context']) && isset($this->upload['context_id']) && $this->upload['context'] == 'group' && function_exists('groups_get_group')) {
                 $group = groups_get_group(array('group_id' => $this->upload['context_id']));
                 if (isset($group->status) && $group->status != 'public') {
                     // if group is not public, then set media privacy as 20, so only the group members can see the images
                     $this->upload['privacy'] = '20';
                 } else {
                     // if group is public, then set media privacy as 0
                     $this->upload['privacy'] = '0';
                 }
             }
             $this->upload = apply_filters('rtmedia_media_param_before_upload', $this->upload);
             $rtupload = new RTMediaUpload($this->upload);
             $mediaObj = new RTMediaMedia();
             $media = $mediaObj->model->get(array('id' => $rtupload->media_ids[0]));
             $rtMediaNav = new RTMediaNav();
             $perma_link = "";
             if (isset($media) && sizeof($media) > 0) {
                 $perma_link = get_rtmedia_permalink($media[0]->id);
                 if ($media[0]->media_type == "photo") {
                     $thumb_image = rtmedia_image("rt_media_thumbnail", $rtupload->media_ids[0], false);
                 } elseif ($media[0]->media_type == "music") {
                     $thumb_image = $media[0]->cover_art;
                 } else {
                     $thumb_image = "";
                 }
                 if ($media[0]->context == "group") {
                     $rtMediaNav->refresh_counts($media[0]->context_id, array("context" => $media[0]->context, 'context_id' => $media[0]->context_id));
                 } else {
                     $rtMediaNav->refresh_counts($media[0]->media_author, array("context" => "profile", 'media_author' => $media[0]->media_author));
                 }
                 if ($create_activity !== false && class_exists('BuddyPress')) {
                     $allow_single_activity = apply_filters('rtmedia_media_single_activity', false);
                     // Following will not apply to activity uploads. For first time activity won't be generated.
                     // Create activity first and pass activity id in response.
                     // todo fixme rtmedia_media_single_activity filter. It will create 2 activity with same media if uploaded from activity page.
                     if ($activity_id == -1 && !(isset($_POST["rtmedia_update"]) && $_POST["rtmedia_update"] == "true") || $allow_single_activity) {
                         $activity_id = $mediaObj->insert_activity($media[0]->media_id, $media[0]);
                     } else {
                         $mediaObj->model->update(array('activity_id' => $activity_id), array('id' => $rtupload->media_ids[0]));
                         //
                         $same_medias = $mediaObj->model->get(array('activity_id' => $activity_id));
                         $update_activity_media = array();
                         foreach ($same_medias as $a_media) {
                             $update_activity_media[] = $a_media->id;
                         }
                         $privacy = 0;
                         if (isset($_POST["privacy"])) {
                             $privacy = $_POST["privacy"];
                         }
                         $objActivity = new RTMediaActivity($update_activity_media, $privacy, false);
                         global $wpdb, $bp;
                         $user = get_userdata($same_medias[0]->media_author);
                         $username = '<a href="' . get_rtmedia_user_link($same_medias[0]->media_author) . '">' . $user->user_nicename . '</a>';
                         $action = sprintf(__('%s added %d %s', 'buddypress-media'), $username, sizeof($same_medias), RTMEDIA_MEDIA_SLUG);
                         $action = apply_filters('rtmedia_buddypress_action_text_fitler_multiple_media', $action, $username, sizeof($same_medias), $user->user_nicename);
                         $wpdb->update($bp->activity->table_name, array("type" => "rtmedia_update", "content" => $objActivity->create_activity_html(), 'action' => $action), array("id" => $activity_id));
                     }
                     // update group last active
                     if ($media[0]->context == "group") {
                         RTMediaGroup::update_last_active($media[0]->context_id);
                     }
                 }
             }
             if (isset($this->upload['rtmedia_simple_file_upload']) && $this->upload['rtmedia_simple_file_upload'] == true) {
                 if (isset($media) && sizeof($media) > 0) {
                     if (isset($_POST["redirect"])) {
                         if (intval($_POST["redirect"]) > 1) {
                             //bulkurl
                             if ($media[0]->context == "group") {
                                 $redirect_url = trailingslashit(get_rtmedia_group_link($media[0]->context_id)) . RTMEDIA_MEDIA_SLUG;
                             } else {
                                 $redirect_url = trailingslashit(get_rtmedia_user_link($media[0]->media_author)) . RTMEDIA_MEDIA_SLUG;
                             }
                         } else {
                             $redirect_url = get_rtmedia_permalink($media[0]->id);
//.........这里部分代码省略.........
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:101,代码来源:RTMediaUploadEndpoint.php

示例8: template_redirect

 function template_redirect($create_activity = true)
 {
     ob_start();
     if (!count($_POST)) {
         // @codingStandardsIgnoreLine
         include get_404_template();
     } else {
         $nonce = $mode = '';
         $_activity_id = -1;
         if (isset($_REQUEST['rtmedia_upload_nonce'])) {
             $nonce = sanitize_text_field(wp_unslash($_REQUEST['rtmedia_upload_nonce']));
         }
         if (isset($_REQUEST['mode'])) {
             $mode = sanitize_text_field(wp_unslash($_REQUEST['mode']));
         }
         if (isset($_REQUEST['activity_id'])) {
             $_activity_id = sanitize_text_field($_REQUEST['activity_id']);
         }
         $_redirect_url = filter_input(INPUT_POST, 'redirect', FILTER_SANITIZE_NUMBER_INT);
         $rtupload = false;
         $activity_id = -1;
         $redirect_url = '';
         if (wp_verify_nonce($nonce, 'rtmedia_upload_nonce')) {
             $model = new RTMediaUploadModel();
             do_action('rtmedia_upload_set_post_object');
             $this->upload = $model->set_post_object();
             if (-1 !== $_activity_id) {
                 $this->upload['activity_id'] = $_activity_id;
                 $activity_id = $_activity_id;
             }
             //if media upload is being made for a group, identify the group privacy and set media privacy accordingly
             if (isset($this->upload['context']) && isset($this->upload['context_id']) && 'group' === $this->upload['context'] && function_exists('groups_get_group')) {
                 $group = groups_get_group(array('group_id' => $this->upload['context_id']));
                 if (isset($group->status) && 'public' !== $group->status) {
                     // if group is not public, then set media privacy as 20, so only the group members can see the images
                     $this->upload['privacy'] = '20';
                 } else {
                     // if group is public, then set media privacy as 0
                     $this->upload['privacy'] = '0';
                 }
             }
             $this->upload = apply_filters('rtmedia_media_param_before_upload', $this->upload);
             $rtupload = new RTMediaUpload($this->upload);
             $media_obj = new RTMediaMedia();
             $media = $media_obj->model->get(array('id' => $rtupload->media_ids[0]));
             $rtmedia_nav = new RTMediaNav();
             $perma_link = '';
             if (isset($media) && count($media) > 0) {
                 $perma_link = get_rtmedia_permalink($media[0]->id);
                 if ('photo' === $media[0]->media_type) {
                     $thumb_image = rtmedia_image('rt_media_thumbnail', $rtupload->media_ids[0], false);
                 } elseif ('music' === $media[0]->media_type) {
                     $thumb_image = $media[0]->cover_art;
                 } else {
                     $thumb_image = '';
                 }
                 if ('group' === $media[0]->context) {
                     $rtmedia_nav->refresh_counts($media[0]->context_id, array('context' => $media[0]->context, 'context_id' => $media[0]->context_id));
                 } else {
                     $rtmedia_nav->refresh_counts($media[0]->media_author, array('context' => 'profile', 'media_author' => $media[0]->media_author));
                 }
                 if (false !== $create_activity && class_exists('BuddyPress') && bp_is_active('activity')) {
                     $allow_single_activity = apply_filters('rtmedia_media_single_activity', false);
                     // Following will not apply to activity uploads. For first time activity won't be generated.
                     // Create activity first and pass activity id in response.
                     // todo fixme rtmedia_media_single_activity filter. It will create 2 activity with same media if uploaded from activity page.
                     $_rtmedia_update = filter_input(INPUT_POST, 'rtmedia_update', FILTER_SANITIZE_STRING);
                     if (-1 === intval($activity_id) && !(isset($_rtmedia_update) && 'true' === $_rtmedia_update) || $allow_single_activity) {
                         $activity_id = $media_obj->insert_activity($media[0]->media_id, $media[0]);
                     } else {
                         $media_obj->model->update(array('activity_id' => $activity_id), array('id' => $rtupload->media_ids[0]));
                         //
                         $same_medias = $media_obj->model->get(array('activity_id' => $activity_id));
                         $update_activity_media = array();
                         foreach ($same_medias as $a_media) {
                             $update_activity_media[] = $a_media->id;
                         }
                         $privacy = filter_input(INPUT_POST, 'privacy', FILTER_SANITIZE_NUMBER_INT);
                         if (empty($privacy)) {
                             $privacy = 0;
                         }
                         $obj_activity = new RTMediaActivity($update_activity_media, $privacy, false);
                         global $wpdb, $bp;
                         $user = get_userdata($same_medias[0]->media_author);
                         $username = '<a href="' . esc_url(get_rtmedia_user_link($same_medias[0]->media_author)) . '">' . esc_html($user->user_nicename) . '</a>';
                         $action = sprintf(esc_html__('%s added %d %s', 'buddypress-media'), $username, count($same_medias), RTMEDIA_MEDIA_SLUG);
                         $action = apply_filters('rtmedia_buddypress_action_text_fitler_multiple_media', $action, $username, count($same_medias), $user->user_nicename);
                         $wpdb->update($bp->activity->table_name, array('type' => 'rtmedia_update', 'content' => $obj_activity->create_activity_html(), 'action' => $action), array('id' => $activity_id));
                     }
                     // update group last active
                     if ('group' === $media[0]->context) {
                         RTMediaGroup::update_last_active($media[0]->context_id);
                     }
                 }
             }
             if (isset($this->upload['rtmedia_simple_file_upload']) && true == $this->upload['rtmedia_simple_file_upload']) {
                 if (isset($media) && count($media) > 0) {
                     if (isset($_redirect_url)) {
                         if (intval($_redirect_url) > 1) {
                             //bulkurl
//.........这里部分代码省略.........
开发者ID:rtCamp,项目名称:rtMedia,代码行数:101,代码来源:RTMediaUploadEndpoint.php

示例9: sub_nav

 public function sub_nav()
 {
     global $rtmedia, $rtmedia_query;
     if (function_exists('bp_is_group') && bp_is_group()) {
         if (isset($rtmedia->options['buddypress_enableOnGroup']) && 0 === intval($rtmedia->options['buddypress_enableOnGroup'])) {
             return;
         }
         global $bp;
         $counts = $this->actual_counts($bp->groups->current_group->id, 'group');
     } else {
         if (class_exists('BuddyPress') && isset($rtmedia->options['buddypress_enableOnProfile']) && 0 === intval($rtmedia->options['buddypress_enableOnProfile'])) {
             return;
         }
         $counts = $this->actual_counts();
     }
     $default = false;
     if (function_exists('bp_is_group') && bp_is_group()) {
         $link = get_rtmedia_group_link(bp_get_group_id());
         $model = new RTMediaModel();
         $other_count = $model->get_other_album_count(bp_get_group_id(), 'group');
     } else {
         if (function_exists('bp_displayed_user_id') && bp_displayed_user_id()) {
             $link = get_rtmedia_user_link(bp_displayed_user_id());
         } elseif (get_query_var('author')) {
             $link = get_rtmedia_user_link(get_query_var('author'));
         }
         $model = new RTMediaModel();
         $other_count = $model->get_other_album_count(bp_displayed_user_id(), 'profile');
     }
     $all = '';
     if (!isset($rtmedia_query->action_query->media_type) && !isset($rtmedia_query->query['media_type'])) {
         $all = 'current selected';
     }
     echo apply_filters('rtmedia_sub_nav_all', '<li id="rtmedia-nav-item-all-li" class="' . esc_attr($all) . '"><a id="rtmedia-nav-item-all" href="' . esc_url(trailingslashit($link)) . RTMEDIA_MEDIA_SLUG . '/">' . esc_html__('All', 'buddypress-media') . '<span>' . esc_html(isset($counts['total']['all']) ? $counts['total']['all'] : 0) . '</span>' . '</a></li>');
     // @codingStandardsIgnoreLine
     if (!isset($rtmedia_query->action_query->action) || empty($rtmedia_query->action_query->action)) {
         $default = true;
     }
     $albums = '';
     //condition to keep "Album" tab active
     if (array_key_exists('media_type', $rtmedia_query->query) && isset($rtmedia_query->query['media_type']) && 'album' === $rtmedia_query->query['media_type']) {
         $albums = 'current selected';
     } elseif (array_key_exists('media_type', $rtmedia_query->action_query) && isset($rtmedia_query->action_query->media_type) && 'album' === $rtmedia_query->action_query->media_type) {
         $albums = 'current selected';
     }
     if (is_rtmedia_album_enable()) {
         if (!isset($counts['total']['album'])) {
             $counts['total']['album'] = 0;
         }
         $counts['total']['album'] = $counts['total']['album'] + $other_count;
         $album_label = esc_html__(defined('RTMEDIA_ALBUM_PLURAL_LABEL') ? constant('RTMEDIA_ALBUM_PLURAL_LABEL') : 'Albums', 'buddypress-media');
         echo apply_filters('rtmedia_sub_nav_albums', '<li id="rtmedia-nav-item-albums-li" class="' . esc_attr($albums) . '"><a id="rtmedia-nav-item-albums" href="' . esc_url(trailingslashit($link)) . RTMEDIA_MEDIA_SLUG . '/album/">' . esc_html($album_label) . '<span>' . esc_html(isset($counts['total']['album']) ? $counts['total']['album'] : 0) . '</span>' . '</a></li>');
         // @codingStandardsIgnoreLine
     }
     foreach ($rtmedia->allowed_types as $type) {
         if (!isset($rtmedia->options['allowedTypes_' . $type['name'] . '_enabled'])) {
             continue;
         }
         if (!$rtmedia->options['allowedTypes_' . $type['name'] . '_enabled']) {
             continue;
         }
         $selected = '';
         if (isset($rtmedia_query->action_query->media_type) && $type['name'] === $rtmedia_query->action_query->media_type) {
             $selected = ' class="current selected"';
         } else {
             $selected = '';
         }
         $context = isset($rtmedia_query->query['context']) ? $rtmedia_query->query['context'] : 'default';
         $context_id = isset($rtmedia_query->query['context_id']) ? $rtmedia_query->query['context_id'] : 0;
         $name = strtoupper($type['name']);
         $is_group = false;
         $profile = self::profile_id();
         if (!$profile) {
             $profile = self::group_id();
             $is_group = true;
         }
         if (!$is_group) {
             $profile_link = trailingslashit(get_rtmedia_user_link($profile));
         } else {
             $profile_link = trailingslashit(get_rtmedia_group_link($profile));
         }
         $type_label = esc_html__(defined('RTMEDIA_' . $name . '_PLURAL_LABEL') ? constant('RTMEDIA_' . $name . '_PLURAL_LABEL') : $type['plural_label'], 'buddypress-media');
         echo apply_filters('rtmedia_sub_nav_' . $type['name'], '<li id="rtmedia-nav-item-' . esc_attr($type['name']) . '-' . esc_attr($context) . '-' . esc_attr($context_id) . '-li" ' . $selected . '><a id="rtmedia-nav-item-' . esc_attr($type['name']) . '" href="' . esc_url($profile_link . RTMEDIA_MEDIA_SLUG . '/' . constant('RTMEDIA_' . $name . '_SLUG') . '/') . '">' . $type_label . '<span>' . esc_html(isset($counts['total'][$type['name']]) ? $counts['total'][$type['name']] : 0) . '</span>' . '</a></li>', $type['name']);
     }
     do_action('add_extra_sub_nav');
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:86,代码来源:RTMediaNav.php

示例10: insert_activity

 function insert_activity($id, $media)
 {
     if (!$this->activity_enabled()) {
         return false;
     }
     $activity = new RTMediaActivity($media->id, $media->privacy);
     $activity_content = $activity->create_activity_html();
     $user = get_userdata($media->media_author);
     $username = '<a href="' . get_rtmedia_user_link($media->media_author) . '">' . $user->user_nicename . '</a>';
     $count = count($id);
     $media_const = 'RTMEDIA_' . strtoupper($media->media_type);
     if ($count > 1) {
         $media_const .= '_PLURAL';
     }
     $media_const .= '_LABEL';
     $media_str = constant($media_const);
     $action = sprintf($count == 1 ? __('%1$s added a %2$s', 'rtmedia') : __('%1$s added %4$d %3$s', 'rtmedia'), $username, $media->media_type, $media_str, $count);
     $action = apply_filters('rtmedia_buddypress_action_text_fitler', $action, $username, $count, $user->user_nicename, $media->media_type);
     $activity_args = array('user_id' => $user->ID, 'action' => $action, 'content' => $activity_content, 'type' => 'rtmedia_update', 'primary_link' => '', 'item_id' => $id);
     if ($media->context == "group" && function_exists("bp_get_group_status") && bp_get_group_status(groups_get_group(array("group_id" => $media->context_id))) != "public") {
         $activity_args["hide_sitewide"] = true;
     }
     if ($media->context == 'group' || 'profile') {
         $activity_args['component'] = $media->context;
         if ($media->context == 'group') {
             $activity_args['component'] = "groups";
             $activity_args['item_id'] = $media->context_id;
         }
     }
     $activity_id = bp_activity_add($activity_args);
     bp_activity_update_meta($activity_id, 'rtmedia_privacy', $media->privacy == 0 ? -1 : $media->privacy);
     $this->model->update(array('activity_id' => $activity_id), array('id' => $media->id));
     // insert/update activity details in rtmedia activity table
     $rtmedia_activity_model = new RTMediaActivityModel();
     if (!$rtmedia_activity_model->check($activity_id)) {
         $rtmedia_activity_model->insert(array('activity_id' => $activity_id, 'user_id' => $media->media_author, 'privacy' => $media->privacy));
     } else {
         $rtmedia_activity_model->update(array('activity_id' => $activity_id, 'user_id' => $media->media_author, 'privacy' => $media->privacy), array('activity_id' => $activity_id));
     }
     return $activity_id;
 }
开发者ID:poweronio,项目名称:mbsite,代码行数:41,代码来源:RTMediaMedia.php

示例11: activity_after_media_comment

 /**
  * Create BuddyPress activity when user comment on media
  *
  * @param $params array
  */
 function activity_after_media_comment($params)
 {
     if (isset($params['comment_post_ID'])) {
         // get media details
         $media_model = new RTMediaModel();
         $media_obj = $media_model->get(array('media_id' => $params['comment_post_ID']));
         $media_obj = $media_obj[0];
         // only proceed if corresponding media is exist.
         if (!empty($media_obj) && ($media_obj->context == 'profile' || $media_obj->context == 'group')) {
             $media_id = $media_obj->id;
             $user_id = $params['user_id'];
             $user = get_userdata($user_id);
             $username = '<a href="' . get_rtmedia_user_link($user_id) . '">' . $user->display_name . '</a>';
             $primary_link = get_rtmedia_permalink($media_id);
             $media_const = 'RTMEDIA_' . strtoupper($media_obj->media_type) . '_LABEL';
             $media_str = '<a href="' . $primary_link . '">' . constant($media_const) . '</a>';
             $media_author = $media_obj->media_author;
             if ($media_obj->context == 'group') {
                 $group_data = groups_get_group(array('group_id' => $media_obj->context_id));
                 $group_name = '<a href="' . bp_get_group_permalink($group_data) . '">' . $group_data->name . '</a>';
                 $action = sprintf(__('%1$s commented on a %2$s in the group %3$s', 'buddypress-media'), $username, $media_str, $group_name);
             } else {
                 if ($user_id == $media_author) {
                     $action = sprintf(__('%1$s commented on their %2$s', 'buddypress-media'), $username, $media_str);
                 } else {
                     $media_author_data = get_userdata($media_author);
                     $media_author_name = '<a href="' . get_rtmedia_user_link($media_author) . '">' . $media_author_data->display_name . '</a>';
                     $action = sprintf(__('%1$s commented on %2$s\'s %3$s', 'buddypress-media'), $username, $media_author_name, $media_str);
                 }
             }
             $comment_content = $params['comment_content'];
             $wp_comment_id = $params['comment_id'];
             // prepare activity arguments
             $activity_args = array('user_id' => $user_id, 'action' => $action, 'content' => $comment_content, 'type' => 'rtmedia_comment_activity', 'primary_link' => $primary_link, 'item_id' => $media_id, 'secondary_item_id' => $wp_comment_id);
             // set activity component
             if ($media_obj->context == 'group' || $media_obj->context == 'profile') {
                 $activity_args['component'] = $media_obj->context;
                 if ($media_obj->context == 'group') {
                     $activity_args['component'] = "groups";
                     $activity_args['item_id'] = $media_obj->context_id;
                 }
             }
             // create BuddyPress activity
             $activity_id = bp_activity_add($activity_args);
             // Store activity id into user meta for reference
             update_user_meta($user_id, 'rtm-bp-media-comment-activity-' . $media_id . '-' . $wp_comment_id, $activity_id);
         }
     }
 }
开发者ID:navinachettri,项目名称:rtMedia,代码行数:54,代码来源:RTMediaBuddyPressActivity.php

示例12: get_rtmedia_permalink

function get_rtmedia_permalink($id)
{
    $mediaModel = new RTMediaModel();
    $media = $mediaModel->get(array('id' => intval($id)));
    global $rtmedia_query;
    if (!isset($media[0]->context)) {
        if (function_exists("bp_get_groups_root_slug") && isset($rtmedia_query->query) && isset($rtmedia_query->query["context"]) && $rtmedia_query->query["context"] == "group") {
            $parent_link = get_rtmedia_group_link($rtmedia_query->query["context_id"]);
        } else {
            // check for global album
            $parent_link = parentlink_global_album($id);
            if ($parent_link == "") {
                $parent_link = get_rtmedia_user_link($media[0]->media_author);
            }
        }
    } else {
        if (function_exists("bp_get_groups_root_slug") && $media[0]->context == 'group') {
            $parent_link = get_rtmedia_group_link($media[0]->context_id);
        } else {
            // check for global album
            $parent_link = parentlink_global_album($id);
            if ($parent_link == "") {
                $parent_link = get_rtmedia_user_link($media[0]->media_author);
            }
        }
    }
    $parent_link = trailingslashit($parent_link);
    return trailingslashit($parent_link . RTMEDIA_MEDIA_SLUG . '/' . $id);
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:29,代码来源:RTMedia.php

示例13: rmedia_single_comment

function rmedia_single_comment($comment)
{
    $html = "";
    $html .= '<li class="rtmedia-comment">';
    if ($comment['user_id']) {
        $user_name = "<a href='" . get_rtmedia_user_link($comment['user_id']) . "' title='" . rtmedia_get_author_name($comment['user_id']) . "'>" . rtmedia_get_author_name($comment['user_id']) . "</a>";
        $profile_pic = rtmedia_author_profile_pic($show_link = true, $echo = false, $comment['user_id']);
    } else {
        $user_name = "Annonymous";
        $profile_pic = "";
    }
    if ($profile_pic != "") {
        $html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . "</div>";
    }
    $html .= "<div><div class='rtmedia-comment-details'>";
    $html .= '<span class ="rtmedia-comment-author">' . '' . $user_name . '</span>';
    $html .= '<div class="rtmedia-comment-content">' . wpautop(make_clickable($comment['comment_content'])) . '</div>';
    global $rtmedia_media;
    if (isset($comment['user_id']) && isset($rtmedia_media->media_author) && (is_rt_admin() || (get_current_user_id() == $comment['user_id'] || $rtmedia_media->media_author == get_current_user_id()))) {
        // show delete button for comment author and admins
        $html .= '<i data-id="' . $comment['comment_ID'] . '" class = "rtmedia-delete-comment rtmicon-times" title="' . __('Delete Comment') . '"></i>';
    }
    $html .= '<span class ="rtmedia-comment-date"> ' . rtmedia_convert_date($comment['comment_date_gmt']) . '</span>';
    $html .= '<div class="clear"></div></div></div></li>';
    return apply_filters('rtmedia_single_comment', $html, $comment);
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:26,代码来源:rt-template-functions.php


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