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

PHP get_allowed_mime_types函数代码示例

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

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



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

示例1: __construct

 function __construct()
 {
     add_action('init', array($this, 'action_init'));
     $this->allowed_mime_types = function_exists('wp_get_mime_types') ? wp_get_mime_types() : get_allowed_mime_types();
     $this->has_correct_role = BYT_Theme_Utils::check_user_role(BOOKYOURTRAVEL_FRONTEND_SUBMIT_ROLE, $this->get_current_user_id());
     $this->_html_helper = new Html_Helper();
 }
开发者ID:JDjimenezdelgado,项目名称:old-mmexperience,代码行数:7,代码来源:frontend-submit.php


示例2: check_upload

 function check_upload($errors)
 {
     $mime = get_allowed_mime_types();
     $size_limit = (int) wp_convert_hr_to_bytes(fep_get_option('attachment_size', '4MB'));
     $fields = (int) fep_get_option('attachment_no', 4);
     for ($i = 0; $i < $fields; $i++) {
         $tmp_name = isset($_FILES['fep_upload']['tmp_name'][$i]) ? basename($_FILES['fep_upload']['tmp_name'][$i]) : '';
         $file_name = isset($_FILES['fep_upload']['name'][$i]) ? basename($_FILES['fep_upload']['name'][$i]) : '';
         //if file is uploaded
         if ($tmp_name) {
             $attach_type = wp_check_filetype($file_name);
             $attach_size = $_FILES['fep_upload']['size'][$i];
             //check file size
             if ($attach_size > $size_limit) {
                 $errors->add('AttachmentSize', sprintf(__("Attachment (%s) file is too big", 'fep'), $file_name));
             }
             //check file type
             if (!in_array($attach_type['type'], $mime)) {
                 $errors->add('AttachmentType', sprintf(__("Invalid attachment file type.Allowed Types are (%s)", 'fep'), implode(',', $mime)));
             }
         }
         // if $filename
     }
     // endfor
     //return $errors;
 }
开发者ID:shamim2883,项目名称:wp-front-end-pm,代码行数:26,代码来源:fep-attachment-class.php


示例3: __construct

 function __construct()
 {
     global $sc_theme_globals;
     $this->sc_theme_globals = $sc_theme_globals;
     add_action('init', array($this, 'action_init'));
     $this->allowed_mime_types = function_exists('wp_get_mime_types') ? wp_get_mime_types() : get_allowed_mime_types();
     $this->_html_helper = new Html_Helper();
 }
开发者ID:boutitinizar,项目名称:bati-men,代码行数:8,代码来源:frontend-submit.php


示例4: pugpig_adbundles_admin_notice

