function media_upload_flag() { // Generate TinyMCE HTML output if (isset($_POST['send'])) { $keys = array_keys($_POST['send']); $send_id = (int) array_shift($keys); $image = $_POST['image'][$send_id]; $alttext = stripslashes(htmlspecialchars($image['alttext'], ENT_QUOTES)); $description = stripslashes(htmlspecialchars($image['description'], ENT_QUOTES)); // here is no new line allowed $clean_description = preg_replace("/\n|\r\n|\r\$/", " ", $description); $img = flagdb::find_image($send_id); $class = "flag-singlepic flag-{$image['align']}"; // Build output if ($image['size'] == "thumbnail") { $html = "<img src='{$image['thumb']}' alt='{$alttext}' class='{$class}' align='{$image['align']}' />"; } // Wrap the link to the fullsize image around $html = "<a href='{$image['url']}' title='{$clean_description}'>{$html}</a>"; if ($image['size'] == "full") { $html = "<img src='{$image['url']}' alt='{$alttext}' class='{$class}' align='{$image['align']}' />"; } media_upload_flag_save_image(); // Return it to TinyMCE media_send_to_editor($html); } // Save button if (isset($_POST['save'])) { media_upload_flag_save_image(); } wp_iframe('media_upload_flag_form'); }
/** * Build HTML for page used on iframe by thickbox */ function pageIframe() { global $body_id, $shortcode_tags; // Define this body for CSS $body_id = 'media-upload'; // Add CSS for media style wp_enqueue_style('media'); //wp_enqueue_script('ssm-main', SSM_URL . '/js/ssm-main.js', ('jquery') ); // Send to editor ? if (isset($_GET['shortcode'])) { ?> <script type="text/javascript"> /* <![CDATA[ */ var win = window.dialogArguments || opener || parent || top; win.send_to_editor('<?php echo $_GET['shortcode']; ?> '); /* ]]> */ </script> <?php die; } // Render list wp_iframe(array($this, 'form')); die; }
function media_upload_upload() { if (isset($_GET['tab']) && $_GET['tab'] == 'zip') { wp_iframe("media_upload_zip_content"); } else { wp_iframe("media_upload_zip_form"); } }
function salsapress_form_button_iframe() { wp_enqueue_script('SalsaPress', SALSAPRESS_BASE . 'utils/SalsaPress.js', array('jquery'), '1.0', true); wp_enqueue_style('SalsaPress_Admin', SALSAPRESS_BASE . 'admin/salsapress_admin.css', '', '0.5', 'all'); wp_enqueue_script('SalsaPress_Admin', SALSAPRESS_BASE . 'admin/salsapress_admin.js', array('jquery'), '1.0', true); localize_scripts(); remove_action('admin_enqueue_scripts', 'wp_auth_check_load'); wp_iframe('salsapress_form_button_iframe_content'); exit; }
function add_imgbedtab_form() { global $data; if ($_GET['tab'] == 'imgbedtab') { add_action('admin_enqueue_scripts', 'add_imgbed_scripts'); } require IMGBED_PATH . '/media_imgbedtab_form.php'; wp_iframe('media_imgbedtab_form'); //media 关键字加载media的CSS }
function insert_media_upload() { global $wp_version; if ($wp_version < '2.6') { add_action('admin_head_middmedia_media_upload', 'media_admin_css'); } else { wp_admin_css('media'); } media_upload_header(); return wp_iframe('middmedia_media_upload', $this); }
function sp_ev_media_upload_external_videos() { $errors = array(); if (!empty($_POST)) { $return = media_upload_form_handler(); if (is_string($return)) { return $return; } if (is_array($return)) { $errors = $return; } } return wp_iframe('media_upload_external_videos_form', $errors); }
function mediaUpload() { $errors = array(); if (!empty($_POST)) { $return = media_upload_form_handler(); if (is_string($return)) { return $return; } if (is_array($return)) { $errors = $return; } } wp_iframe(array($this, 'mediaForm'), $errors); }
function media_upload_gallery() { $errors = array(); if (!empty($_POST)) { $return = media_upload_form_handler(); if (is_string($return)) { return $return; } if (is_array($return)) { $errors = $return; } } wp_enqueue_script('admin-gallery'); return wp_iframe(array(&$this, 'media_upload_gallery_form'), $errors); }
function media_upload_nextgen() { // Not in use $errors = false; // Generate TinyMCE HTML output if (isset($_POST['send'])) { $keys = array_keys($_POST['send']); $send_id = (int) array_shift($keys); $image = $_POST['image'][$send_id]; $alttext = stripslashes(htmlspecialchars($image['alttext'], ENT_QUOTES)); $description = stripslashes(htmlspecialchars($image['description'], ENT_QUOTES)); // here is no new line allowed $clean_description = preg_replace("/\n|\r\n|\r\$/", " ", $description); $img = nggdb::find_image($send_id); $thumbcode = $img->get_thumbcode(); $class = "ngg-singlepic ngg-{$image['align']}"; // Create a shell displayed-gallery so we can inspect its settings $registry = C_Component_Registry::get_instance(); $mapper = $registry->get_utility('I_Displayed_Gallery_Mapper'); $factory = $registry->get_utility('I_Component_Factory'); $args = array('display_type' => NGG_BASIC_SINGLEPIC); $displayed_gallery = $factory->create('displayed_gallery', $args, $mapper); $width = $displayed_gallery->display_settings['width']; $height = $displayed_gallery->display_settings['height']; // Build output if ($image['size'] == "thumbnail") { $html = "<img src='{$image['thumb']}' alt='{$alttext}' class='{$class}' />"; } else { $html = ''; } // Wrap the link to the fullsize image around $html = "<a {$thumbcode} href='{$image['url']}' title='{$clean_description}'>{$html}</a>"; if ($image['size'] == "full") { $html = "<img src='{$image['url']}' alt='{$alttext}' class='{$class}' />"; } if ($image['size'] == "singlepic") { $html = "[singlepic id={$send_id} w={$width} h={$height} float={$image['align']}]"; } media_upload_nextgen_save_image(); // Return it to TinyMCE return media_send_to_editor($html); } // Save button if (isset($_POST['save'])) { media_upload_nextgen_save_image(); } return wp_iframe('media_upload_nextgen_form', $errors); }
function dt_a_portfolio_mu() { $errors = array(); if (!empty($_POST)) { $return = media_upload_form_handler(); if (is_string($return)) { return $return; } if (is_array($return)) { $errors = $return; } } wp_enqueue_style('media'); wp_enqueue_script('admin-gallery'); return wp_iframe('dt_portfolio_media_form', $errors); }
public static function render_media_external_tab() { $errors = null; if (!empty($_POST)) { $return = media_upload_form_handler(); if (is_string($return)) { return $return; } if (is_array($return)) { $errors = $return; } } wp_enqueue_style('media'); require_once dirname(__FILE__) . "/jwp6-media-external.php"; return wp_iframe("jwp6_media_external_tab", $errors); //wp_redirect(JWP6_PLUGIN_URL . 'jwp6-media-external.php'); //exit(); }
function media_upload_social_video() { if (isset($_POST['social_video_save'])) { // http://www.prelovac.com/vladimir/improving-security-in-wordpress-plugins-using-nonces // http://othersideofthepillow.com/tutorials/wordpress/plugins/admin-nonce/ // why we can't use our own nonce names i've no idea check_admin_referer('media-form'); $errors = media_upload_social_video_handler(); // print_r($errors); // exit; if ($errors) { return wp_iframe('media_upload_social_video_form', $errors); } else { return wp_iframe('media_upload_gallery', $errors); } } else { return wp_iframe('media_upload_social_video_form', $errors); } }
/** * Modified from media_upload_file in WordPress 3.2.1 * {@internal Missing Short Description}} * * @since 2.5.0 * * @return unknown */ function s2sfu_media_upload_handler() { add_filter('media_upload_tabs', '__return_false'); add_filter('upload_dir', 's2sfu_upload_dir'); $errors = array(); $id = 0; if (isset($_POST['html-upload']) && !empty($_FILES)) { check_admin_referer('media-form'); // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if (is_wp_error($id)) { $errors['upload_error'] = $id; $id = false; } //http://domain/?s2member_file_download= $filename = get_post_meta($id, '_wp_attached_file', true); $html = '<a href="' . site_url() . '/?s2member_file_download=' . $filename . '">' . $filename . '</a>'; return media_send_to_editor($html); } return wp_iframe('media_upload_type_s2sfu', 's2sfu', $errors, $id); }
function media_upload_nextgen() { // Not in use $errors = false; // Generate TinyMCE HTML output if (isset($_POST['send'])) { $keys = array_keys($_POST['send']); $send_id = (int) array_shift($keys); $image = $_POST['image'][$send_id]; $alttext = stripslashes(htmlspecialchars($image['alttext'], ENT_QUOTES)); $description = stripslashes(htmlspecialchars($image['description'], ENT_QUOTES)); // here is no new line allowed $clean_description = preg_replace("/\n|\r\n|\r\$/", " ", $description); $img = nggdb::find_image($send_id); $thumbcode = $img->get_thumbcode(); $class = "ngg-singlepic ngg-{$image['align']}"; // Build output if ($image['size'] == "thumbnail") { $html = "<img src='{$image['thumb']}' alt='{$alttext}' class='{$class}' />"; } // Wrap the link to the fullsize image around $html = "<a {$thumbcode} href='{$image['url']}' title='{$clean_description}'>{$html}</a>"; if ($image['size'] == "full") { $html = "<img src='{$image['url']}' alt='{$alttext}' class='{$class}' />"; } if ($image['size'] == "singlepic") { $html = "[singlepic id={$send_id} w=320 h=240 float={$image['align']}]"; } media_upload_nextgen_save_image(); // Return it to TinyMCE return media_send_to_editor($html); } // Save button if (isset($_POST['save'])) { media_upload_nextgen_save_image(); } return wp_iframe('media_upload_nextgen_form', $errors); }
Support for image renaming, tested with WordPress MU. */ /** * Removes the media 'From URL' string. (http://wordpress.stackexchange.com/a/76290/70506) * @see wp-includes|media.php */ add_filter('media_view_strings', function ($strings) { unset($strings['insertFromUrlTitle']); return $strings; }); add_filter('media_upload_tabs', function ($tabs) { $tabs['fp_grabfromurl'] = __('Save & Import from URL'); return $tabs; }); add_action('media_upload_fp_grabfromurl', function () { return wp_iframe('fpGrabFromURLIframe'); }); function fpUploadForm($headerMessage = '') { echo '<form action="" method="post" id="image-form" class="media-upload-form type-form">'; echo '<input type="hidden" name="post_id" value="' . $_REQUEST['post_id'] . '">'; wp_nonce_field('media-form'); echo '<div class="wrap media-embed" style="padding-left: 20px">' . $headerMessage . '<form> <table class="form-table"><tbody> <tr class="form-field form-required"> <th scope="row" class="label"> <span class="alignleft">Image URL</span> <span class="alignright"><abbr title="required" class="required">*</abbr></span> </th> <td class="field"><input name="grabfrom_url" type="url" required value="' . (isset($_POST['grabfrom_url']) ? $_POST['grabfrom_url'] : '') . '"></td> </tr>
function popupReturn($viewFunc) { return wp_iframe(array($this->viewObj, 'popup_' . $viewFunc), $this->data); }
public function media_menu_handle() { return wp_iframe(array($this, 'media_html')); }
function media_upload_gmedia() { global $gmCore, $gmDB; add_action('admin_enqueue_scripts', 'gmedia_add_media_popup_enqueue_scripts'); $action = $gmCore->_get('action'); if (did_action('media_upload_gmedia_galleries')) { wp_iframe('gmedia_add_media_galleries'); } elseif (did_action('media_upload_gmedia_terms')) { wp_iframe('gmedia_add_media_terms'); } elseif (did_action('media_upload_gmedia_library')) { if ('upload' == $action && current_user_can('gmedia_upload')) { wp_iframe('gmedia_add_media_upload'); } else { wp_iframe('gmedia_add_media_library'); } } // Generate TinyMCE HTML output if (isset($_POST['gmedia_library_insert'])) { $id = $gmCore->_post('ID', 0); if ($gmedia = $gmDB->get_gmedia($id)) { $meta = $gmDB->get_metadata('gmedia', $gmedia->ID, '_metadata', true); $size = $gmCore->_post('size', 'web'); $src = $gmCore->gm_get_media_image($gmedia, $size); $width = $meta[$size]['width']; $height = $meta[$size]['height']; $title = esc_attr($gmCore->_post('title', '')); $align = esc_attr($gmCore->_post('align', 'none')); $link = trim(esc_attr($gmCore->_post('link', ''))); $caption = trim($gmCore->_post('description', '')); $html = "<img src='{$src}' width='{$width}' height='{$height}' alt='{$title}' title='{$title}' id='gmedia-image-{$id}' class='gmedia-singlepic align{$align}' />"; if ($link) { $html = "<a href='{$link}'>{$html}</a>"; } if ($caption) { $html = image_add_caption($html, false, $caption, $title, $align, $src, $size, $title); } ?> <script type="text/javascript"> /* <![CDATA[ */ var win = window.dialogArguments || opener || parent || top; jQuery('#__gm-uploader', win.document).css('display', 'none'); /* ]]> */ </script> <?php // Return it to TinyMCE media_send_to_editor($html); } } if (isset($_POST['gmedia_gallery_insert'])) { $sc = $gmCore->_post('shortcode'); ?> <script type="text/javascript"> /* <![CDATA[ */ var win = window.dialogArguments || opener || parent || top; jQuery('#__gm-uploader', win.document).css('display', 'none'); /* ]]> */ </script> <?php // Return it to TinyMCE media_send_to_editor($sc); } if (isset($_POST['gmedia_term_insert'])) { $module_preset = $gmCore->_post('module_preset'); $module = ''; $preset = ''; if (!empty($module_preset)) { if ($gmCore->is_digit($module_preset)) { $module_preset = $gmDB->get_term((int) $module_preset); $module = ' module=' . $module_preset->status; $preset = ' preset=' . $module_preset->term_id; } else { $module = ' module=' . $module_preset; } } $tax = $gmCore->_post('taxonomy'); $term_id = $gmCore->_post('term_id'); if ($tax && $term_id) { $tax = str_replace('gmedia_', '', $tax); $sc = "[gm {$tax}={$term_id}{$module}{$preset}]"; ?> <script type="text/javascript"> /* <![CDATA[ */ var win = window.dialogArguments || opener || parent || top; jQuery('#__gm-uploader', win.document).css('display', 'none'); /* ]]> */ </script> <?php // Return it to TinyMCE media_send_to_editor($sc); } } }
function displayThickboxInterface() { wp_enqueue_style('ecordia'); wp_enqueue_script('ecordia'); wp_enqueue_style('global'); wp_enqueue_style('media'); wp_iframe('ecordia_thickbox_include'); }
/** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_powerpress_image() { $errors = array(); $id = 0; if (isset($_POST['html-upload']) && !empty($_FILES)) { // Upload File button was clicked $post_id = intval($_REQUEST['post_id']); // precautionary, make sure we're always working with an integer $id = media_handle_upload('async-upload', $post_id); unset($_FILES); if (is_wp_error($id)) { $errors['upload_error'] = $id; $id = false; } } return wp_iframe('powerpress_media_upload_type_form', 'powerpress_image', $errors, $id); }
/** * Main tab handler * * @param noting. * @return nothing. * * Note that wp_iframe() will add the css for the "media" page when the callback * function begins with "media". **/ function media_upload_pac_pickapictab() { // Two things can happen here, either we need to show the first page after the search button has been hit // or we need to display the paginated results for previous searches. if (isset($_POST['pac_pickapic_search_term']) && isset($_POST['pac_pickapic_results_per_page']) || isset($_GET['pac_pickapic_search_term']) && isset($_GET['pac_pickapic_results_per_page']) && isset($_GET['paged']) && !isset($_POST['pac_pickapic_choose'])) { // Displays the search results $search_term = sanitize_text_field($_REQUEST['pac_pickapic_search_term'], ''); $results = absint($_REQUEST['pac_pickapic_results_per_page']); $paged = 0; if (isset($_REQUEST['paged'])) { $paged = absint($_REQUEST['paged']); } wp_iframe('media_pac_pickapic_search_results', $search_term, $results, $paged); return; } else { if (isset($_POST['pac_pickapic_choose'])) { // A picture has been selected so we must download it from flickr and show it to the user. //TODO: Implement better error handling check_admin_referer('pac_pickapic_nonce', 'pac_pickapic_nonce_field'); //Show the selected image using get_media_item wp_iframe('media_pac_pickapic_final_form'); return; } else { if (isset($_POST['send'])) { // Check the final form arguments generated by get_media_item() function // and if they are ok the image will be inserted to the editor media_upload_form_handler(); } } } wp_iframe('media_pac_pickapic_search'); }
/** * Handles chart settigns page. * * @since 1.0.0 * * @access private */ private function _handleSettingsPage() { if ($_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce(filter_input(INPUT_GET, 'nonce'))) { if ($this->_chart->post_status == 'auto-draft') { $this->_chart->post_status = 'publish'; wp_update_post($this->_chart->to_array()); } update_post_meta($this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST); $render = new Visualizer_Render_Page_Send(); $render->text = sprintf('[visualizer id="%d"]', $this->_chart->ID); wp_iframe(array($render, 'render')); return; } $data = $this->_getChartArray(); $sidebar = ''; $sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst($data['type']); if (class_exists($sidebar_class, true)) { $sidebar = new $sidebar_class($data['settings']); $sidebar->__series = $data['series']; $sidebar->__data = $data['data']; } unset($data['settings']['width'], $data['settings']['height']); wp_enqueue_style('wp-color-picker'); wp_enqueue_style('visualizer-frame'); wp_enqueue_script('visualizer-preview'); wp_localize_script('visualizer-render', 'visualizer', array('charts' => array('canvas' => $data))); $render = new Visualizer_Render_Page_Settings(); $render->sidebar = $sidebar; if (filter_input(INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN)) { $render->button = filter_input(INPUT_GET, 'action') == Visualizer_Plugin::ACTION_EDIT_CHART ? esc_html__('Save Chart', Visualizer_Plugin::NAME) : esc_html__('Create Chart', Visualizer_Plugin::NAME); } else { $render->button = esc_attr__('Insert Chart', Visualizer_Plugin::NAME); } $this->_addAction('admin_head', 'renderFlattrScript'); wp_iframe(array($render, 'render')); }
function wpgmp_google_map_media_upload_tab() { return wp_iframe('wpgmp_google_map_icon'); }
public static function create_video_tab() { wp_iframe(array('avia_media_gallery', 'media_avia_create_video_insert')); }
function rs_custom_tab() { wp_iframe(array(&$this, 'media_tab_process')); }
/** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_powerpress_image() { $errors = array(); $id = 0; if (isset($_POST['html-upload']) && !empty($_FILES)) { // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if (is_wp_error($id)) { $errors['upload_error'] = $id; $id = false; } } return wp_iframe('powerpress_media_upload_type_form', 'powerpress_image', $errors, $id); }
/** * Add Upload tab to the popup windows * * @return void */ function upload_tab() { add_action('admin_print_scripts', 'windows_azure_storage_dialog_scripts'); wp_enqueue_style('media'); wp_iframe('windows_azure_storage_dialog_upload_tab'); }
/** * {@internal Missing Short Description}} * * @since 2.5.0 * * @return unknown */ function media_upload_library() { $errors = array(); if (!empty($_POST)) { $return = media_upload_form_handler(); if (is_string($return)) { return $return; } if (is_array($return)) { $errors = $return; } } return wp_iframe('media_upload_library_form', $errors); }
function network_shared_media_upload_shared_media() { $nsm = new network_shared_media(); return wp_iframe(array($nsm, 'media_upload_shared_media'), array()); }