media_nonce_generator() статический публичный Метод

Generate nonce
static public media_nonce_generator ( $id, boolean $echo = true ) : string
$echo boolean whether nonce should be echoed
Результат string json encoded nonce
function rtmedia_delete_form($echo = true)
{
    if (rtmedia_delete_allowed()) {
        $html = '<form method="post" action="' . get_rtmedia_permalink(rtmedia_id()) . 'delete/">';
        $html .= '<input type="hidden" name="id" id="id" value="' . rtmedia_id() . '">';
        $html .= '<input type="hidden" name="request_action" id="request_action" value="delete">';
        if ($echo) {
            echo $html;
            RTMediaMedia::media_nonce_generator(rtmedia_id(), true);
            do_action("rtmedia_media_single_delete_form");
            echo '<button type="submit" title="' . __('Delete Media', 'rtmedia') . '" class="rtmedia-delete-media rtmedia-action-buttons button">' . __('Delete', 'rtmedia') . '</button></form>';
        } else {
            $output = $html;
            $rtm_nonce = RTMediaMedia::media_nonce_generator(rtmedia_id(), false);
            $rtm_nonce = json_decode($rtm_nonce);
            $rtm_nonce_field = wp_nonce_field('rtmedia_' . rtmedia_id(), $rtm_nonce->action, true, false);
            do_action("rtmedia_media_single_delete_form");
            $output .= $rtm_nonce_field . '<button type="submit" title="' . __('Delete Media', 'rtmedia') . '" class="rtmedia-delete-media rtmedia-action-buttons button">' . __('Delete', 'rtmedia') . '</button></form>';
            return $output;
        }
    }
    return false;
}
Пример #2
0
				<!--media management tab-->
				<?php 
    if (!is_rtmedia_group_album()) {
        ?>

					<div class="content" id="manage-media-tab">
						<?php 
        if (have_rtmedia()) {
            ?>
							<form class="rtmedia-album-edit rtmedia-bulk-actions" method="post"
							      name="rtmedia_album_edit">
								<?php 
            wp_nonce_field('rtmedia_bulk_delete_nonce', 'rtmedia_bulk_delete_nonce');
            ?>
								<?php 
            RTMediaMedia::media_nonce_generator($rtmedia_query->media_query['album_id']);
            ?>
								<p>
									<span><input type="checkbox" name="rtm-select-all" class="select-all"
									             title="<?php 
            esc_attr_e('Select All Visible', 'buddypress-media');
            ?>
"/></span>
									<button class="button rtmedia-move" type='button'
									        title='<?php 
            esc_attr_e('Move Selected media to another album.', 'buddypress-media');
            ?>
'><?php 
            esc_html_e('Move', 'buddypress-media');
            ?>
</button>
Пример #3
0
								<?php 
        rtmedia_title_input();
        ?>
							</div>
							<!--This function shows the privacy dropdown-->
							<?php 
        echo rtmedia_edit_media_privacy_ui();
        ?>
							<div class="rtmedia-editor-description rtm-field-wrap">
								<label><?php 
        _e('Description: ', 'rtmedia');
        ?>
</label>
								<?php 
        echo rtmedia_description_input($editor = false);
        RTMediaMedia::media_nonce_generator(rtmedia_id());
        ?>
							</div>
							<!-- Use this hook to add new fields to the edit form-->
							<?php 
        do_action('rtmedia_add_edit_fields', rtmedia_type());
        ?>
						</div>
						<!-- use this hook to add content of a new tab-->
						<?php 
        do_action('rtmedia_add_edit_tab_content', rtmedia_type());
        ?>
					</div>
					<div class="rtmedia-editor-buttons">
						<input type="submit" class="button rtm-button rtm-button-save" value="<?php 
        _e('Save', 'rtmedia');