function pugpig_adbundles_admin_notice()
{
    $allowed_types = get_site_option('upload_filetypes');
    if (!array_key_exists('zip', get_allowed_mime_types())) {
        ?>
    <div class="update-nag"><p><?php 
        _e('Pugpig - Ad Bundles require zips to be in the allowed upload types.');
        ?>
</p></div>
  <?php 
    }
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:12,代码来源:pugpig_ad_bundles.php


示例5: allowed_file_types

 function allowed_file_types()
 {
     $allowed_file_types = array();
     // http://codex.wordpress.org/Uploading_Files
     $mime_types = get_allowed_mime_types();
     foreach ($mime_types as $type => $mime_type) {
         $extras = explode('|', $type);
         foreach ($extras as $extra) {
             $allowed_file_types[] = $extra;
         }
     }
     return $allowed_file_types;
 }
开发者ID:egill,项目名称:jetpack,代码行数:13,代码来源:class.json-api-site-jetpack.php


示例6: get_custom_uploader_allowed_types

 /**
  * Lista os formatos permitidos dentro do custom uploader
  * 
  * @return array $allowed_mime_types Os tipos permitidos
  */
 function get_custom_uploader_allowed_types($mime_types = array())
 {
     if (empty($mime_types)) {
         $mime_types = get_allowed_mime_types();
     }
     $allowed_mime_types = $mime_types;
     foreach ($mime_types as $key => $value) {
         if (wp_match_mime_types('image, audio, video', $value)) {
             unset($allowed_mime_types[$key]);
         }
     }
     return $allowed_mime_types;
 }
开发者ID:aspto,项目名称:wordpress-themes,代码行数:18,代码来源:custom-uploader.php


示例7: display_ext

function display_ext()
{
    echo '<input  type="text" name="ext" id="ext" value="' . get_option('ext') . '" size="30" style="width:85%" />';
    echo '<p><small>' . __('Entrez les extensions de fichier que vous souhaitez ajouter sans le point (séparé par un espace, ex: "mp3 doc gif")') . '</small></p>';
    echo '<p><strong>' . __('Liste des extensions déjà disponibles : ');
    echo '</strong>';
    $mimes = get_allowed_mime_types();
    $type_aff = array();
    foreach ($mimes as $ext => $mime) {
        $type_aff[] = str_replace('|', ', ', $ext);
    }
    echo implode(', ', $type_aff) . '</p>';
}
开发者ID:arthurlacoste,项目名称:add-more-files-extensions,代码行数:13,代码来源:amfe.php


示例8: wppb_upload_file_type

 function wppb_upload_file_type($file)
 {
     if (isset($_POST['wppb_upload']) && $_POST['wppb_upload'] == 'true') {
         if (isset($_POST['meta_name']) && !empty($_POST['meta_name'])) {
             $meta_name = $_POST['meta_name'];
             /*let's get the field details so we can see if we have any file restrictions */
             $all_fields = get_option('wppb_manage_fields');
             if (!empty($all_fields)) {
                 foreach ($all_fields as $field) {
                     if ($field['meta-name'] == $meta_name) {
                         $allowed_upload_extensions = '';
                         if ($field['field'] == 'Upload' && !empty($field['allowed-upload-extensions'])) {
                             $allowed_upload_extensions = $field['allowed-upload-extensions'];
                         }
                         if ($field['field'] == 'Avatar' && !empty($field['allowed-image-extensions'])) {
                             if (trim($field['allowed-image-extensions']) == '.*') {
                                 $allowed_upload_extensions = '.jpg,.jpeg,.gif,.png';
                             } else {
                                 $allowed_upload_extensions = $field['allowed-image-extensions'];
                             }
                         }
                         $ext = strtolower(substr(strrchr($file['name'], '.'), 1));
                         if (!empty($allowed_upload_extensions) && $allowed_upload_extensions != '.*') {
                             $allowed = str_replace('.', '', array_map('trim', explode(",", strtolower($allowed_upload_extensions))));
                             //first check if the user uploaded the right type
                             if (!in_array($ext, (array) $allowed)) {
                                 $file['error'] = __("Sorry, you cannot upload this file type for this field.", 'profile-builder');
                                 return $file;
                             }
                         }
                         //check if the type is allowed at all by WordPress
                         foreach (get_allowed_mime_types() as $key => $value) {
                             if (strpos($key, $ext) !== false || $key == $ext) {
                                 return $file;
                             }
                         }
                         $file['error'] = __("Sorry, you cannot upload this file type for this field.", 'profile-builder');
                     }
                 }
             }
         }
         if (empty($_POST['meta_name'])) {
             $file['error'] = __("An error occurred, please try again later.", 'profile-builder');
         }
     }
     return $file;
 }
开发者ID:alvarpoon,项目名称:aeg,代码行数:47,代码来源:upload_helper_functions.php


示例9: wp_check_filetype

function wp_check_filetype($filename, $mimes = null)
{
    if (empty($mimes)) {
        $mimes = get_allowed_mime_types();
    }
    $type = false;
    $ext = false;
    foreach ($mimes as $ext_preg => $mime_match) {
        $ext_preg = '!\\.(' . $ext_preg . ')(\\?.*)?$!i';
        if (preg_match($ext_preg, $filename, $ext_matches)) {
            $type = $mime_match;
            $ext = $ext_matches[1];
            break;
        }
    }
    return compact('ext', 'type');
}
开发者ID:shyaken,项目名称:maoy.palt,代码行数:17,代码来源:session.php


示例10: get_image_mime_types

 /**
  * Get image mime types
  *
  * @since  0.1.0
  * @return array
  */
 protected function get_image_mime_types()
 {
     $mime_types = get_allowed_mime_types();
     foreach ($mime_types as $id => $type) {
         if (false === strpos($type, 'image/')) {
             unset($mime_types[$id]);
         }
     }
     /**
      * Filter image mime types
      *
      * @since 0.1.0
      * @param array $mime_types Image mime types.
      */
     $mime_types = apply_filters('icon_picker_image_mime_types', $mime_types);
     // We need to exclude image/svg*.
     unset($mime_types['svg']);
     return $mime_types;
 }
开发者ID:xeiter,项目名称:timeplannr,代码行数:25,代码来源:image.php


示例11: sanitize_file_name

function sanitize_file_name($filename)
{
    $filename_raw = $filename;
    $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "\$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
    // $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw);
    $filename = str_replace($special_chars, '', $filename);
    $filename = preg_replace('/[\\s-]+/', '-', $filename);
    $filename = trim($filename, '.-_');
    // Split the filename into a base and extension[s]
    $parts = explode('.', $filename);
    // Return if only one extension
    if (count($parts) <= 2) {
        return $filename;
    }
    // Process multiple extensions
    $filename = array_shift($parts);
    $extension = array_pop($parts);
    $mimes = get_allowed_mime_types();
    // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character
    // long alpha string not in the extension whitelist.
    foreach ((array) $parts as $part) {
        $filename .= '.' . $part;
        if (preg_match("/^[a-zA-Z]{2,5}\\d?\$/", $part)) {
            $allowed = false;
            foreach ($mimes as $ext_preg => $mime_match) {
                $ext_preg = '!^(' . $ext_preg . ')$!i';
                if (preg_match($ext_preg, $part)) {
                    $allowed = true;
                    break;
                }
            }
            if (!$allowed) {
                $filename .= '_';
            }
        }
    }
    $filename .= '.' . $extension;
    return $filename;
}
开发者ID:marcolongitude,项目名称:SocialTecMar,代码行数:39,代码来源:sanitizer.php


示例12: dynimg_404_handler

function dynimg_404_handler()
{
    if (!is_404()) {
        return;
    }
    if (preg_match('/(.*)-([0-9]+)x([0-9]+)(c)?\\.(jpg|png|gif)/i', $_SERVER['REQUEST_URI'], $matches)) {
        $filename = $matches[1] . '.' . $matches[5];
        $width = $matches[2];
        $height = $matches[3];
        $crop = !empty($matches[4]);
        $uploads_dir = wp_upload_dir();
        $temp = parse_url($uploads_dir['baseurl']);
        $upload_path = $temp['path'];
        $findfile = str_replace($upload_path, '', $filename);
        $basefile = $uploads_dir['basedir'] . $findfile;
        $suffix = $width . 'x' . $height;
        if ($crop) {
            $suffix .= 'c';
        }
        if (file_exists($basefile)) {
            // we have the file, so call the wp function to actually resize the image
            //			$resized = image_resize($basefile, $width, $height, $crop, $suffix);
            $resized = image_resize($basefile, $width, $height, true, $suffix);
            // find the mime type
            foreach (get_allowed_mime_types() as $exts => $mime) {
                if (preg_match('!^(' . $exts . ')$!i', $matches[5])) {
                    $type = $mime;
                    break;
                }
            }
            // serve the image this one time (next time the webserver will do it for us)
            header('Content-Type: ' . $type);
            header('Content-Length: ' . filesize($resized));
            readfile($resized);
            exit;
        }
    }
}
开发者ID:vanlong200880,项目名称:uni,代码行数:38,代码来源:dynamic-image-resizer.php


示例13: enqueue_scripts

 public function enqueue_scripts($override = false)
 {
     if (is_admin()) {
         return;
     }
     global $post;
     if (is_page(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false)) || $override) {
         wp_enqueue_script('jquery');
         wp_enqueue_script('underscore');
         // FES outputs minified scripts by default on the frontend. To load full versions, hook into this and return empty string.
         $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
         $minify = apply_filters('fes_output_minified_versions', $suffix);
         wp_enqueue_script('fes_form', fes_plugin_url . 'assets/js/frontend-form' . $minify . '.js', array('jquery'), fes_plugin_version);
         wp_localize_script('fes_form', 'fes_form', array('ajaxurl' => admin_url('admin-ajax.php'), 'error_message' => __('Please fix the errors to proceed', 'edd_fes'), 'nonce' => wp_create_nonce('fes_nonce'), 'avatar_title' => __('Choose an avatar', 'edd_fes'), 'avatar_button' => __('Select as avatar', 'edd_fes'), 'file_title' => __('Choose a file', 'edd_fes'), 'file_button' => __('Insert file URL', 'edd_fes'), 'feat_title' => __('Choose a featured image', 'edd_fes'), 'feat_button' => __('Select as featured image', 'edd_fes'), 'one_option' => __('You must have at least one option', 'edd_fes'), 'too_many_files_pt_1' => __('You may not add more than ', 'edd_fes'), 'too_many_files_pt_2' => __(' files!', 'edd_fes'), 'file_types' => implode('|', array_keys(get_allowed_mime_types()))));
         wp_enqueue_media();
         wp_enqueue_script('comment-reply');
         wp_enqueue_script('jquery-ui-datepicker');
         wp_enqueue_script('jquery-ui-autocomplete');
         wp_enqueue_script('suggest');
         wp_enqueue_script('jquery-ui-slider');
         wp_enqueue_script('jquery-ui-timepicker', fes_plugin_url . 'assets/js/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker'));
     }
 }
