示例#1
0
/**
 * 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;
}
    /**
     * Render the uploader shortcode and attach the uploader panel
     *
     * @param type $template_name
     */
    public function render($template_name)
    {
        global $rtmedia_query;
        $album = '';
        if ($rtmedia_query && isset($rtmedia_query->media_query) && isset($rtmedia_query->media_query['album_id']) && is_rtmedia_album()) {
            $album = '<input class="rtmedia-current-album" type="hidden" name="rtmedia-current-album" value="' . $rtmedia_query->media_query['album_id'] . '" />';
        } elseif (is_rtmedia_album_enable() && $rtmedia_query && is_rtmedia_gallery()) {
            if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'profile') {
                $album = '<span> <label> <i class="rtmicon-picture-o"></i>' . __('Album', 'rtmedia') . ': </label><select name="album" class="rtmedia-user-album-list">' . rtmedia_user_album_list() . '</select></span>';
            }
            if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'group') {
                $album = '<span> <label> <i class="rtmicon-picture-o"></i>' . __('Album', 'rtmedia') . ': </label><select name="album" class="rtmedia-user-album-list">' . rtmedia_group_album_list() . '</select></span>';
            }
        }
        $up_privacy = $privacy = "";
        //uploader privacy dropdown for uploader under rtMedia Media tab.
        if (is_rtmedia_privacy_enable() && (!isset($rtmedia_query->is_upload_shortcode) || $rtmedia_query->is_upload_shortcode === false)) {
            if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'group') {
                // if the context is group, then set the media privacy to public
                $privacy = "<input type='hidden' name='privacy' value='0'/>";
            } else {
                $up_privacy = new RTMediaPrivacy();
                $up_privacy = $up_privacy->select_privacy_ui(false, 'rtSelectPrivacy');
                if ($up_privacy) {
                    $privacy = "<span><i class='rtmicon-eye'></i> <label for='privacy'> " . __('Privacy: ', 'rtmedia') . "</label>" . $up_privacy . "</span>";
                }
            }
        }
        $tabs = array('file_upload' => array('default' => array('title' => __('File Upload', 'rtmedia'), 'content' => '<div id="rtmedia-upload-container" >' . '<div id="drag-drop-area" class="drag-drop row">' . "<div class='rtm-album-privacy'>" . $album . $privacy . "</div>" . apply_filters('rtmedia_uploader_before_select_files', "") . '<div class="rtm-select-files"><input id="rtMedia-upload-button" value="' . __("Select your files", "rtmedia") . '" type="button" class="rtmedia-upload-input rtmedia-file" />' . '<span class="rtm-seperator">' . __('or', 'rtmedia') . '</span><span class="drag-drop-info">' . __('Drop your files here', 'rtmedia') . '</span> <i class="rtm-file-size-limit rtmicon-info-circle"></i></div>' . apply_filters('rtmedia_uploader_after_select_files', "") . apply_filters('rtmedia_uploader_before_start_upload_button', "") . '<input type="button" class="start-media-upload" value="' . __('Start upload', 'rtmedia') . '"/>' . apply_filters('rtmedia_uploader_after_start_upload_button', "") . '</div>' . '<div class="row">' . wp_nonce_field('rtmedia_' . get_current_user_id(), 'rtmedia_media_delete_nonce') . '<table id="rtMedia-queue-list" class="rtMedia-queue-list"><tbody></tbody></table></div>' . '</div>'), 'activity' => array('title' => __('File Upload', 'rtmedia'), 'content' => '<div class="rtmedia-container"><div id="rtmedia-action-update"><button type="button" class="rtmedia-add-media-button" id="rtmedia-add-media-button-post-update"><i class="rtmicon-plus-circle"></i>' . apply_filters('rtmedia_attach_file_message', __('Attach Files', 'rtmedia')) . '</button>' . $up_privacy . '</div><div id="rtmedia-whts-new-upload-container"><div id="rtm-upload-start-notice"><span>' . __('Upload will start only after you enter content and click Post Update.', 'rtmedia') . '</span></div><table id="rtMedia-queue-list" class="rtMedia-queue-list"><tbody></tbody></table></div></div>')), 'link_input' => array('title' => __('Insert from URL', 'rtmedia'), 'content' => '<input type="url" name="bp-media-url" class="rtmedia-upload-input rtmedia-url" />'));
        $tabs = apply_filters('rtmedia_upload_tabs', $tabs);
        $attr = $this->attributes;
        $mode = isset($_GET['mode']) && array_key_exists($_GET['mode'], $tabs) ? $_GET['mode'] : 'file_upload';
        if ($attr && is_array($attr)) {
            foreach ($attr as $key => $val) {
                ?>
                <input type='hidden' id="rt_upload_hf_<?php 
                echo sanitize_key($key);
                ?>
" value='<?php 
                echo $val;
                ?>
' name ='<?php 
                echo $key;
                ?>
' />
                <?php 
            }
        }
        $upload_type = 'default';
        if (isset($attr['activity']) && $attr['activity']) {
            $upload_type = 'activity';
        }
        $uploadHelper = new RTMediaUploadHelper();
        include $this->locate_template($template_name);
    }
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;
}
示例#4
0
    /**
     * Render the uploader shortcode and attach the uploader panel
     *
     * @param type $template_name
     */
    public function render($template_name)
    {
        global $rtmedia_query;
        $album = '';
        if (apply_filters('rtmedia_render_select_album_upload', true)) {
            if ($rtmedia_query && isset($rtmedia_query->media_query) && isset($rtmedia_query->media_query['album_id']) && is_rtmedia_album($rtmedia_query->media_query['album_id'])) {
                $album = '<input class="rtmedia-current-album" type="hidden" name="rtmedia-current-album" value="' . $rtmedia_query->media_query['album_id'] . '" />';
            } elseif (is_rtmedia_album_enable() && $rtmedia_query && is_rtmedia_gallery()) {
                if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'profile') {
                    $album = '<span> <label> <i class="dashicons dashicons-format-gallery rtmicon"></i>' . __('Album', 'buddypress-media') . ': </label><select name="album" class="rtmedia-user-album-list">' . rtmedia_user_album_list() . '</select></span>';
                }
                if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'group') {
                    $album = '<span> <label> <i class="dashicons dashicons-format-gallery rtmicon"></i>' . __('Album', 'buddypress-media') . ': </label><select name="album" class="rtmedia-user-album-list">' . rtmedia_group_album_list() . '</select></span>';
                }
            }
        }
        $up_privacy = $privacy = "";
        //uploader privacy dropdown for uploader under rtMedia Media tab.
        if (is_rtmedia_privacy_enable() && (!isset($rtmedia_query->is_upload_shortcode) || $rtmedia_query->is_upload_shortcode === false) || isset($rtmedia_query->is_upload_shortcode) && !isset($this->attributes['privacy'])) {
            if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'group' || function_exists('bp_is_groups_component') && bp_is_groups_component()) {
                // if the context is group, then set the media privacy to public
                $privacy = "<input type='hidden' name='privacy' value='0'/>";
            } else {
                $up_privacy = new RTMediaPrivacy();
                $up_privacy = $up_privacy->select_privacy_ui(false, 'rtSelectPrivacy');
                if ($up_privacy) {
                    $privacy = "<span> <label for='privacy'> <i class='dashicons dashicons-visibility rtmicon'></i> " . __('Privacy: ', 'buddypress-media') . "</label>" . $up_privacy . "</span>";
                }
            }
        }
        $upload_tabs = array('file_upload' => array('title' => __('File Upload', 'buddypress-media'), 'class' => array('rtm-upload-tab', 'active'), 'content' => '<div class="rtm-upload-tab-content" data-id="rtm-upload-tab">' . apply_filters('rtmedia_uploader_before_select_files', "") . '<div class="rtm-select-files"><input id="rtMedia-upload-button" value="' . __("Select your files", 'buddypress-media') . '" type="button" class="rtmedia-upload-input rtmedia-file" />' . '<span class="rtm-seperator">' . __('or', 'buddypress-media') . '</span><span class="drag-drop-info">' . __('Drop your files here', 'buddypress-media') . '</span> <i class="rtm-file-size-limit rtmicon-info-circle rtmicon-fw"></i></div>' . apply_filters('rtmedia_uploader_after_select_files', "") . '</div>'));
        $upload_tabs = apply_filters('rtmedia_uploader_tabs', $upload_tabs);
        if (is_array($upload_tabs) && !empty($upload_tabs)) {
            if (sizeof($upload_tabs) == 1 && isset($upload_tabs['file_upload'])) {
                $upload_tab_html = $upload_tabs['file_upload']['content'];
            } else {
                $upload_tab_html = '<div class="rtm-uploader-main-wrapper"><div class="rtm-uploader-tabs"><ul>';
                foreach ($upload_tabs as $single_tab) {
                    $upload_tab_html .= '<li class="' . implode(' ', $single_tab['class']) . '">' . $single_tab['title'] . '</li>';
                }
                $upload_tab_html .= '</ul></div>';
                foreach ($upload_tabs as $single_tab) {
                    $upload_tab_html .= $single_tab['content'];
                }
                $upload_tab_html .= '</div>';
            }
        } else {
            $upload_tab_html = '';
        }
        $tabs = array('file_upload' => array('default' => array('title' => __('File Upload', 'buddypress-media'), 'content' => '<div id="rtmedia-upload-container" >' . '<div id="drag-drop-area" class="drag-drop clearfix">' . apply_filters('rtmedia_uploader_before_album_privacy', "") . "<div class='rtm-album-privacy'>" . $album . $privacy . "</div>" . $upload_tab_html . apply_filters('rtmedia_uploader_before_start_upload_button', "") . '<input type="button" class="start-media-upload" value="' . __('Start upload', 'buddypress-media') . '"/>' . apply_filters('rtmedia_uploader_after_start_upload_button', "") . '</div>' . '<div class="clearfix">' . '<ul class="plupload_filelist_content ui-sortable rtm-plupload-list clearfix" id="rtmedia_uploader_filelist"></ul></div>' . '</div>'), 'activity' => array('title' => __('File Upload', 'buddypress-media'), 'content' => '<div class="rtmedia-plupload-container rtmedia-container clearfix">' . '<div id="rtmedia-action-update" class="clearfix">' . '<div class="rtm-upload-button-wrapper">' . '<div id="rtmedia-whts-new-upload-container">' . '</div>' . '<button type="button" class="rtmedia-add-media-button" id="rtmedia-add-media-button-post-update" title="' . apply_filters('rtmedia_attach_media_button_title', __('Attach Media', 'buddypress-media')) . '">' . '<span class="dashicons dashicons-admin-media"></span>' . apply_filters('rtmedia_attach_file_message', '') . '</button>' . '</div>' . $up_privacy . '</div>' . '</div>' . '<div class="rtmedia-plupload-notice">' . '<ul class="plupload_filelist_content ui-sortable rtm-plupload-list clearfix" id="rtmedia_uploader_filelist">' . '</ul>' . '</div>')), 'link_input' => array('title' => __('Insert from URL', 'buddypress-media'), 'content' => '<input type="url" name="bp-media-url" class="rtmedia-upload-input rtmedia-url" />'));
        $tabs = apply_filters('rtmedia_upload_tabs', $tabs);
        $attr = $this->attributes;
        $mode = isset($_GET['mode']) && array_key_exists($_GET['mode'], $tabs) ? $_GET['mode'] : 'file_upload';
        if ($attr && is_array($attr)) {
            foreach ($attr as $key => $val) {
                ?>
				<input type='hidden' id="rt_upload_hf_<?php 
                echo sanitize_key($key);
                ?>
" value='<?php 
                echo $val;
                ?>
' name ='<?php 
                echo $key;
                ?>
' />
				<?php 
            }
        }
        $upload_type = 'default';
        if (isset($attr['activity']) && $attr['activity']) {
            $upload_type = 'activity';
        }
        $uploadHelper = new RTMediaUploadHelper();
        include $this->locate_template($template_name);
    }
