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

PHP wp_get_video_extensions函数代码示例

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

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



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

示例1: sorted_array

 /**
  * Sorted video and poster url
  *
  * @since  1.0.0
  * @return array
  */
 private function sorted_array($array)
 {
     $output_array = array('video' => array(), 'poster' => '');
     $default_types = wp_get_video_extensions();
     $pattern = '/.(' . implode('|', $default_types) . ')/im';
     foreach ($array as $url) {
         foreach ($default_types as $type) {
             if (strpos($url, $type)) {
                 $output_array['video'][$type] = $url;
             }
         }
         if (!preg_match($pattern, $url)) {
             $output_array['poster'] = $url;
         }
     }
     return $output_array;
 }
开发者ID:CherryFramework,项目名称:cherry-framework,代码行数:23,代码来源:cherry-media-utilit.php


示例2: get_files_array

 /**
  * Return an array of files prepared for output.
  *
  * Processes files by file type and generates unique output for each.
  *
  * Returns array for each file, with the following keys:
  *
  * `file_path` => The file path of the file, with a line break
  * `html` => The file output HTML formatted
  *
  * @since  1.2
  * @todo  Support `playlist` shortcode for playlist of video/audio
  * @usedby gravityview_get_files_array()
  * @param  string $value    Field value passed by Gravity Forms. String of file URL, or serialized string of file URL array
  * @param  string $gv_class Field class to add to the output HTML
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
  */
 static function get_files_array($value, $gv_class)
 {
     $gravityview_view = GravityView_View::getInstance();
     extract($gravityview_view->getCurrentField());
     $output_arr = array();
     // Get an array of file paths for the field.
     $file_paths = rgar($field, 'multipleFiles') ? json_decode($value) : array($value);
     // Process each file path
     foreach ($file_paths as $file_path) {
         // If the site is HTTPS, use HTTPS
         if (function_exists('set_url_scheme')) {
             $file_path = set_url_scheme($file_path);
         }
         // This is from Gravity Forms's code
         $file_path = esc_attr(str_replace(" ", "%20", $file_path));
         // If the field is set to link to the single entry, link to it.
         $link = !empty($field_settings['show_as_link']) ? GravityView_API::entry_link($entry, $field) : $file_path;
         // Get file path information
         $file_path_info = pathinfo($file_path);
         $html_format = NULL;
         $disable_lightbox = false;
         $disable_wrapped_link = false;
         // Is this an image?
         $image = new GravityView_Image(array('src' => $file_path, 'class' => 'gv-image gv-field-id-' . $field_settings['id'], 'alt' => $field_settings['label'], 'width' => gravityview_get_context() === 'single' ? NULL : 250));
         $content = $image->html();
         // The new default content is the image, if it exists. If not, use the file name as the content.
         $content = !empty($content) ? $content : $file_path_info['basename'];
         // If pathinfo() gave us the extension of the file, run the switch statement using that.
         $extension = empty($file_path_info['extension']) ? NULL : strtolower($file_path_info['extension']);
         switch (true) {
             // Audio file
             case in_array($extension, wp_get_audio_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('audio')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $audio_settings = apply_filters('gravityview_audio_settings', array('src' => $file_path, 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the audio shortcode
                      * @link http://codex.wordpress.org/Audio_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
                      */
                     $content = wp_audio_shortcode($audio_settings);
                 }
                 break;
                 // Video file
             // Video file
             case in_array($extension, wp_get_video_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('video')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $video_settings = apply_filters('gravityview_video_settings', array('src' => $file_path, 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the video shortcode
                      * @link http://codex.wordpress.org/Video_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_video_shortcode/
                      */
                     $content = wp_video_shortcode($video_settings);
                 }
                 break;
                 // PDF
             // PDF
             case $extension === 'pdf':
                 // PDF needs to be displayed in an IFRAME
                 $link = add_query_arg(array('TB_iframe' => 'true'), $link);
                 break;
                 // if not image, do not set the lightbox (@since 1.5.3)
             // if not image, do not set the lightbox (@since 1.5.3)
             case !in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png')):
                 $disable_lightbox = true;
                 break;
         }
//.........这里部分代码省略.........
开发者ID:psdes,项目名称:GravityView,代码行数:101,代码来源:fileupload.php


示例3: wp_attachment_is

/**
 * Verifies an attachment is of a given type.
 *
 * @since 4.2.0
 *
 * @param string      $type    Attachment type. Accepts 'image', 'audio', or 'video'.
 * @param int|WP_Post $post_id Optional. Attachment ID. Default 0.
 * @return bool True if one of the accepted types, false otherwise.
 */
function wp_attachment_is($type, $post_id = 0)
{
    if (!($post = get_post($post_id))) {
        return false;
    }
    if (!($file = get_attached_file($post->ID))) {
        return false;
    }
    if (0 === strpos($post->post_mime_type, $type . '/')) {
        return true;
    }
    $check = wp_check_filetype($file);
    if (empty($check['ext'])) {
        return false;
    }
    $ext = $check['ext'];
    if ('import' !== $post->post_mime_type) {
        return $type === $ext;
    }
    switch ($type) {
        case 'image':
            $image_exts = array('jpg', 'jpeg', 'jpe', 'gif', 'png');
            return in_array($ext, $image_exts);
        case 'audio':
            return in_array($ext, wp_get_audio_extensions());
        case 'video':
            return in_array($ext, wp_get_video_extensions());
        default:
            return $type === $ext;
    }
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:40,代码来源:post.php


示例4: populate_network

/**
 * Populate network settings.
 *
 * @since 3.0.0
 *
 * @global wpdb       $wpdb
 * @global object     $current_site
 * @global int        $wp_db_version
 * @global WP_Rewrite $wp_rewrite
 *
 * @param int $network_id ID of network to populate.
 * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful,
 *                       so the error code must be checked) or failure.
 */
function populate_network($network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false)
{
    global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
    $errors = new WP_Error();
    if ('' == $domain) {
        $errors->add('empty_domain', __('You must provide a domain name.'));
    }
    if ('' == $site_name) {
        $errors->add('empty_sitename', __('You must provide a name for your network of sites.'));
    }
    // Check for network collision.
    if ($network_id == $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->site} WHERE id = %d", $network_id))) {
        $errors->add('siteid_exists', __('The network already exists.'));
    }
    if (!is_email($email)) {
        $errors->add('invalid_email', __('You must provide a valid email address.'));
    }
    if ($errors->get_error_code()) {
        return $errors;
    }
    // If a user with the provided email does not exist, default to the current user as the new network admin.
    $site_user = get_user_by('email', $email);
    if (false === $site_user) {
        $site_user = wp_get_current_user();
    }
    // Set up site tables.
    $template = get_option('template');
    $stylesheet = get_option('stylesheet');
    $allowed_themes = array($stylesheet => true);
    if ($template != $stylesheet) {
        $allowed_themes[$template] = true;
    }
    if (WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template) {
        $allowed_themes[WP_DEFAULT_THEME] = true;
    }
    // If WP_DEFAULT_THEME doesn't exist, also whitelist the latest core default theme.
    if (!wp_get_theme(WP_DEFAULT_THEME)->exists()) {
        if ($core_default = WP_Theme::get_core_default_theme()) {
            $allowed_themes[$core_default->get_stylesheet()] = true;
        }
    }
    if (1 == $network_id) {
        $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path));
        $network_id = $wpdb->insert_id;
    } else {
        $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path, 'id' => $network_id));
    }
    wp_cache_delete('networks_have_paths', 'site-options');
    if (!is_multisite()) {
        $site_admins = array($site_user->user_login);
        $users = get_users(array('fields' => array('ID', 'user_login')));
        if ($users) {
            foreach ($users as $user) {
                if (is_super_admin($user->ID) && !in_array($user->user_login, $site_admins)) {
                    $site_admins[] = $user->user_login;
                }
            }
        }
    } else {
        $site_admins = get_site_option('site_admins');
    }
    /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
    $welcome_email = __('Howdy USERNAME,

Your new SITE_NAME site has been successfully set up at:
BLOG_URL

You can log in to the administrator account with the following information:

Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php

We hope you enjoy your new site. Thanks!

--The Team @ SITE_NAME');
    $misc_exts = array('jpg', 'jpeg', 'png', 'gif', 'mov', 'avi', 'mpg', '3gp', '3g2', 'midi', 'mid', 'pdf', 'doc', 'ppt', 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 'key');
    $audio_exts = wp_get_audio_extensions();
    $video_exts = wp_get_video_extensions();
    $upload_filetypes = array_unique(array_merge($misc_exts, $audio_exts, $video_exts));
    $sitemeta = array('site_name' => $site_name, 'admin_email' => $email, 'admin_user_id' => $site_user->ID, 'registration' => 'none', 'upload_filetypes' => implode(' ', $upload_filetypes), 'blog_upload_space' => 100, 'fileupload_maxk' => 1500, 'site_admins' => $site_admins, 'allowedthemes' => $allowed_themes, 'illegal_names' => array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files'), 'wpmu_upgrade_site' => $wp_db_version, 'welcome_email' => $welcome_email, 'first_post' => __('Welcome to %s. This is your first post. Edit or delete it, then start blogging!'), 'siteurl' => get_option('siteurl') . '/', 'add_new_users' => '0', 'upload_space_check_disabled' => is_multisite() ? get_site_option('upload_space_check_disabled') : '1', 'subdomain_install' => intval($subdomain_install), 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', 'ms_files_rewriting' => is_multisite() ? get_site_option('ms_files_rewriting') : '0', 'initial_db_version' => get_option('initial_db_version'), 'active_sitewide_plugins' => array(), 'WPLANG' => get_locale());
    if (!$subdomain_install) {
        $sitemeta['illegal_names'][] = 'blog';
    }
    /**
     * Filter meta for a network on creation.
//.........这里部分代码省略.........
开发者ID:x3mgroup,项目名称:wordpress-mod,代码行数:101,代码来源:schema.php


示例5: bp_attachments_get_allowed_types

/**
 * Get allowed types for any attachment
 *
 * @since  2.4.0
 *
 * @param  string $type  The extension types to get.
 *                       Default: 'avatar'
 * @return array         The list of allowed extensions for attachments
 */
function bp_attachments_get_allowed_types($type = 'avatar')
{
    // Defaults to BuddyPress supported image extensions
    $exts = array('jpeg', 'gif', 'png');
    /**
     * It's not a BuddyPress feature, get the allowed extensions
     * matching the $type requested
     */
    if ('avatar' !== $type && 'cover_image' !== $type) {
        // Reset the default exts
        $exts = array();
        switch ($type) {
            case 'video':
                $exts = wp_get_video_extensions();
                break;
            case 'audio':
                $exts = wp_get_video_extensions();
                break;
            default:
                $allowed_mimes = get_allowed_mime_types();
                /**
                 * Search for allowed mimes matching the type
                 *
                 * eg: using 'application/vnd.oasis' as the $type
                 * parameter will get all OpenOffice extensions supported
                 * by WordPress and allowed for the current user.
                 */
                if ('' !== $type) {
                    $allowed_mimes = preg_grep('/' . addcslashes($type, '/.+-') . '/', $allowed_mimes);
                }
                $allowed_types = array_keys($allowed_mimes);
                // Loop to explode keys using '|'
                foreach ($allowed_types as $allowed_type) {
                    $t = explode('|', $allowed_type);
                    $exts = array_merge($exts, (array) $t);
                }
                break;
        }
    }
    /**
     * Filter here to edit the allowed extensions by attachment type.
     *
     * @since  2.4.0
     *
     * @param  array  $exts List of allowed extensions
     * @param  string $type The requested file type
     */
    return apply_filters('bp_attachments_get_allowed_types', $exts, $type);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:58,代码来源:bp-core-attachments.php


示例6: 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' => __('← 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' => __('← 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…'), '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' => __('← 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' => __('← 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


示例7: pgb_get_video

/**
 * Get first instance of video in post
 * @since ProGo 0.6
 * @return video SRC
 */
function pgb_get_video()
{
    global $post, $posts;
    $first_video = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<a.+href=[\'"]([^\'"]+(' . implode('|', wp_get_video_extensions()) . '))[\'"].*>/i', $post->post_content, $matches);
    $first_video = isset($matches[1][0]) ? $matches[1][0] : false;
    if (!empty($first_video)) {
        return $first_video;
    }
    $output = preg_match_all('/\\[video.+src=[\'"]([^\'"]+(' . implode('|', wp_get_video_extensions()) . '))[\'"].*\\]/i', $post->post_content, $matches);
    $first_video = isset($matches[1][0]) ? $matches[1][0] : false;
    if (!empty($first_video)) {
        return $first_video;
    }
    return false;
}
开发者ID:konamax123,项目名称:pgb,代码行数:23,代码来源:pgb-functions.php


示例8: wp_enqueue_media

/**
 * Enqueues all scripts, styles, settings, and templates necessary to use
 * all media JS APIs.
 *
 * @since 3.5.0
 */
function wp_enqueue_media($args = array())
{
    // Enqueue me just once per page, please.
    if (did_action('wp_enqueue_media')) {
        return;
    }
    $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' => '');
    $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'));
    $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, 'embedExts' => array_merge(wp_get_audio_extensions(), wp_get_video_extensions()));
    $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));
        if (current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail')) {
            $featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
            $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
        }
    }
    $hier = $post && is_post_type_hierarchical($post->post_type);
    $strings = array('url' => __('URL'), 'addMedia' => __('Add Media'), 'search' => __('Search'), 'select' => __('Select'), 'cancel' => __('Cancel'), 'selected' => __('%d selected'), 'dragInfo' => __('Drag and drop to reorder images.'), 'uploadFilesTitle' => __('Upload Files'), 'uploadImagesTitle' => __('Upload Images'), 'mediaLibraryTitle' => __('Media Library'), 'insertMediaTitle' => __('Insert Media'), 'createNewGallery' => __('Create a new gallery'), 'returnToLibrary' => __('&#8592; Return to library'), 'allMediaItems' => __('All media items'), 'noItemsFound' => __('No items found.'), 'insertIntoPost' => $hier ? __('Insert into page') : __('Insert into post'), 'uploadedToThisPost' => $hier ? __('Uploaded to this page') : __('Uploaded to this post'), 'warnDelete' => __("You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete."), 'insertFromUrlTitle' => __('Insert from URL'), 'setFeaturedImageTitle' => __('Set Featured Image'), 'setFeaturedImage' => __('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'));
    $settings = apply_filters('media_view_settings', $settings, $post);
    $strings = apply_filters('media_view_strings', $strings, $post);
    $strings['settings'] = $settings;
    wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
    wp_enqueue_script('media-editor');
    wp_enqueue_style('media-views');
    wp_plupload_default_settings();
    require_once ABSPATH . WPINC . '/media-template.php';
    add_action('admin_footer', 'wp_print_media_templates');
    add_action('wp_footer', 'wp_print_media_templates');
    add_action('customize_controls_print_footer_scripts', 'wp_print_media_templates');
    do_action('wp_enqueue_media');
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:45,代码来源:media.php


示例9: getThumberExtensions

 /**
  * @return string[] The extensions supported by this thumber.
  */
 protected function getThumberExtensions()
 {
     return array_merge(wp_get_audio_extensions(), wp_get_video_extensions());
 }
开发者ID:WildCodeSchool,项目名称:projet-maison_ados_dreux,代码行数:7,代码来源:class-audio-video-thumber.php


示例10: video

 public static function video($attr)
 {
     $post_id = get_post() ? get_the_ID() : 0;
     static $instances = 0;
     $instances++;
     $video = null;
     $default_types = wp_get_video_extensions();
     $defaults_atts = array('src' => '', 'poster' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata', 'width' => 640, 'height' => 360);
     foreach ($default_types as $type) {
         $defaults_atts[$type] = '';
     }
     $atts = shortcode_atts($defaults_atts, $attr, 'video');
     $yt_pattern = '#^https?://(?:www\\.)?(?:youtube\\.com/watch|youtu\\.be/)#';
     $primary = false;
     if (!empty($atts['src'])) {
         if (!preg_match($yt_pattern, $atts['src'])) {
             $type = wp_check_filetype($atts['src'], wp_get_mime_types());
             if (!in_array(strtolower($type['ext']), $default_types)) {
                 return sprintf('<a class="wp-embedded-video" href="%s">%s</a>', esc_url($atts['src']), esc_html($atts['src']));
             }
         }
         $primary = true;
         array_unshift($default_types, 'src');
     } else {
         foreach ($default_types as $ext) {
             if (!empty($atts[$ext])) {
                 $type = wp_check_filetype($atts[$ext], wp_get_mime_types());
                 if (strtolower($type['ext']) === $ext) {
                     $primary = true;
                 }
             }
         }
     }
     if (!$primary) {
         $videos = get_attached_media('video', $post_id);
         if (empty($videos)) {
             return;
         }
         $video = reset($videos);
         $atts['src'] = wp_get_attachment_url($video->ID);
         if (empty($atts['src'])) {
             return;
         }
         array_unshift($default_types, 'src');
     }
     $library = apply_filters('wp_video_shortcode_library', 'mediaelement');
     if ('mediaelement' === $library && did_action('init')) {
         wp_enqueue_style('wp-mediaelement');
         wp_enqueue_script('wp-mediaelement');
     }
     $html_atts = array('class' => apply_filters('wp_video_shortcode_class', 'wp-video-shortcode'), 'id' => sprintf('video-%d-%d', $post_id, $instances), 'width' => absint($atts['width']), 'height' => absint($atts['height']), 'poster' => esc_url($atts['poster']), 'loop' => $atts['loop'], 'autoplay' => $atts['autoplay'], 'preload' => $atts['preload']);
     foreach (array('poster', 'loop', 'autoplay', 'preload') as $a) {
         if (empty($html_atts[$a])) {
             unset($html_atts[$a]);
         }
     }
     $attr_strings = array();
     foreach ($html_atts as $k => $v) {
         $attr_strings[] = $k . '="' . esc_attr($v) . '"';
     }
     $html = '';
     if ('mediaelement' === $library && 1 === $instances) {
         $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
     }
     $html .= sprintf('<video %s controls="controls">', join(' ', $attr_strings));
     $fileurl = '';
     $source = '<source type="%s" src="%s" />';
     foreach ($default_types as $fallback) {
         if (!empty($atts[$fallback])) {
             if (empty($fileurl)) {
                 $fileurl = $atts[$fallback];
             }
             if ('src' === $fallback && preg_match($yt_pattern, $atts['src'])) {
                 $type = array('type' => 'video/youtube');
             } else {
                 $type = wp_check_filetype($atts[$fallback], wp_get_mime_types());
             }
             $url = add_query_arg('_', $instances, $atts[$fallback]);
             $html .= sprintf($source, $type['type'], esc_url($url));
         }
     }
     if ('mediaelement' === $library) {
         $html .= wp_mediaelement_fallback($fileurl);
     }
     $html .= '</video>';
     $width_rule = $height_rule = '';
     if (!empty($atts['width'])) {
         $width_rule = sprintf('width: %dpx; ', $atts['width']);
     }
     if (!empty($atts['height'])) {
         $height_rule = sprintf('height: %dpx;', $atts['height']);
     }
     $output = sprintf('<div style="%s%s" class="wp-video">%s</div>', $width_rule, $height_rule, $html);
     return $output;
 }
开发者ID:Nguyenkain,项目名称:strida.vn,代码行数:95,代码来源:class.fileaway_utility.php


示例11: admin_header_actions

 function admin_header_actions()
 {
     global $pagenow;
     if (is_admin() && !CoursePress_Capabilities::is_campus()) {
         if (isset($_GET['cp_admin_ref']) && $_GET['cp_admin_ref'] == 'cp_course_creation_page' || isset($_POST['cp_admin_ref']) && $_POST['cp_admin_ref'] == 'cp_course_creation_page') {
             wp_enqueue_style('admin_coursepress_marketpress_popup', $this->plugin_url . 'css/admin_marketpress_popup.css', array(), $this->version);
         }
     }
     wp_enqueue_style('font_awesome', $this->plugin_url . 'css/font-awesome.css');
     wp_enqueue_style('admin_general', $this->plugin_url . 'css/admin_general.css', array(), $this->version);
     wp_enqueue_style('admin_general_responsive', $this->plugin_url . 'css/admin_general_responsive.css', array(), $this->version);
     /* wp_enqueue_script( 'jquery-ui-datepicker' );
     	  wp_enqueue_script( 'jquery-ui-accordion' );
     	  wp_enqueue_script( 'jquery-ui-sortable' );
     	  wp_enqueue_script( 'jquery-ui-resizable' );
     	  wp_enqueue_script( 'jquery-ui-draggable' );
     	  wp_enqueue_script( 'jquery-ui-droppable' ); */
     //add_action( 'wp_enqueue_scripts', array( &$this, 'add_jquery_ui' ) );
     //wp_enqueue_script( 'jquery' );
     //wp_enqueue_script( 'jquery-ui-core' );
     //wp_enqueue_script( 'jquery-ui', '//code.jquery.com/ui/1.10.3/jquery-ui.js', array( 'jquery' ), '1.10.3' ); //need to change this to built-in
     wp_enqueue_script('jquery-ui-spinner');
     // CryptoJS.MD5
     wp_enqueue_script('cryptojs-md5', $this->plugin_url . 'js/md5.js');
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     $this->add_jquery_ui();
     if ($page == 'course_details' || $page == $this->screen_base . '_settings') {
         wp_enqueue_style('cp_settings', $this->plugin_url . 'css/settings.css', array(), $this->version);
         wp_enqueue_style('cp_settings_responsive', $this->plugin_url . 'css/settings_responsive.css', array(), $this->version);
         wp_enqueue_style('cp_tooltips', $this->plugin_url . 'css/tooltips.css', array(), $this->version);
         wp_enqueue_script('cp-plugins', $this->plugin_url . 'js/plugins.js', array('jquery'), $this->version);
         wp_enqueue_script('cp-tooltips', $this->plugin_url . 'js/tooltips.js', array('jquery'), $this->version);
         wp_enqueue_script('cp-settings', $this->plugin_url . 'js/settings.js', array('jquery', 'jquery-ui', 'jquery-ui-spinner'), $this->version);
         wp_enqueue_script('cp-chosen-config', $this->plugin_url . 'js/chosen-config.js', array('cp-settings'), $this->version, true);
     }
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     $included_pages = apply_filters('cp_settings_localize_pages', array('course', 'courses', 'course_details', 'instructors', 'students', 'assessment', 'reports', $this->screen_base . '_settings'));
     if (in_array($page, $included_pages) || isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'course_category') {
         $unit_pagination = false;
         if (isset($_GET['unit_id'])) {
             $unit_pagination = cp_unit_uses_new_pagination((int) $_GET['unit_id']);
         }
         wp_enqueue_script('courses_bulk', $this->plugin_url . 'js/coursepress-admin.js', array('jquery-ui-tabs'), $this->version);
         //wp_enqueue_script( 'courses_bulk', $this->plugin_url . 'js/coursepress-admin.js', array(), $this->version );
         wp_enqueue_script('wplink');
         wp_localize_script('courses_bulk', 'coursepress', array('delete_instructor_alert' => __('Please confirm that you want to remove the instructor from this course?', 'cp'), 'delete_pending_instructor_alert' => __('Please confirm that you want to cancel the invite. Instuctor will receive a warning when trying to activate.', 'cp'), 'delete_course_alert' => __('Please confirm that you want to permanently delete the course, its units, unit elements and responses?', 'cp'), 'delete_student_response_alert' => __('Please confirm that you want to permanently delete this student answer / reponse?', 'cp'), 'delete_notification_alert' => __('Please confirm that you want to permanently delete the notification?', 'cp'), 'delete_discussion_alert' => __('Please confirm that you want to permanently delete the discussion?', 'cp'), 'withdraw_student_alert' => __('Please confirm that you want to withdraw student from this course. If you withdraw, you will no longer be able to see student\'s records for this course.', 'cp'), 'delete_unit_alert' => __('Please confirm that you want to permanently delete the unit, its elements and responses?', 'cp'), 'active_student_tab' => isset($_REQUEST['active_student_tab']) ? $_REQUEST['active_student_tab'] : 0, 'delete_module_alert' => __('Please confirm that you want to permanently delete selected element and its responses?', 'cp'), 'delete_unit_page_and_elements_alert' => __('Please confirm that you want to permanently delete this unit page, all its elements and student responses?', 'cp'), 'remove_unit_page_and_elements_alert' => __('Please confirm that you want to remove this unit page and all its elements?', 'cp'), 'remove_module_alert' => __('Please confirm that you want to remove selected element?', 'cp'), 'delete_unit_page_label' => __('Delete unit page and all elements', 'cp'), 'remove_row' => __('Remove', 'cp'), 'empty_class_name' => __('Class name cannot be empty', 'cp'), 'duplicated_class_name' => __('Class name already exists', 'cp'), 'course_taxonomy_screen' => isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'course_category' ? true : false, 'unit_page_num' => isset($_GET['unit_page_num']) && $_GET['unit_page_num'] !== '' ? $_GET['unit_page_num'] : 1, 'allowed_video_extensions' => wp_get_video_extensions(), 'allowed_audio_extensions' => wp_get_audio_extensions(), 'allowed_image_extensions' => cp_wp_get_image_extensions(), 'start_of_week' => get_option('start_of_week', 0), 'unit_pagination' => $unit_pagination ? 1 : 0, 'admin_ajax_url' => cp_admin_ajax_url()));
         do_action('coursepress_editor_options');
     }
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:49,代码来源:coursepress.php


示例12: gmedia_post_type__the_content


//.........这里部分代码省略.........
                    <style type="text/css">
                        .gmsingle_clearfix { display:block; }
                        .gmsingle_clearfix::after { visibility:hidden; display:block; font-size:0; content:' '; clear:both; height:0; }
                        .gmsingle_wrapper { margin:0 auto; }
                        .gmsingle_wrapper * { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
                        .gmsingle_photo_header { margin-bottom:15px; }
                        .gmsingle_name_wrap { padding:24px 0 2px 80px; height:85px; max-width:100%; overflow:hidden; white-space:nowrap; position:relative; }
                        .gmsingle_name_wrap .gmsingle_user_avatar { position:absolute; top:20px; left:0; }
                        .gmsingle_name_wrap .gmsingle_user_avatar a.gmsingle_user_avatar_link { display:block; text-decoration:none; }
                        .gmsingle_name_wrap .gmsingle_user_avatar img { height:60px; width:auto; overflow:hidden; border-radius:3px; }
                        .gmsingle_name_wrap .gmsingle_title_author { display:inline-block; vertical-align:top; max-width:100%; }
                        .gmsingle_name_wrap .gmsingle_title_author .gmsingle_title { text-rendering:auto; font-weight:100; font-size:24px; width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; margin:0; padding:1px 0; height:1.1em; line-height:1; box-sizing:content-box; text-transform:none; letter-spacing:0px; text-transform:capitalize; }
                        .gmsingle_name_wrap .gmsingle_title_author > div { font-size:14px; }
                        .gmsingle_name_wrap .gmsingle_title_author .gmsingle_author_name { float:left; }
                        .gmsingle_name_wrap .gmsingle_title_author a { font-size:inherit; }
                        .gmsingle_photo_info { display:flex; flex-wrap:wrap; }
                        .gmsingle_details_title { margin:0; padding:0; text-transform:uppercase; font-size:18px; line-height:1em; font-weight:300; height:1.1em; display:inline-block; overflow:visible; border:none; }
                        .gmsingle_description_wrap { flex:1; overflow:hidden; min-width:220px; max-width:100%; padding-right:7px; margin-bottom:30px; }
                        .gmsingle_description_wrap .gmsingle_terms { overflow:hidden; margin:0; position:relative; font-size:14px; font-weight:300; }
                        .gmsingle_description_wrap .gmsingle_term_label { margin-right:10px; }
                        .gmsingle_description_wrap .gmsingle_term_label:empty { display:none; }
                        .gmsingle_description_wrap .gmsingle_terms .gmsingle_term { display:inline-block; margin:0 12px 1px 0; }
                        .gmsingle_description_wrap .gmsingle_terms .gmsingle_term a { white-space:nowrap; }
                        .gmsingle_details_section { flex:1; width:33%; padding-right:7px; padding-left:7px; min-width:220px; max-width:100%; }
                        .gmsingle_details_section .gmsingle_slide_details { margin:20px 0; }
                        .gmsingle_location_section { flex:1; width:27%; padding-right:7px; padding-left:7px; min-width:220px; max-width:100%; }
                        .gmsingle_location_section .gmsingle_location_info { margin:20px 0; }
                        .gmsingle_location_section .gmsingle_location_info * { display:block; }
                        .gmsingle_location_section .gmsingle_location_info img { width:100%; height:auto; }
                        .gmsingle_badges { border-bottom:1px solid rgba(0, 0, 0, 0.1); padding-bottom:17px; margin-bottom:12px; text-align:left; font-weight:300; }
                        .gmsingle_badges__column { display:inline-block; vertical-align:top; width:40%; min-width:80px; }
                        .gmsingle_badges__column .gmsingle_badges__label { font-size:14px; }
                        .gmsingle_badges__column .gmsingle_badges__count { font-size:20px; line-height:1em; margin-top:1px; }
                        .gmsingle_exif { border-bottom:1px solid rgba(0, 0, 0, 0.1); padding-bottom:12px; margin-bottom:12px; text-align:left; font-size:14px; line-height:1.7em; font-weight:300; }
                        .gmsingle_exif .gmsingle_camera_settings .gmsingle_separator { font-weight:200; padding:0 5px; display:inline-block; }
                        .gmsingle_meta { padding-bottom:12px; margin-bottom:12px; text-align:left; font-size:14px; line-height:1.2em; font-weight:300; }
                        .gmsingle_meta .gmsingle_meta_key { float:left; padding:3px 0; width:40%; min-width:80px; }
                        .gmsingle_meta .gmsingle_meta_value { float:left; white-space:nowrap; padding:3px 0; text-transform:capitalize; }
                    </style>
                    <?php 
                } else {
                    echo apply_filters('the_gmedia_content', wpautop($gmedia->description));
                }
            } elseif ('audio' == $gmedia->type && ($module = $gmCore->get_module_path('wavesurfer')) && $module['name'] === 'wavesurfer') {
                echo gmedia_shortcode(array('module' => 'wavesurfer', 'library' => $gmedia->ID, 'native' => true));
                if (is_single()) {
                    echo apply_filters('the_gmedia_content', wpautop($gmedia->description));
                }
            } else {
                $ext1 = wp_get_audio_extensions();
                $ext2 = wp_get_video_extensions();
                $ext = array_merge($ext1, $ext2);
                if (in_array($gmedia->ext, $ext)) {
                    $embed = do_shortcode("[embed]{$gmedia->url}[/embed]");
                    echo $embed;
                } else {
                    $cover_url = $gmCore->gm_get_media_image($gmedia, 'web');
                    ?>
                    <a class="gmedia-item-link" href="<?php 
                    echo $gmedia->url;
                    ?>
" download="true"><img class="gmedia-item" style="max-width:100%;" src="<?php 
                    echo $cover_url;
                    ?>
" alt="<?php 
                    esc_attr_e($gmedia->title);
                    ?>
"/></a>
                    <?php 
                }
            }
            $ob_content = ob_get_contents();
            ob_end_clean();
            if (is_single()) {
                $before = '<div class="GmediaGallery_SinglePage">';
                $after = '</div>';
            } else {
                $before = '<div class="GmediaGallery_ArchivePage">';
                $after = '</div>';
            }
            $output = $before . $ob_content . $after;
        }
    } else {
        if ('get_the_excerpt' != cu 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_widget_defaults函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_user_contact_methods函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap