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

PHP get_rtmedia_permalink函数代码示例

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

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



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

示例1: format_like_notifications

 /**
  * Format string and media url for notification
  *
  * @param   array $params array ('action', 'post_id', 'initiator_id', 'total_items', 'format' )
  *
  * @return string/array     format notification as $params['format'] request
  */
 function format_like_notifications($params)
 {
     $action = $params['action'];
     $post_id = intval($params['post_id']);
     if ($this->component_action . $post_id === $action) {
         $initiator_id = $params['initiator_id'];
         $total_items = $params['total_items'];
         $format = $params['format'];
         $rtmedia_id = rtmedia_id($post_id);
         $liked_list = $this->fetch_media_like_stats($rtmedia_id);
         $liked_by = bp_core_get_username($liked_list[0]->user_id);
         $like_count = get_rtmedia_like($post_id);
         $link = esc_url(get_rtmedia_permalink($rtmedia_id));
         $media_type = rtmedia_type($rtmedia_id);
         $text = null;
         if (0 === intval($like_count)) {
             $this->delete_notification_by_item_id($initiator_id, $post_id);
         } elseif (1 === intval($like_count)) {
             $text = $liked_by . ' ' . __('liked your', 'buddypress-media') . ' ' . $media_type;
         } elseif (2 === intval($like_count)) {
             $text = $liked_by . ' ' . __('and one more friend liked your', 'buddypress-media') . ' ' . $media_type;
         } else {
             $count = $like_count - 1;
             $text = $liked_by . ' ' . __('and', 'buddypress-media') . ' ' . $count . ' ' . __('other friends liked your', 'buddypress-media') . ' ' . $media_type;
         }
         $return = apply_filters('rtmedia_before_like_notification', array('link' => $link, 'text' => $text), (int) $total_items);
         if ('string' === $format) {
             return '<a href="' . esc_url($return['link']) . '">' . esc_html($return['text']) . '</a>';
         } else {
             return $return;
         }
     }
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:40,代码来源:RTMediaLikeNotification.php


示例2: format_comment_notifications

 /**
  * format the new notification in String or array
  * @param array         $params
  * @return array/string  As per $format 
  */
 function format_comment_notifications($params)
 {
     $action = $params['action'];
     $post_id = $params['post_id'];
     if ($this->component_action . $post_id == $action) {
         $initiator_id = $params['initiator_id'];
         $total_items = $params['total_items'];
         $format = $params['format'];
         $comment_author = bp_core_get_username($initiator_id);
         $media_url = get_rtmedia_permalink(rtmedia_id($post_id));
         $media_type = rtmedia_type(rtmedia_id($post_id));
         if ($total_items == 1) {
             $text = $comment_author . ' ' . __('commented on your', 'buddypress-media') . ' ' . $media_type;
         } else {
             $text = $total_items . ' ' . __('new comments on your', 'buddypress-media') . ' ' . $media_type;
         }
         $link = $media_url;
         if ($format == 'string') {
             $return = apply_filters('rtmedia_before_comment_notification', '<a href="' . $link . '">' . $text . '</a>', (int) $total_items);
         } else {
             $return = apply_filters('rtmedia_before_comment_notification', array('link' => $link, 'text' => $text), (int) $total_items);
         }
         return $return;
     }
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:30,代码来源:RTMediaCommentNotification.php


示例3: format_like_notifications

 /**
  * Format string and media url for notification
  * 
  * @param   array           $params array ('action', 'post_id', 'initiator_id', 'total_items', 'format' )
  * @return string/array     format notification as $params['format'] request
  */
 function format_like_notifications($params)
 {
     $action = $params['action'];
     $post_id = $params['post_id'];
     if ($this->component_action . $post_id == $action) {
         $initiator_id = $params['initiator_id'];
         $total_items = $params['total_items'];
         $format = $params['format'];
         $liked_list = $this->fetch_media_like_stats(rtmedia_id($post_id));
         $liked_by = bp_core_get_username($liked_list[0]->user_id);
         $like_count = get_rtmedia_like($post_id);
         $link = get_rtmedia_permalink(rtmedia_id($post_id));
         $media_type = rtmedia_type(rtmedia_id($post_id));
         if ($like_count == 0) {
             $this->delete_notification_by_item_id($initiator_id, $post_id);
         } elseif ($like_count == 1) {
             $text = $liked_by . ' ' . __('liked your', 'rtmedia') . ' ' . $media_type;
         } elseif ($like_count == 2) {
             $text = $liked_by . ' ' . __('and one more friend liked your', 'rtmedia') . ' ' . $media_type;
         } else {
             $count = $like_count - 1;
             $text = $liked_by . ' ' . __('and', 'rtmedia') . ' ' . $count . ' ' . __('other friends liked your', 'rtmedia') . ' ' . $media_type;
         }
         if ($format == 'string') {
             $return = apply_filters('rtmedia_before_like_notification', '<a href="' . $link . '">' . $text . '</a>', (int) $total_items);
         } else {
             $return = apply_filters('rtmedia_before_like_notification', array('link' => $link, 'text' => $text), (int) $total_items);
         }
         return $return;
     }
 }
开发者ID:quyip8818,项目名称:wps,代码行数:37,代码来源:RTMediaLikeNotification.php


示例4: create_activity_html

 function create_activity_html()
 {
     $html = '';
     $html .= '<div class="rtmedia-activity-container">';
     if (!empty($this->activity_text)) {
         $html .= '<div class="rtmedia-activity-text">';
         $html .= $this->activity_text;
         $html .= '</div>';
     }
     global $rtmedia;
     if (isset($rtmedia->options['buddypress_limitOnActivity'])) {
         $limitActivityFeed = $rtmedia->options['buddypress_limitOnActivity'];
     } else {
         $limitActivityFeed = 0;
     }
     $mediaObj = new RTMediaModel();
     $media_details = $mediaObj->get(array('id' => $this->media));
     if (intval($limitActivityFeed) > 0) {
         $media_details = array_slice($media_details, 0, $limitActivityFeed, true);
     }
     $rtmedia_activity_ul_class = apply_filters('rtmedia_activity_ul_class', 'large-block-grid-3');
     $li_content = '';
     $count = 0;
     foreach ($media_details as $media) {
         $li_content .= '<li class="rtmedia-list-item media-type-' . $media->media_type . '">';
         if ('photo' == $media->media_type) {
             $li_content .= '<a href ="' . get_rtmedia_permalink($media->id) . '">';
         }
         $li_content .= '<div class="rtmedia-item-thumbnail">';
         $li_content .= $this->media($media);
         $li_content .= '</div>';
         $li_content .= '<div class="rtmedia-item-title">';
         $li_content .= '<h4 title="' . $media->media_title . '">';
         if ('photo' != $media->media_type) {
             $li_content .= '<a href="' . get_rtmedia_permalink($media->id) . '">';
         }
         $li_content .= $media->media_title;
         if ('photo' != $media->media_type) {
             $li_content .= '</a>';
         }
         $li_content .= '</h4>';
         $li_content .= '</div>';
         if ('photo' == $media->media_type) {
             $li_content .= '</a>';
         }
         $li_content .= '<div class="rtmedia-item-actions">';
         $li_content .= $this->actions();
         $li_content .= '</div>';
         $li_content .= '</li>';
         $count++;
     }
     $html .= '<ul class="rtmedia-list ' . $rtmedia_activity_ul_class . ' rtmedia-activity-media-length-' . $count . '">';
     $html .= $li_content;
     $html .= '</ul>';
     $html .= '</div>';
     return bp_activity_filter_kses($html);
 }
开发者ID:prdanielmota,项目名称:faama-site,代码行数:57,代码来源:RTMediaActivity.php


示例5: render

 function render()
 {
     /**
      * We were using session to store view count for a media by a particular user.
      * Session will no more use in rtmedia.
      *
      * All Media View reports will be genrated using rtmedia_interaction table only
      */
     $link = trailingslashit(get_rtmedia_permalink($this->media->id)) . $this->action . '/';
     echo '<form action="' . esc_url($link) . '" id="rtmedia-media-view-form"></form>';
     do_action('rtmedia_view_media_counts', $this);
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:12,代码来源:RTMediaViewCount.php


示例6: render

 function render()
 {
     if (isset($_SESSION['rtmedia_media_view']) && $_SESSION['rtmedia_media_view'] != "" && sizeof($_SESSION['rtmedia_media_view'] > 0)) {
         $key = array_search($this->media->id, $_SESSION['rtmedia_media_view']);
         if (!$key) {
             $_SESSION['rtmedia_media_view'][] = $this->media->id;
             $this->rtmedia_update_view_meta($this->media->id, $this->action);
         }
     } else {
         $_SESSION['rtmedia_media_view'] = array();
         $_SESSION['rtmedia_media_view'][] = "do not consider 0 index in php";
         $_SESSION['rtmedia_media_view'][] = $this->media->id;
         $this->rtmedia_update_view_meta($this->media->id, $this->action);
     }
     $link = trailingslashit(get_rtmedia_permalink($this->media->id)) . $this->action . '/';
     //echo '<div style="clear:both"></div><form action="'. $link .'" id="rtmedia-media-view-form"></form>';
     echo '<form action="' . $link . '" id="rtmedia-media-view-form"></form>';
     do_action("rtmedia_view_media_counts", $this);
 }
开发者ID:prdanielmota,项目名称:faama-site,代码行数:19,代码来源:RTMediaViewCount.php


示例7: rtmedia_api_process_rtmedia_gallery_request

 function rtmedia_api_process_rtmedia_gallery_request()
 {
     $this->rtmediajsonapifunction->rtmedia_api_verfiy_token();
     //Errors
     $ec_media = 160002;
     $msg_media = __('media list', 'rtmedia');
     $ec_no_media = 160003;
     $msg_no_media = __('no media found for requested media type', 'rtmedia');
     $ec_invalid_media_type = 160004;
     $msg_invalid_media_type = __('media_type not allowed', 'rtmedia');
     global $rtmedia;
     $rtmediamodel = new RTMediaModel();
     //Media type to fetch
     $media_type = $allowed_types = array_keys($rtmedia->allowed_types);
     $media_type[] = 'album';
     $allowed_types[] = 'album';
     if (!empty($_REQUEST['media_type'])) {
         if (!is_array($_REQUEST['media_type'])) {
             $media_type = explode(',', $_REQUEST['media_type']);
         } else {
             $media_type = $_REQUEST['media_type'];
         }
         //Check array for currently allowed media types
         $media_type = array_intersect($media_type, $allowed_types);
     }
     //Args for fetching media
     $args = array('media_type' => $media_type);
     //global
     if (isset($_REQUEST['global'])) {
         if ($_REQUEST['global'] == 'false') {
             $args['context'] = array('compare' => 'IS NOT', 'value' => 'NULL');
         }
     }
     //context
     if (isset($_REQUEST['context'])) {
         $args['context'] = $_REQUEST['context'];
     }
     //context Id
     if (isset($_POST['context_id'])) {
         $args['context_id'] = $_REQUEST['context_id'];
     }
     //Media Author
     $media_author = '';
     if (!is_super_admin()) {
         $media_author = $this->user_id;
         $args['media_author'] = $media_author;
     }
     if (!empty($_REQUEST['media_author'])) {
         if (is_super_admin($this->user_id)) {
             $media_author = (int) $_REQUEST['media_author'];
             $args['media_author'] = $media_author;
         }
     }
     $offset = !empty($_REQUEST['page']) ? (int) $_REQUEST['page'] : 0;
     $per_page = isset($_REQUEST['per_page']) ? (int) $_REQUEST['per_page'] : 10;
     $order_by = !empty($_REQUEST['order_by']) ? $_REQUEST['order_by'] : 'media_id desc';
     $media_list = $rtmediamodel->get($args, $offset, $per_page, $order_by);
     $media_result = array();
     foreach ($media_list as $media) {
         $data = array('id' => $media->id, 'media_title' => $media->media_title, 'album_id' => $media->album_id, 'media_type' => $media->media_type, 'media_author' => $media->media_author, 'url' => get_rtmedia_permalink($media->id), 'cover' => rtmedia_image('rt_media_thumbnail', $media->media_id, FALSE));
         //for album list all medias
         if ($media->media_type == 'album') {
             $data['media'] = $this->rtmediajsonapifunction->rtmedia_api_album_media($media->id);
         }
         $media_result[] = $data;
     }
     if (!empty($media_result)) {
         echo $this->rtmedia_api_response_object("TRUE", $ec_media, $msg_media, $media_result);
     } else {
         echo $this->rtmedia_api_response_object("FALSE", $ec_no_media, $msg_no_media);
     }
 }
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:72,代码来源:RTMediaJsonApi.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: render

 function render()
 {
     $before_render = $this->before_render();
     if ($before_render === false) {
         return false;
     }
     $button = $button_start = $button_end = '';
     if ($this->is_visible()) {
         $link = trailingslashit(get_rtmedia_permalink($this->media->id)) . $this->action . '/';
         $disabled = $icon = '';
         if (!$this->is_clickable()) {
             $disabled = ' disabled';
         }
         if (isset($this->icon_class) && $this->icon_class != "") {
             $icon = "<i class='" . $this->icon_class . "'></i>";
         }
         $button_start = '<form action="' . $link . '">';
         $button = '<button type="submit" id="rtmedia-action-button-' . $this->media->id . '" class="rtmedia-' . $this->action . ' rtmedia-action-buttons button' . $disabled . '">' . $icon . '<span>' . $this->label . '</span></button>';
         //filter the button as required
         $button = apply_filters('rtmedia_' . $this->action . '_button_filter', $button);
         $button_end = '</form>';
         $button = $button_start . $button . $button_end;
     }
     return $button;
 }
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:25,代码来源:RTMediaUserInteraction.php


示例10: save_album_edit

 function save_album_edit()
 {
     global $rtmedia_query;
     $nonce = $_REQUEST['rtmedia_media_nonce'];
     if (wp_verify_nonce($nonce, 'rtmedia_' . $rtmedia_query->media_query['album_id'])) {
         $media = new RTMediaMedia();
         $model = new RTMediaModel();
         if (isset($_POST['submit'])) {
             $data_array = array('media_title', 'description', 'privacy');
             $data = rtmedia_sanitize_object($_POST, $data_array);
             $album = $model->get_media(array('id' => $rtmedia_query->media_query['album_id']), false, false);
             $state = $media->update($album[0]->id, $data, $album[0]->media_id);
             global $rtmedia_points_media_id;
             $rtmedia_points_media_id = $album[0]->id;
             do_action('rtmedia_after_update_album', $album[0]->id, $state);
         } elseif (isset($_POST['move-selected'])) {
             $album_move = $_POST['album'];
             $selected_ids = null;
             if (isset($_POST['selected'])) {
                 $selected_ids = $_POST['selected'];
                 unset($_POST['selected']);
             }
             if (!empty($selected_ids) && is_array($selected_ids)) {
                 $album_move_details = $model->get_media(array('id' => $album_move), false, false);
                 foreach ($selected_ids as $media_id) {
                     $media_details = $model->get_media(array('id' => $media_id), false, false);
                     $post_array['ID'] = $media_details[0]->media_id;
                     $post_array['post_parent'] = $album_move_details[0]->media_id;
                     wp_update_post($post_array);
                     $media->update($media_details[0]->id, array('album_id' => $album_move_details[0]->id), $media_details[0]->media_id);
                 }
             }
         }
         //refresh
         $rtMediaNav = new RTMediaNav();
         if ($rtmedia_query->media_query['context'] == "group") {
             $rtMediaNav->refresh_counts($rtmedia_query->media_query['context_id'], array("context" => $rtmedia_query->media_query['context'], 'context_id' => $rtmedia_query->media_query['context_id']));
         } else {
             $rtMediaNav->refresh_counts($rtmedia_query->media_query['media_author'], array("context" => "profile", 'media_author' => $rtmedia_query->media_query['media_author']));
         }
         wp_safe_redirect(esc_url_raw(get_rtmedia_permalink($rtmedia_query->media_query['album_id']) . 'edit/'));
         die;
     } else {
         _e('Ooops !!! Invalid access. No nonce was found !!', 'buddypress-media');
     }
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:46,代码来源:RTMediaTemplate.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: rtmedia_api_process_rtmedia_gallery_request

 function rtmedia_api_process_rtmedia_gallery_request()
 {
     $this->rtmediajsonapifunction->rtmedia_api_verfiy_token();
     //Errors
     $ec_media = 160002;
     $msg_media = esc_html__('media list', 'buddypress-media');
     $ec_no_media = 160003;
     $msg_no_media = esc_html__('no media found for requested media type', 'buddypress-media');
     $ec_invalid_media_type = 160004;
     $msg_invalid_media_type = esc_html__('media_type not allowed', 'buddypress-media');
     global $rtmedia;
     $rtmediamodel = new RTMediaModel();
     //Media type to fetch
     $media_type = $allowed_types = array_keys($rtmedia->allowed_types);
     $media_type[] = 'album';
     $allowed_types[] = 'album';
     $media_type_temp = filter_input(INPUT_POST, 'media_type', FILTER_SANITIZE_STRING);
     $media_type_array = filter_input(INPUT_POST, 'media_type', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
     if (!empty($media_type_temp) || !empty($media_type_array)) {
         if (!is_array($media_type_array)) {
             $media_type = explode(',', $media_type_array);
         } else {
             $media_type = $media_type_temp;
         }
         //Check array for currently allowed media types
         $media_type = array_intersect($media_type, $allowed_types);
     }
     //Args for fetching media
     $args = array('media_type' => $media_type);
     //global
     $global = filter_input(INPUT_POST, 'global', FILTER_SANITIZE_STRING);
     if (isset($global)) {
         if ('false' === $global) {
             $args['context'] = array('compare' => 'IS NOT', 'value' => 'NULL');
         }
     }
     //context
     $context = filter_input(INPUT_POST, 'context', FILTER_SANITIZE_STRING);
     if (isset($context)) {
         $args['context'] = $context;
     }
     //context Id
     $context_id = filter_input(INPUT_POST, 'context_id', FILTER_SANITIZE_NUMBER_INT);
     if (isset($context_id)) {
         $args['context_id'] = $context_id;
     }
     //album id
     $album_id = filter_input(INPUT_POST, 'album_id', FILTER_SANITIZE_NUMBER_INT);
     if (!empty($album_id)) {
         $args['album_id'] = $album_id;
     }
     //Media Author
     if (!is_super_admin()) {
         $media_author = $this->user_id;
         $args['media_author'] = $media_author;
     }
     $media_author = filter_input(INPUT_POST, 'media_author', FILTER_SANITIZE_NUMBER_INT);
     if (!empty($media_author)) {
         if (is_super_admin($this->user_id)) {
             $args['media_author'] = (int) $media_author;
         }
     }
     $page = filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT, FILTER_NULL_ON_FAILURE);
     $per_page = filter_input(INPUT_POST, 'per_page', FILTER_SANITIZE_NUMBER_INT, FILTER_NULL_ON_FAILURE);
     $order_by = filter_input(INPUT_POST, 'order_by', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE);
     $offset = !empty($page) ? (int) $page : 0;
     $per_page = isset($per_page) && !is_null($per_page) ? (int) $per_page : 10;
     $order_by = !empty($order_by) ? $order_by : 'media_id desc';
     $media_list = $rtmediamodel->get($args, $offset, $per_page, $order_by);
     $media_result = array();
     foreach ($media_list as $media) {
         $data = array('id' => $media->id, 'media_title' => $media->media_title, 'album_id' => $media->album_id, 'media_type' => $media->media_type, 'media_author' => $media->media_author, 'url' => esc_url(get_rtmedia_permalink($media->id)), 'cover' => rtmedia_image('rt_media_thumbnail', $media->media_id, false));
         //for album list all medias
         if ('album' === $media->media_type) {
             $data['media'] = $this->rtmediajsonapifunction->rtmedia_api_album_media($media->id);
         }
         $media_result[] = $data;
     }
     if (!empty($media_result)) {
         wp_send_json($this->rtmedia_api_response_object('TRUE', $ec_media, $msg_media, $media_result));
     } else {
         wp_send_json($this->rtmedia_api_response_object('FALSE', $ec_no_media, $msg_no_media));
     }
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:84,代码来源:RTMediaJsonApi.php


示例13: rtmedia_attachment_link_callback

/**
 * Function to edit attachment for media
 *
 * @param  string $permalink  attachment permalink
 * @param  array $post_id  return attachment post id
 *
 * @return string attachment post permalink
 */
function rtmedia_attachment_link_callback($permalink, $post_id)
{
    $rtmedia_media_id = rtmedia_id($post_id);
    if (is_admin() && !empty($rtmedia_media_id)) {
        $permalink = esc_url(get_rtmedia_permalink(rtmedia_id($post_id))) . '#rtmedia_comment_ul';
    }
    return $permalink;
}
开发者ID:rtCamp,项目名称:rtMedia,代码行数:16,代码来源:rtmedia-filters.php


示例14: widget

    /**
     *
     * Outputs the HTML code of this widget.
     *
     * @param array An array of standard parameters for widgets in this theme
     * @param array An array of settings for this widget instance
     * @return void
     *
     **/
    function widget($args, $instance)
    {
        global $bp;
        global $rtmedia_query, $rtmedia_interaction, $rtmedia_media;
        global $rtmedia_backbone;
        $cache = get_transient(md5($this->id));
        $data_source_type = '';
        // the part with the title and widget wrappers cannot be cached!
        // in order to avoid problems with the calculating columns
        //
        extract($args, EXTR_SKIP);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Latest Photos', GKTPLNAME) : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        echo $before_title;
        echo $title;
        echo $after_title;
        if ($cache) {
            echo $cache;
            echo $after_widget;
            return;
        }
        ob_start();
        //
        $user_id = empty($instance['user_id']) ? '' : $instance['user_id'];
        $offset = empty($instance['offset']) ? 0 : $instance['offset'];
        $columns = empty($instance['columns']) ? 5 : $instance['columns'];
        $rows = empty($instance['rows']) ? 2 : $instance['rows'];
        $cache = empty($instance['cache']) ? 60 : $instance['cache'];
        if (!is_numeric($offset)) {
            $offset = 0;
        } else {
            $offset = intval($offset);
        }
        if (!is_numeric($rows)) {
            $rows = 0;
        } else {
            $rows = intval($rows);
        }
        if (!is_numeric($columns)) {
            $columns = 0;
        } else {
            $columns = intval($columns);
        }
        $model = new RTMediaModel();
        if ($data_source_type == 'user') {
            $media = $model->get_media(array('media_type' => 'photo', 'media_author' => $user_id), $offset, $columns * $rows);
        } else {
            $media = $model->get_media(array('media_type' => 'photo'), $offset, $columns * $rows);
        }
        if ($media == null) {
            echo __('There has been no recent activity.', GKTPLNAME);
        } else {
            ?>
			<div class="gk-bp-latest-photos" data-cols="<?php 
            echo $columns;
            ?>
">
				<div>
					<?php 
            foreach ($media as $img) {
                ?>
					<a href ="<?php 
                echo get_rtmedia_permalink(rtmedia_id($img->media_id));
                ?>
">
						<img src="<?php 
                rtmedia_image("rt_media_thumbnail", rtmedia_id($img->media_id));
                ?>
" alt="<?php 
                _e('View full image', GKTPLNAME);
                ?>
" />
					</a>
					<?php 
            }
            ?>
				</div>
			</div>
		<?php 
        }
        // save the cache results
        $cache_output = ob_get_flush();
        if (is_numeric($cache) && $cache > 0) {
            set_transient(md5($this->id), $cache_output, 60 * $cache);
        } else {
            delete_transient(md5($this->id));
        }
        //
        echo $after_widget;
    }
开发者ID:prdanielmota,项目名称:faama-debug,代码行数:99,代码来源:widgets.latestphotos.php


示例15: widget


//.........这里部分代码省略.........
        $new_width = $total_amount * $photo_width;
        if ($new_width > 3000) {
            $width = $new_width;
        }
        $model = new RTMediaModel();
        if ($data_source_type == 'user') {
            $media = $model->get_media(array('media_type' => 'photo', 'media_author' => $user_id), $offset, $total_amount);
        } else {
            $media = $model->get_media(array('media_type' => 'photo'), $offset, $total_amount);
        }
        ?>
		
		<div data-cols="<?php 
        echo $amount_page;
        ?>
" style="width: <?php 
        echo $width;
        ?>
px" <?php 
        if ($autoanimation == 'enabled') {
            echo 'class="animate"';
        }
        ?>
>
		
		<?php 
        if ($media == null) {
            ?>
 
			<h4> <?php 
            echo __('GK BuddyPress Gallery: There has been no recent activity.', GKTPLNAME);
            ?>
</h4>
		<?php 
        } else {
            ?>
		
			<?php 
            foreach ($media as $img) {
                ?>
			<figure style="width: <?php 
                echo $photo_width;
                ?>
px">
				<img src="<?php 
                rtmedia_image("rt_media_activity_image", rtmedia_id($img->media_id));
                ?>
" alt="<?php 
                _e('View full image', GKTPLNAME);
                ?>
" />
				<figcaption>
					<?php 
                if ($show_username == 'enabled') {
                    ?>
						<small><?php 
                    echo rtmedia_get_author_name($img->media_author);
                    ?>
</small>
					<?php 
                }
                ?>
					
					<p><?php 
                echo $this->activity_text($this->gk_activity_content($img->activity_id), 15, false);
                ?>
</p>
					
					<?php 
                if ($show_readmore == 'enabled') {
                    ?>
						<a href ="<?php 
                    echo get_rtmedia_permalink(rtmedia_id($img->media_id));
                    ?>
"><?php 
                    _e('Read more...', GKTPLNAME);
                    ?>
</a>
					<?php 
                }
                ?>
				</figcaption>
			</figure>
			<?php 
            }
            ?>
		
		<?php 
        }
        ?>
		</div>
 
		
		<?php 
        // save the cache results
        $cache_output = ob_get_flush();
        set_transient(md5($this->id), $cache_output, 3 * 60 * 60);
        //
        echo $after_widget;
    }
开发者ID:prdanielmota,项目名称:faama-debug,代码行数:101,代码来源:widgets.buddypress.php


示例16: save_album_edit

 function save_album_edit()
 {
     global $rtmedia_query;
     $nonce = isset($_REQUEST['rtmedia_media_nonce']) ? wp_unslash($_REQUEST['rtmedia_media_nonce']) : '';
     if (wp_verify_nonce($nonce, 'rtmedia_' . $rtmedia_query->media_query['album_id'])) {
         $media = new RTMediaMedia();
         $model = new RTMediaModel();
         $submit = filter_input(INPUT_POST, 'submit', FILTER_SANITIZE_STRING);
         $_move_selected = filter_input(INPUT_POST, 'move-selected', FILTER_SANITIZE_STRING);
         $_album = filter_input(INPUT_POST, 'album', FILTER_SANITIZE_STRING);
         $filters = array('selected' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY));
         $_selected_arr = filter_input_array(INPUT_POST, $filters);
         $_selected = $_selected_arr['selected'];
         if (isset($submit)) {
             $data_array = array('media_title', 'description', 'privacy');
             $data = rtmedia_sanitize_object($_POST, $data_array);
             $album = $model->get_media(array('id' => $rtmedia_query->media_query['album_id']), false, false);
             $state = $media->update($album[0]->id, $data, $album[0]->media_id);
             global $rtmedia_points_media_id;
             $rtmedia_points_media_id = $album[0]->id;
             do_action('rtmedia_after_update_album', $album[0]->id, $state);
         } elseif (!empty($_move_selected)) {
             $album_move = $_album;
             $selected_ids = null;
             if (isset($_selected)) {
                 $selected_ids = $_selected;
                 unset($_selected);
             }
             if (!empty($selected_ids) && is_array($selected_ids)) {
                 $album_move_details = $model->get_media(array('id' => $album_move), false, false);
                 foreach ($selected_ids as $media_id) {
                     $media_details = $model->get_media(array('id' => $media_id), false, false);
                     $post_array['ID'] = $media_details[0]->media_id;
                     $post_array['post_parent'] = $album_move_details[0]->media_id;
                     wp_update_post($post_array);
                     $media->update($media_details[0]->id, array('album_id' => $album_move_details[0]->id), $media_details[0]->media_id);
                 }
             }
         }
         //refresh
         $rtmedia_nav = new RTMediaNav();
         if ('group' === $rtmedia_query->media_query['context']) {
             $rtmedia_nav->refresh_counts($rtmedia_query->media_query['context_id'], array('context' => $rtmedia_query->media_query['context'], 'context_id' => $rtmedia_query->media_query['context_id']));
         } else {
             $rtmedia_nav->refresh_counts($rtmedia_query->media_query['media_author'], array('context' => 'profile', 'media_author' => $rtmedia_query->media_query['media_author']));
         }
         wp_safe_redirect(esc_url_raw(get_rtmedia_permalink($rtmedia_query->media_query['album_id']) . 'edit/'));
         die;
     } else {
         esc_html_e('Ooops !!! Invalid access. No nonce was found !!', 'buddypress-media');
     }
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:52,代码来源:RTMediaTemplate.php


示例17: rtmedia_api_album_media

该文章已有0人参与评论

请发表评论

全部评论

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