开发者ID:SelaInc,项目名称:eassignment,代码行数:23,代码来源:class-setup.php


示例14: woocommerce_download_product


//.........这里部分代码省略.........
             * site_url() depends on whether the page containing the download (ie; My Account) is served via SSL because WC
             * modifies site_url() via a filter to force_ssl.
             * So blindly doing a str_replace is incorrect because it will fail when schemes are mismatched. This code
             * handles the various permutations.
             */
            $scheme = parse_url($file_path, PHP_URL_SCHEME);
            if ($scheme) {
                $site_url = set_url_scheme(site_url(''), $scheme);
            } else {
                $site_url = is_ssl() ? str_replace('https:', 'http:', site_url()) : site_url();
            }
            $file_path = str_replace(trailingslashit($site_url), ABSPATH, $file_path);
        } else {
            $network_url = is_ssl() ? str_replace('https:', 'http:', network_admin_url()) : network_admin_url();
            $upload_dir = wp_upload_dir();
            // Try to replace network url
            $file_path = str_replace(trailingslashit($network_url), ABSPATH, $file_path);
            // Now try to replace upload URL
            $file_path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $file_path);
        }
        // See if its local or remote
        if (strstr($file_path, 'http:') || strstr($file_path, 'https:') || strstr($file_path, 'ftp:')) {
            $remote_file = true;
        } else {
            $remote_file = false;
            // Remove Query String
            if (strstr($file_path, '?')) {
                $file_path = current(explode('?', $file_path));
            }
            $file_path = realpath($file_path);
        }
        $file_extension = strtolower(substr(strrchr($file_path, "."), 1));
        $ctype = "application/force-download";
        foreach (get_allowed_mime_types() as $mime => $type) {
            $mimes = explode('|', $mime);
            if (in_array($file_extension, $mimes)) {
                $ctype = $type;
                break;
            }
        }
        // Start setting headers
        if (!ini_get('safe_mode')) {
            @set_time_limit(0);
        }
        if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) {
            @set_magic_quotes_runtime(0);
        }
        if (function_exists('apache_setenv')) {
            @apache_setenv('no-gzip', 1);
        }
        @session_write_close();
        @ini_set('zlib.output_compression', 'Off');
        @ob_end_clean();
        if (ob_get_level()) {
            @ob_end_clean();
        }
        // Zip corruption fix
        if ($is_IE && is_ssl()) {
            // IE bug prevents download via SSL when Cache Control and Pragma no-cache headers set.
            header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
            header('Cache-Control: private');
        } else {
            nocache_headers();
        }
        $file_name = basename($file_path);
        if (strstr($file_name, '?')) {
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:67,代码来源:woocommerce-functions.php


示例15: get_local_media_files_batch_recursive

 /**
  * Recursively go through uploads directories and get a batch of media files.
  * Stops when it has scanned all files/directories or after it has run for
  * $this->media_files_batch_time_limit seconds, whichever comes first.
  *
  * @param string $dir               The directory to start in
  * @param string $start_filename    The file or directory to start at within $dir
  * @param array  $local_media_files Array to populate with media files found
  */
 function get_local_media_files_batch_recursive($dir, $start_filename, &$local_media_files)
 {
     $upload_dir = $this->uploads_dir();
     static $allowed_mime_types;
     if (is_null($allowed_mime_types)) {
         $allowed_mime_types = array_flip(get_allowed_mime_types());
     }
     static $finish_time;
     if (is_null($finish_time)) {
         $finish_time = microtime(true) + $this->media_files_batch_time_limit;
     }
     $dir = '/' == $dir ? '' : $dir;
     $dir_path = $upload_dir . $dir;
     $sub_paths = glob($dir_path . '*', GLOB_MARK);
     // Get all the files except the one we use to store backups.
     $wpmdb_upload_folder = $this->get_upload_info();
     $pattern = '/' . preg_quote($wpmdb_upload_folder, '/') . '/';
     $files = preg_grep($pattern, $sub_paths ? $sub_paths : array(), PREG_GREP_INVERT);
     $reached_start_file = false;
     foreach ($files as $file_path) {
         if (microtime(true) >= $finish_time) {
             break;
         }
         // Are we starting from a certain file within the directory?
         // If so, we skip all the files that come before it.
         if ($start_filename) {
             if (basename($file_path) == $start_filename) {
                 $reached_start_file = true;
                 continue;
             } elseif (!$reached_start_file) {
                 continue;
             }
         }
         $short_file_path = str_replace(array($upload_dir, '\\'), array('', '/'), $file_path);
         // Is directory? We use this instead of is_dir() to save us an I/O call
         if (substr($file_path, -1) == DIRECTORY_SEPARATOR) {
             $this->get_local_media_files_batch_recursive($short_file_path, '', $local_media_files);
             continue;
         }
         // ignore files that we shouldn't touch, e.g. .php, .sql, etc
         $filetype = wp_check_filetype($short_file_path);
         if (!isset($allowed_mime_types[$filetype['type']])) {
             continue;
         }
         if (apply_filters('wpmdbmf_exclude_local_media_file_from_removal', false, $upload_dir, $short_file_path, $this)) {
             continue;
         }
         $local_media_files[] = $short_file_path;
     }
 }
开发者ID:Garth619,项目名称:DMA-Franconnect-Local,代码行数:59,代码来源:wpmdbpro-media-files-base.php


示例16: wp_enqueue_media

/**
 * Enqueues all scripts, styles, settings, and templates necessary to use
 * all media JS APIs.
 *
 * @since 3.5.0
 *
 * @global int       $content_width
 * @global wpdb      $wpdb
 * @global WP_Locale $wp_locale
 *
 * @param array $args {
 *     Arguments for enqueuing media scripts.
 *
 *     @type int|WP_Post A post object or ID.
 * }
 */
function wp_enqueue_media($args = array())
{
    // Enqueue me just once per page, please.
    if (did_action('wp_enqueue_media')) {
        return;
    }
    global $content_width, $wpdb, $wp_locale;
    $defaults = array('post' => null);
    $args = wp_parse_args($args, $defaults);
    // We're going to pass the old thickbox media tabs to `media_upload_tabs`
    // to ensure plugins will work. We will then unset those tabs.
    $tabs = array('type' => '', 'type_url' => '', 'gallery' => '', 'library' => '');
    /** This filter is documented in wp-admin/includes/media.php */
    $tabs = apply_filters('media_upload_tabs', $tabs);
    unset($tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library']);
    $props = array('link' => get_option('image_default_link_type'), 'align' => get_option('image_default_align'), 'size' => get_option('image_default_size'));
    $exts = array_merge(wp_get_audio_extensions(), wp_get_video_extensions());
    $mimes = get_allowed_mime_types();
    $ext_mimes = array();
    foreach ($exts as $ext) {
        foreach ($mimes as $ext_preg => $mime_match) {
            if (preg_match('#' . $ext . '#i', $ext_preg)) {
                $ext_mimes[$ext] = $mime_match;
                break;
            }
        }
    }
    $has_audio = $wpdb->get_var("\n\t\tSELECT ID\n\t\tFROM {$wpdb->posts}\n\t\tWHERE post_type = 'attachment'\n\t\tAND post_mime_type LIKE 'audio%'\n\t\tLIMIT 1\n\t");
    $has_video = $wpdb->get_var("\n\t\tSELECT ID\n\t\tFROM {$wpdb->posts}\n\t\tWHERE post_type = 'attachment'\n\t\tAND post_mime_type LIKE 'video%'\n\t\tLIMIT 1\n\t");
    $months = $wpdb->get_results($wpdb->prepare("\n\t\tSELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month\n\t\tFROM {$wpdb->posts}\n\t\tWHERE post_type = %s\n\t\tORDER BY post_date DESC\n\t", 'attachment'));
    foreach ($months as $month_year) {
        $month_year->text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($month_year->month), $month_year->year);
    }
    $settings = array('tabs' => $tabs, 'tabUrl' => add_query_arg(array('chromeless' => true), admin_url('media-upload.php')), 'mimeTypes' => wp_list_pluck(get_post_mime_types(), 0), 'captions' => !apply_filters('disable_captions', ''), 'nonce' => array('sendToEditor' => wp_create_nonce('media-send-to-editor')), 'post' => array('id' => 0), 'defaultProps' => $props, 'attachmentCounts' => array('audio' => $has_audio ? 1 : 0, 'video' => $has_video ? 1 : 0), 'embedExts' => $exts, 'embedMimes' => $ext_mimes, 'contentWidth' => $content_width, 'months' => $months, 'mediaTrash' => MEDIA_TRASH ? 1 : 0);
    $post = null;
    if (isset($args['post'])) {
        $post = get_post($args['post']);
        $settings['post'] = array('id' => $post->ID, 'nonce' => wp_create_nonce('update-post_' . $post->ID));
        $thumbnail_support = current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail');
        if (!$thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type) {
            if (wp_attachment_is('audio', $post)) {
                $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
            } elseif (wp_attachment_is('video', $post)) {
                $thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
            }
        }
        if ($thumbnail_support) {
            $featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
            $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
        }
    }
    if ($post) {
        $post_type_object = get_post_type_object($post->post_type);
    } else {
        $post_type_object = get_post_type_object('post');
    }
    $strings = array('url' => __('URL'), 'addMedia' => __('Add Media'), 'search' => __('Search'), 'select' => __('Select'), 'cancel' => __('Cancel'), 'update' => __('Update'), 'replace' => __('Replace'), 'remove' => __('Remove'), 'back' => __('Back'), 'selected' => __('%d selected'), 'dragInfo' => __('Drag and drop to reorder media files.'), 'uploadFilesTitle' => __('Upload Files'), 'uploadImagesTitle' => __('Upload Images'), 'mediaLibraryTitle' => __('Media Library'), 'insertMediaTitle' => __('Insert Media'), 'createNewGallery' => __('Create a new gallery'), 'createNewPlaylist' => __('Create a new playlist'), 'createNewVideoPlaylist' => __('Create a new video playlist'), 'returnToLibrary' => __('&#8592; Return to library'), 'allMediaItems' => __('All media items'), 'allDates' => __('All dates'), 'noItemsFound' => __('No items found.'), 'insertIntoPost' => $post_type_object->labels->insert_into_item, 'unattached' => __('Unattached'), 'trash' => _x('Trash', 'noun'), 'uploadedToThisPost' => $post_type_object->labels->uploaded_to_this_item, 'warnDelete' => __("You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete."), 'warnBulkDelete' => __("You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete."), 'warnBulkTrash' => __("You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete."), 'bulkSelect' => __('Bulk Select'), 'cancelSelection' => __('Cancel Selection'), 'trashSelected' => __('Trash Selected'), 'untrashSelected' => __('Untrash Selected'), 'deleteSelected' => __('Delete Selected'), 'deletePermanently' => __('Delete Permanently'), 'apply' => __('Apply'), 'filterByDate' => __('Filter by date'), 'filterByType' => __('Filter by type'), 'searchMediaLabel' => __('Search Media'), 'noMedia' => __('No media attachments found.'), 'attachmentDetails' => __('Attachment Details'), 'insertFromUrlTitle' => __('Insert from URL'), 'setFeaturedImageTitle' => $post_type_object->labels->featured_image, 'setFeaturedImage' => $post_type_object->labels->set_featured_image, 'createGalleryTitle' => __('Create Gallery'), 'editGalleryTitle' => __('Edit Gallery'), 'cancelGalleryTitle' => __('&#8592; Cancel Gallery'), 'insertGallery' => __('Insert gallery'), 'updateGallery' => __('Update gallery'), 'addToGallery' => __('Add to gallery'), 'addToGalleryTitle' => __('Add to Gallery'), 'reverseOrder' => __('Reverse order'), 'imageDetailsTitle' => __('Image Details'), 'imageReplaceTitle' => __('Replace Image'), 'imageDetailsCancel' => __('Cancel Edit'), 'editImage' => __('Edit Image'), 'chooseImage' => __('Choose Image'), 'selectAndCrop' => __('Select and Crop'), 'skipCropping' => __('Skip Cropping'), 'cropImage' => __('Crop Image'), 'cropYourImage' => __('Crop your image'), 'cropping' => __('Cropping&hellip;'), 'suggestedDimensions' => __('Suggested image dimensions:'), 'cropError' => __('There has been an error cropping your image.'), 'audioDetailsTitle' => __('Audio Details'), 'audioReplaceTitle' => __('Replace Audio'), 'audioAddSourceTitle' => __('Add Audio Source'), 'audioDetailsCancel' => __('Cancel Edit'), 'videoDetailsTitle' => __('Video Details'), 'videoReplaceTitle' => __('Replace Video'), 'videoAddSourceTitle' => __('Add Video Source'), 'videoDetailsCancel' => __('Cancel Edit'), 'videoSelectPosterImageTitle' => __('Select Poster Image'), 'videoAddTrackTitle' => __('Add Subtitles'), 'playlistDragInfo' => __('Drag and drop to reorder tracks.'), 'createPlaylistTitle' => __('Create Audio Playlist'), 'editPlaylistTitle' => __('Edit Audio Playlist'), 'cancelPlaylistTitle' => __('&#8592; Cancel Audio Playlist'), 'insertPlaylist' => __('Insert audio playlist'), 'updatePlaylist' => __('Update audio playlist'), 'addToPlaylist' => __('Add to audio playlist'), 'addToPlaylistTitle' => __('Add to Audio Playlist'), 'videoPlaylistDragInfo' => __('Drag and drop to reorder videos.'), 'createVideoPlaylistTitle' => __('Create Video Playlist'), 'editVideoPlaylistTitle' => __('Edit Video Playlist'), 'cancelVideoPlaylistTitle' => __('&#8592; Cancel Video Playlist'), 'insertVideoPlaylist' => __('Insert video playlist'), 'updateVideoPlaylist' => __('Update video playlist'), 'addToVideoPlaylist' => __('Add to video playlist'), 'addToVideoPlaylistTitle' => __('Add to Video Playlist'));
    /**
     * Filter the media view settings.
     *
     * @since 3.5.0
     *
     * @param array   $settings List of media view settings.
     * @param WP_Post $post     Post object.
     */
    $settings = apply_filters('media_view_settings', $settings, $post);
    /**
     * Filter the media view strings.
     *
     * @since 3.5.0
     *
     * @param array   $strings List of media view strings.
     * @param WP_Post $post    Post object.
     */
    $strings = apply_filters('media_view_strings', $strings, $post);
    $strings['settings'] = $settings;
    // Ensure we enqueue media-editor first, that way media-views is
    // registered internally before we try to localize it. see #24724.
    wp_enqueue_script('media-editor');
    wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
    wp_enqueue_script('media-audiovideo');
    wp_enqueue_style('media-views');
    if (is_admin()) {
        wp_enqueue_script('mce-view');
//.........这里部分代码省略.........
开发者ID:nakamuraagatha,项目名称:reseptest,代码行数:101,代码来源:media.php


示例17: get_allowed_mime_types

 /**
  * Allowed mime types array that can be edited for specific S3 uploading
  *
  * @return array
  */
 function get_allowed_mime_types()
 {
     return apply_filters('as3cf_allowed_mime_types', get_allowed_mime_types());
 }
开发者ID:sohel4r,项目名称:wordpress_4_1_1,代码行数:9,代码来源:amazon-s3-and-cloudfront.php


示例18: get_theme_urls

 /**
  * Returns array of detected URLs for theme templates
  *
  * @param string $theme_name
  * @return array
  */
 function get_theme_urls($theme_name)
 {
     $urls = array();
     $theme = w3tc_get_theme($theme_name);
     if ($theme && isset($theme['Template Files'])) {
         $front_page_template = false;
         if (get_option('show_on_front') == 'page') {
             $front_page_id = get_option('page_on_front');
             if ($front_page_id) {
                 $front_page_template_file = get_post_meta($front_page_id, '_wp_page_template', true);
                 if ($front_page_template_file) {
                     $front_page_template = basename($front_page_template_file, '.php');
                 }
             }
         }
         $home_url = w3_get_home_url();
         $template_files = (array) $theme['Template Files'];
         $mime_types = get_allowed_mime_types();
         $custom_mime_types = array();
         foreach ($mime_types as $mime_type) {
             list($type1, $type2) = explode('/', $mime_type);
             $custom_mime_types = array_merge($custom_mime_types, array($type1, $type2, $type1 . '_' . $type2));
         }
         foreach ($template_files as $template_file) {
             $link = false;
             $template = basename($template_file, '.php');
             /**
              * Check common templates
              */
             switch (true) {
                 /**
                  * Handle home.php or index.php or front-page.php
                  */
                 case !$front_page_template && $template == 'home':
                 case !$front_page_template && $template == 'index':
                 case !$front_page_template && $template == 'front-page':
                     /**
                      * Handle custom home page
                      */
                 /**
                  * Handle custom home page
                  */
                 case $template == $front_page_template:
                     $link = $home_url . '/';
                     break;
                     /**
                      * Handle 404.php
                      */
                 /**
                  * Handle 404.php
                  */
                 case $template == '404':
                     $permalink = get_option('permalink_structure');
                     if ($permalink) {
                         $link = sprintf('%s/%s/', $home_url, '404_test');
                     } else {
                         $link = sprintf('%s/?p=%d', $home_url, 999999999);
                     }
                     break;
                     /**
                      * Handle search.php
                      */
                 /**
                  * Handle search.php
                  */
                 case $template == 'search':
                     $link = sprintf('%s/?s=%s', $home_url, 'search_test');
                     break;
                     /**
                      * Handle date.php or archive.php
                      */
                 /**
                  * Handle date.php or archive.php
                  */
                 case $template == 'date':
                 case $template == 'archive':
                     $posts = get_posts(array('numberposts' => 1, 'orderby' => 'rand'));
                     if (is_array($posts) && count($posts)) {
                         $time = strtotime($posts[0]->post_date);
                         $link = get_day_link(date('Y', $time), date('m', $time), date('d', $time));
                     }
                     break;
                     /**
                      * Handle author.php
                      */
                 /**
                  * Handle author.php
                  */
                 case $template == 'author':
                     $author_id = false;
                     if (function_exists('get_users')) {
                         $users = get_users();
                         if (is_array($users) && count($users)) {
                             $user = current($users);
//.........这里部分代码省略.........
开发者ID:jfbelisle,项目名称:magexpress,代码行数:101,代码来源:MinifyAdminView.php


示例19: test_get_allowed_mime_types

 /**
  * @ticket 21594
  */
 function test_get_allowed_mime_types()
 {
     $mimes = get_allowed_mime_types();
     $this->assertInternalType('array', $mimes);
     $this->assertNotEmpty($mimes);
     add_filter('upload_mimes', '__return_empty_array');
     $mimes = get_allowed_mime_types();
     $this->assertInternalType('array', $mimes);
     $this->assertEmpty($mimes);
     remove_filter('upload_mimes', '__return_empty_array');
     $mimes = get_allowed_mime_types();
     $this->assertInternalType('array', $mimes);
     $this->assertNotEmpty($mimes);
 }
开发者ID:jaspermdegroot,项目名称:develop.wordpress,代码行数:17,代码来源:functions.php


示例20: validate_mime_types

 /**
  * Validate the allowed mime types using WordPress allowed mime types.
  *
  * In case of a multisite, the mime types are already restricted by
  * the 'upload_filetypes' setting. BuddyPress will respect this setting.
  *
  * @see check_upload_mimes()
  *
  * @since 2.3.0
  *
  */
 protected function validate_mime_types()
 {
     $wp_mimes = get_allowed_mime_types();
     $valid_mimes = array();
     // Set the allowed mimes for the upload.
     foreach ((array) $this->allowed_mime_types as $ext) {
         foreach ($wp_mimes as $ext_pattern => $mime) {
             if ($ext !== '' && strpos($ext_pattern, $ext) !== false) {
                 $valid_mimes[$ext_pattern] = $mime;
             }
         }
     }
     return $valid_mimes;
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:25,代码来源:class-bp-attachment.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

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