当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_get_audio_extensions函数代码示例

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


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

示例1: wp_maybe_load_embeds

/**
 * Determines if default embed handlers should be loaded.
 *
 * Checks to make sure that the embeds library hasn't already been loaded. If
 * it hasn't, then it will load the embeds library.
 *
 * @since 2.9.0
 */
function wp_maybe_load_embeds()
{
    if (!apply_filters('load_default_embeds', true)) {
        return;
    }
    wp_embed_register_handler('googlevideo', '#http://video\\.google\\.([A-Za-z.]{2,5})/videoplay\\?docid=([\\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo');
    wp_embed_register_handler('audio', '#^https?://.+?\\.(' . join('|', wp_get_audio_extensions()) . ')$#i', apply_filters('wp_audio_embed_handler', 'wp_embed_handler_audio'), 9999);
    wp_embed_register_handler('video', '#^https?://.+?\\.(' . join('|', wp_get_video_extensions()) . ')$#i', apply_filters('wp_video_embed_handler', 'wp_embed_handler_video'), 9999);
}
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:17,代码来源:media.php

示例2: themify_builder_module_settings_field


//.........这里部分代码省略.........
                        } elseif ('audio' == $option['type']) {
                            ?>
											<input data-input-id="<?php 
                            echo $option['id'];
                            ?>
" name="<?php 
                            echo $option['id'];
                            ?>
" placeholder="<?php 
                            if (isset($option['value'])) {
                                echo $option['value'];
                            }
                            ?>
" class="<?php 
                            echo $option['class'];
                            ?>
 themify-builder-uploader-input tfb_lb_option_child" type="text" /><br />

											<div class="small">

												<?php 
                            if (is_multisite() && !is_upload_space_available()) {
                                ?>
													<?php 
                                echo sprintf(__('Sorry, you have filled your %s MB storage quota so uploading has been disabled.', 'themify'), get_space_allowed());
                                ?>
												<?php 
                            } else {
                                ?>
													<div class="themify-builder-plupload-upload-uic hide-if-no-js tf-upload-btn" id="<?php 
                                echo $option['id'];
                                ?>
themify-builder-plupload-upload-ui" data-extensions="<?php 
                                echo esc_attr(implode(',', wp_get_audio_extensions()));
                                ?>
">
														<input id="<?php 
                                echo $option['id'];
                                ?>
themify-builder-plupload-browse-button" type="button" value="<?php 
                                esc_attr_e(__('Upload', 'themify'));
                                ?>
" class="builder_button" />
														<span class="ajaxnonceplu" id="ajaxnonceplu<?php 
                                echo wp_create_nonce($option['id'] . 'themify-builder-plupload');
                                ?>
"></span>
													</div> <?php 
                                _e('or', 'themify');
                                ?>
 <a href="#" class="themify-builder-media-uploader tf-upload-btn" data-uploader-title="<?php 
                                _e('Upload an Image', 'themify');
                                ?>
" data-uploader-button-text="<?php 
                                _e('Insert file URL', 'themify');
                                ?>
" data-library-type="audio"><?php 
                                _e('Browse Library', 'themify');
                                ?>
</a>

												<?php 
                            }
                            ?>

											</div>
开发者ID:byronmisiva,项目名称:mrkpln-dev,代码行数:67,代码来源:themify-builder-options.php

示例3: 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

示例4: stargazer_audio_shortcode

/**
 * Adds a featured image (if one exists) next to the audio player.  Also adds a section below the player to
 * display the audio file information (toggled by custom JS).
 *
 * @since  1.0.0
 * @access public
 * @param  string  $html
 * @param  array   $atts
 * @param  object  $audio
 * @param  object  $post_id
 * @return string
 */
function stargazer_audio_shortcode($html, $atts, $audio, $post_id)
{
    // Don't show in the admin.
    if (is_admin()) {
        return $html;
    }
    // If we have an actual attachment to work with, use the ID.
    if (is_object($audio)) {
        $attachment_id = $audio->ID;
    } else {
        $extensions = join('|', wp_get_audio_extensions());
        preg_match('/(src|' . $extensions . ')=[\'"](.+?)[\'"]/i', preg_replace('/(\\?_=[0-9])/i', '', $html), $matches);
        if (!empty($matches)) {
            $attachment_id = stargazer_get_attachment_id_from_url($matches[2]);
        }
    }
    // If an attachment ID was found.
    if (!empty($attachment_id)) {
        // Get the attachment's featured image.
        $image = get_the_image(array('post_id' => $attachment_id, 'image_class' => 'audio-image', 'link_to_post' => is_attachment() ? false : true, 'echo' => false));
        // If there's no attachment featured image, see if there's one for the post.
        if (empty($image) && !empty($post_id)) {
            $image = get_the_image(array('image_class' => 'audio-image', 'link_to_post' => false, 'echo' => false));
        }
        // Add a wrapper for the audio element and image.
        if (!empty($image)) {
            $image = preg_replace(array('/width=[\'"].+?[\'"]/i', '/height=[\'"].+?[\'"]/i'), '', $image);
            $html = '<div class="audio-shortcode-wrap">' . $image . $html . '</div>';
        }
        // If not viewing an attachment page, add the media info section.
        if (!is_attachment()) {
            $html .= '<div class="media-shortcode-extend">';
            $html .= '<div class="media-info audio-info">';
            $html .= '<ul class="media-meta">';
            $pre = '<li><span class="prep">%s</span>';
            $html .= hybrid_get_media_meta('length_formatted', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Run Time', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('artist', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Artist', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('album', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Album', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('track_number', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Track', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('year', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Year', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('gennre', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Genre', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('file_type', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('File Type', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('file_name', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('File Name', 'stargazer')), 'after' => '</li>'));
            $html .= hybrid_get_media_meta('mime_type', array('post_id' => $attachment_id, 'before' => sprintf($pre, esc_html__('Mime Type', 'stargazer')), 'after' => '</li>'));
            $html .= '</ul></div>';
            $html .= '<button class="media-info-toggle">' . __('Audio Info', 'stargazer') . '</button>';
            $html .= '</div>';
        }
    }
    return $html;
}
开发者ID:gruz0,项目名称:stargazer,代码行数:63,代码来源:stargazer.php

示例5: 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

示例6: 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

示例7: pgb_get_audio

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

示例8: stargazer_audio_shortcode

/**
 * Adds a featured image (if one exists) next to the audio player.  Also adds a section below the player to 
 * display the audio file information (toggled by custom JS).
 *
 * @since  1.0.0
 * @access public
 * @param  string  $html
 * @param  array   $atts
 * @param  object  $audio
 * @param  object  $post_id
 * @return string
 */
function stargazer_audio_shortcode($html, $atts, $audio, $post_id)
{
    /* Don't show in the admin. */
    if (is_admin()) {
        return $html;
    }
    /* If we have an actual attachment to work with, use the ID. */
    if (is_object($audio)) {
        $attachment_id = $audio->ID;
    } else {
        $extensions = join('|', wp_get_audio_extensions());
        preg_match('/(src|' . $extensions . ')=[\'"](.+?)[\'"]/i', preg_replace('/(\\?_=[0-9])/i', '', $html), $matches);
        if (!empty($matches)) {
            $attachment_id = hybrid_get_attachment_id_from_url($matches[2]);
        }
    }
    /* If an attachment ID was found. */
    if (!empty($attachment_id)) {
        /* Get the attachment's featured image. */
        $image = get_the_image(array('post_id' => $attachment_id, 'image_class' => 'audio-image', 'link_to_post' => is_attachment() ? false : true, 'echo' => false));
        /* If there's no attachment featured image, see if there's one for the post. */
        if (empty($image) && !empty($post_id)) {
            $image = get_the_image(array('image_class' => 'audio-image', 'link_to_post' => false, 'echo' => false));
        }
        /* Add a wrapper for the audio element and image. */
        if (!empty($image)) {
            $image = preg_replace(array('/width=[\'"].+?[\'"]/i', '/height=[\'"].+?[\'"]/i'), '', $image);
            $html = '<div class="audio-shortcode-wrap">' . $image . $html . '</div>';
        }
        /* If not viewing an attachment page, add the media info section. */
        if (!is_attachment()) {
            $html .= '<div class="media-shortcode-extend">';
            $html .= '<div class="media-info audio-info">';
            $html .= hybrid_media_meta(array('post_id' => $attachment_id, 'echo' => false));
            $html .= '</div>';
            $html .= '<button class="media-info-toggle">' . __('Audio Info', 'stargazer') . '</button>';
            $html .= '</div>';
        }
    }
    return $html;
}
开发者ID:htmELS,项目名称:stargazer,代码行数:53,代码来源:stargazer.php

示例9: 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

示例10: 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

示例11: getPlayableUrl

 /**
  * Get the first valid audio-enclosure-url from an audio doc
  *
  * @since 0.2
  */
 public static function getPlayableUrl($audio_doc)
 {
     $guid = $audio_doc->attributes->guid;
     $enclosure = $audio_doc->links('enclosure')->first();
     if (!$enclosure) {
         pmp_debug("      ** NO ENCLOSURES for audio[{$guid}]");
         return null;
     }
     // supplementary data
     $href = $enclosure->href;
     $type = isset($enclosure->type) ? $enclosure->type : null;
     $uri_parts = parse_url($href);
     $extension = pathinfo($uri_parts['path'], PATHINFO_EXTENSION);
     if (!in_array($uri_parts['scheme'], array('http', 'https'))) {
         pmp_debug("      ** INVALID ENCLOSURE HREF ({$href}) for audio[{$guid}]");
         return null;
     }
     // dereference playlists (m3u)
     if ($type == 'audio/m3u' || $extension == 'm3u') {
         pmp_debug("      ** dereferencing playlist for audio[{$guid}]");
         $response = wp_remote_get($href);
         $lines = explode("\n", $response['body']);
         $href = $lines[0];
         $uri_parts = parse_url($href);
         $extension = pathinfo($uri_parts['path'], PATHINFO_EXTENSION);
         $type = null;
         // we don't know this anymore
     }
     // check for "known" types that start with audio/*
     if ($type && in_array($type, array_values(get_allowed_mime_types()))) {
         if (preg_match('/^audio/', $type)) {
             pmp_debug("      ** known mime type '{$type}' for audio[{$guid}]");
             return $href;
         }
     }
     if (in_array($extension, wp_get_audio_extensions())) {
         pmp_debug("      ** known extension '{$extension}' for audio[{$guid}]");
         return $href;
     }
     // not sure what this is
     pmp_debug("      ** UNABLE TO PLAY enclosure ({$href}) for audio[{$guid}]");
     return null;
 }
开发者ID:jackbrighton,项目名称:pmp-wordpress,代码行数:48,代码来源:class-sdkwrapper.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' != current_filter()) {
            if (!isset($post->term_id)) {
                $post->term_id = get_post_meta($post->ID, '_gmedia_term_ID', true);
            }
            if ($post->post_type == 'gmedia_gallery') {
                $output .= do_shortcode("[gmedia id={$post->term_id}]");
            } else {
                $output .= do_shortcode("[gm id={$post->term_id}]");
            }
        }
    }
    $output = str_replace(array("\r\n", "\r", "\n"), '', $output);
    $output = preg_replace('/ {2,}/', ' ', $output);
    $post->post_content = $output;
    $post->gmedia_content = $output;
    return $output;
}
开发者ID:pasyuk,项目名称:grand-media,代码行数:101,代码来源:frontend.filters.php

示例13: admin_main

    function admin_main($data)
    {
        wp_enqueue_style('thickbox');
        wp_enqueue_script('thickbox');
        wp_enqueue_media();
        wp_enqueue_script('media-upload');
        $supported_audio_extensions = implode(",", wp_get_audio_extensions());
        if (!empty($data)) {
            if (!isset($data->autoplay) or empty($data->autoplay)) {
                $data->autoplay = 'No';
            }
            if (!isset($data->loop) or empty($data->loop)) {
                $data->loop = 'No';
            }
        }
        ?>

		<div class="<?php 
        if (empty($data)) {
            ?>
draggable-<?php 
        }
        ?>
module-holder-<?php 
        echo $this->name;
        ?>
 module-holder-title" <?php 
        if (empty($data)) {
            ?>
style="display:none;"<?php 
        }
        ?>
>

			<h3 class="module-title sidebar-name <?php 
        echo !empty($data->active_module) ? 'is_active_module' : '';
        ?>
" data-panel="<?php 
        echo !empty($data->panel) ? $data->panel : '';
        ?>
" data-id="<?php 
        echo !empty($data->ID) ? $data->ID : '';
        ?>
">
				<span class="h3-label">
					<span class="h3-label-left"><?php 
        echo isset($data->post_title) && $data->post_title !== '' ? $data->post_title : __('Untitled', 'cp');
        ?>
</span>
					<span class="h3-label-right"><?php 
        echo $this->label;
        ?>
</span>
					<?php 
        parent::get_module_move_link();
        ?>
				</span>
			</h3>

			<div class="module-content">

				<input type="hidden" name="<?php 
        echo $this->name;
        ?>
_module_page[]" class="module_page" value="<?php 
        echo isset($data->module_page) ? $data->module_page : '';
        ?>
"/>
				<input type="hidden" name="<?php 
        echo $this->name;
        ?>
_module_order[]" class="module_order" value="<?php 
        echo isset($data->module_order) ? $data->module_order : 999;
        ?>
"/>
				<input type="hidden" name="module_type[]" value="<?php 
        echo $this->name;
        ?>
"/>
				<input type="hidden" name="<?php 
        echo $this->name;
        ?>
_id[]" class="unit_element_id" value="<?php 
        echo esc_attr(isset($data->ID) ? $data->ID : '');
        ?>
"/>

				<input type="hidden" class="element_id" value="<?php 
        echo esc_attr(isset($data->ID) ? $data->ID : '');
        ?>
"/>

				<label class="bold-label"><?php 
        _e('Element Title', 'cp');
        $this->time_estimation($data);
        ?>
</label>
				<?php 
        echo $this->element_title_description();
        ?>
//.........这里部分代码省略.........
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:101,代码来源:audio.php

示例14: 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

示例15: 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;
    }
    global $content_width;
    $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;
            }
        }
    }
    $audio = $video = 0;
    $counts = (array) wp_count_attachments();
    foreach ($counts as $mime => $total) {
        if (0 === strpos($mime, 'audio/')) {
            $audio += (int) $total;
        } elseif (0 === strpos($mime, 'video/')) {
            $video += (int) $total;
        }
    }
    $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' => $audio, 'video' => $video), 'embedExts' => $exts, 'embedMimes' => $ext_mimes, 'contentWidth' => $content_width);
    $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 (0 === strpos($post->post_mime_type, 'audio/')) {
                $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
            } elseif (0 === strpos($post->post_mime_type, 'video/')) {
                $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;
        }
    }
    $hier = $post && is_post_type_hierarchical($post->post_type);
    $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 images.'), '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'), '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'), '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;
    wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
    wp_enqueue_script('media-editor');
    wp_enqueue_script('media-audiovideo');
    wp_enqueue_style('media-views');
    if (is_admin()) {
        wp_enqueue_script('mce-view');
        wp_enqueue_script('image-edit');
    }
    wp_enqueue_style('imgareaselect');
    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');
    /**
     * Fires at the conclusion of wp_enqueue_media().
     *
     * @since 3.5.0
     */
//.........这里部分代码省略.........
开发者ID:mynameiskyleok,项目名称:openshift-wordpress-developer-quickstart,代码行数:101,代码来源:media.php


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