示例#5
0
/**
 * Rendering merge album markup
 *
 * @global      RTMediaQuery    $rtmedia_query
 */
function rtmedia_merge_album_modal()
{
    if (!is_rtmedia_album() || !is_user_logged_in()) {
        return;
    }
    if (!is_rtmedia_album_enable()) {
        return;
    }
    global $rtmedia_query;
    if (is_rtmedia_group_album()) {
        $album_list = rtmedia_group_album_list();
    } else {
        $album_list = rtmedia_user_album_list();
    }
    if ($album_list && !empty($rtmedia_query->media_query['album_id'])) {
        ?>
		<div class="rtmedia-merge-container rtmedia-popup mfp-hide" id="rtmedia-merge">
			<div id="rtm-modal-container">
				<h2 class="rtm-modal-title"><?php 
        esc_html_e('Merge Album', 'buddypress-media');
        ?>
</h2>
				<form method="post" class="album-merge-form" action="merge/">
					<p>
						<span><?php 
        esc_html_e('Select Album to merge with : ', 'buddypress-media');
        ?>
</span>
						<?php 
        echo '<select name="album" class="rtmedia-merge-user-album-list">' . $album_list . '</select>';
        // @codingStandardsIgnoreLine
        ?>
					</p>
					<?php 
        wp_nonce_field('rtmedia_merge_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_merge_album_nonce');
        ?>
					<input type="submit" class="rtmedia-merge-selected" name="merge-album" value="<?php 
        esc_html_e('Merge Album', 'buddypress-media');
        ?>
"/>
				</form>
			</div>
		</div>
		<?php 
    }
}