芝麻web文件管理V1.00
编辑当前文件:/home4/randall/public_html/sl/wp-content/plugins/trx_utils/shortcodes/trx_basic/video.php
'', "src" => '', "image" => '', "ratio" => '16:9', "autoplay" => 'off', "align" => '', "bg_image" => '', "bg_top" => '', "bg_bottom" => '', "bg_left" => '', "bg_right" => '', "frame" => "on", // Common params "id" => "", "class" => "", "animation" => "", "css" => "", "width" => '', "height" => '', "top" => "", "bottom" => "", "left" => "", "right" => "" ), $atts))); if (empty($autoplay)) $autoplay = 'off'; $ratio = empty($ratio) ? "16:9" : str_replace(array('/','\\','-'), ':', $ratio); $ratio_parts = explode(':', $ratio); if (empty($height) && empty($width)) { $width='100%'; if (lorem_ipsum_books_media_store_param_is_off(lorem_ipsum_books_media_store_get_custom_option('substitute_video'))) $height="400"; } $ed = lorem_ipsum_books_media_store_substr($width, -1); if (empty($height) && !empty($width) && $ed!='%') { $height = round($width / $ratio_parts[0] * $ratio_parts[1]); } if (!empty($height) && empty($width)) { $width = round($height * $ratio_parts[0] / $ratio_parts[1]); } $class .= ($class ? ' ' : '') . lorem_ipsum_books_media_store_get_css_position_as_classes($top, $right, $bottom, $left); $css_dim = lorem_ipsum_books_media_store_get_css_dimensions_from_values($width, $height); $css_bg = lorem_ipsum_books_media_store_get_css_paddings_from_values($bg_top, $bg_right, $bg_bottom, $bg_left); if ($src=='' && $url=='' && isset($atts[0])) { $src = $atts[0]; } $url = $src!='' ? $src : $url; if ($image!='' && lorem_ipsum_books_media_store_param_is_off($image)) $image = ''; else { if (lorem_ipsum_books_media_store_param_is_on($autoplay) && is_singular() && !lorem_ipsum_books_media_store_storage_get('blog_streampage')) $image = ''; else { if ($image > 0) { $attach = wp_get_attachment_image_src( $image, 'full' ); if (isset($attach[0]) && $attach[0]!='') $image = $attach[0]; } if ($bg_image) { $thumb_sizes = lorem_ipsum_books_media_store_get_thumb_sizes(array( 'layout' => 'grid_3' )); if (!is_single() || !empty($image)) $image = lorem_ipsum_books_media_store_get_resized_image_url(empty($image) ? get_the_ID() : $image, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, false); } else if (!is_single() || !empty($image)) $image = lorem_ipsum_books_media_store_get_resized_image_url(empty($image) ? get_the_ID() : $image, $ed!='%' ? $width : null, $height); if (empty($image) && (!is_singular() || lorem_ipsum_books_media_store_storage_get('blog_streampage'))) // || lorem_ipsum_books_media_store_param_is_off($autoplay))) $image = lorem_ipsum_books_media_store_get_video_cover_image($url); } } if ($bg_image > 0) { $attach = wp_get_attachment_image_src( $bg_image, 'full' ); if (isset($attach[0]) && $attach[0]!='') $bg_image = $attach[0]; } if ($bg_image) { $css_bg .= $css . 'background-image: url('.esc_url($bg_image).');'; $css = $css_dim; } else { $css .= $css_dim; } $url = lorem_ipsum_books_media_store_get_video_player_url($src!='' ? $src : $url); $video = '
' . '
'; if (lorem_ipsum_books_media_store_param_is_off(lorem_ipsum_books_media_store_get_custom_option('substitute_video'))) { if (lorem_ipsum_books_media_store_param_is_on($frame)) $video = lorem_ipsum_books_media_store_get_video_frame($video, $image, $css, $css_bg); } else { if ((isset($_GET['vc_editable']) && $_GET['vc_editable']=='true') && (isset($_POST['action']) && $_POST['action']=='vc_load_shortcode')) { $video = lorem_ipsum_books_media_store_substitute_video($video, $width, $height, false); } } if (lorem_ipsum_books_media_store_get_theme_option('use_mediaelement')=='yes') wp_enqueue_script('wp-mediaelement'); return apply_filters('lorem_ipsum_books_media_store_shortcode_output', $video, 'trx_video', $atts, $content); } add_shortcode("trx_video", "lorem_ipsum_books_media_store_sc_video"); } /* Register shortcode in the internal SC Builder -------------------------------------------------------------------- */ if ( !function_exists( 'lorem_ipsum_books_media_store_sc_video_reg_shortcodes' ) ) { //add_action('lorem_ipsum_books_media_store_action_shortcodes_list', 'lorem_ipsum_books_media_store_sc_video_reg_shortcodes'); function lorem_ipsum_books_media_store_sc_video_reg_shortcodes() { lorem_ipsum_books_media_store_sc_map("trx_video", array( "title" => esc_html__("Video", 'trx_utils'), "desc" => wp_kses_data( __("Insert video player", 'trx_utils') ), "decorate" => false, "container" => false, "params" => array( "url" => array( "title" => esc_html__("URL for video file", 'trx_utils'), "desc" => wp_kses_data( __("Select video from media library or paste URL for video file from other site", 'trx_utils') ), "readonly" => false, "value" => "", "type" => "media", "before" => array( 'title' => esc_html__('Choose video', 'trx_utils'), 'action' => 'media_upload', 'type' => 'video', 'multiple' => false, 'linked_field' => '', 'captions' => array( 'choose' => esc_html__('Choose video file', 'trx_utils'), 'update' => esc_html__('Select video file', 'trx_utils') ) ), "after" => array( 'icon' => 'icon-cancel', 'action' => 'media_reset' ) ), "ratio" => array( "title" => esc_html__("Ratio", 'trx_utils'), "desc" => wp_kses_data( __("Ratio of the video", 'trx_utils') ), "value" => "16:9", "type" => "checklist", "dir" => "horizontal", "options" => array( "16:9" => esc_html__("16:9", 'trx_utils'), "4:3" => esc_html__("4:3", 'trx_utils') ) ), "autoplay" => array( "title" => esc_html__("Autoplay video", 'trx_utils'), "desc" => wp_kses_data( __("Autoplay video on page load", 'trx_utils') ), "value" => "off", "type" => "switch", "options" => lorem_ipsum_books_media_store_get_sc_param('on_off') ), "align" => array( "title" => esc_html__("Align", 'trx_utils'), "desc" => wp_kses_data( __("Select block alignment", 'trx_utils') ), "value" => "none", "type" => "checklist", "dir" => "horizontal", "options" => lorem_ipsum_books_media_store_get_sc_param('align') ), "image" => array( "title" => esc_html__("Cover image", 'trx_utils'), "desc" => wp_kses_data( __("Select or upload image or write URL from other site for video preview", 'trx_utils') ), "readonly" => false, "value" => "", "type" => "media" ), "bg_image" => array( "title" => esc_html__("Background image", 'trx_utils'), "desc" => wp_kses_data( __("Select or upload image or write URL from other site for video background. Attention! If you use background image - specify paddings below from background margins to video block in percents!", 'trx_utils') ), "divider" => true, "readonly" => false, "value" => "", "type" => "media" ), "bg_top" => array( "title" => esc_html__("Top offset", 'trx_utils'), "desc" => wp_kses_data( __("Top offset (padding) inside background image to video block (in percent). For example: 3%", 'trx_utils') ), "dependency" => array( 'bg_image' => array('not_empty') ), "value" => "", "type" => "text" ), "bg_bottom" => array( "title" => esc_html__("Bottom offset", 'trx_utils'), "desc" => wp_kses_data( __("Bottom offset (padding) inside background image to video block (in percent). For example: 3%", 'trx_utils') ), "dependency" => array( 'bg_image' => array('not_empty') ), "value" => "", "type" => "text" ), "bg_left" => array( "title" => esc_html__("Left offset", 'trx_utils'), "desc" => wp_kses_data( __("Left offset (padding) inside background image to video block (in percent). For example: 20%", 'trx_utils') ), "dependency" => array( 'bg_image' => array('not_empty') ), "value" => "", "type" => "text" ), "bg_right" => array( "title" => esc_html__("Right offset", 'trx_utils'), "desc" => wp_kses_data( __("Right offset (padding) inside background image to video block (in percent). For example: 12%", 'trx_utils') ), "dependency" => array( 'bg_image' => array('not_empty') ), "value" => "", "type" => "text" ), "width" => lorem_ipsum_books_media_store_shortcodes_width(), "height" => lorem_ipsum_books_media_store_shortcodes_height(), "top" => lorem_ipsum_books_media_store_get_sc_param('top'), "bottom" => lorem_ipsum_books_media_store_get_sc_param('bottom'), "left" => lorem_ipsum_books_media_store_get_sc_param('left'), "right" => lorem_ipsum_books_media_store_get_sc_param('right'), "id" => lorem_ipsum_books_media_store_get_sc_param('id'), "class" => lorem_ipsum_books_media_store_get_sc_param('class'), "animation" => lorem_ipsum_books_media_store_get_sc_param('animation'), "css" => lorem_ipsum_books_media_store_get_sc_param('css') ) )); } } /* Register shortcode in the VC Builder -------------------------------------------------------------------- */ if ( !function_exists( 'lorem_ipsum_books_media_store_sc_video_reg_shortcodes_vc' ) ) { //add_action('lorem_ipsum_books_media_store_action_shortcodes_list_vc', 'lorem_ipsum_books_media_store_sc_video_reg_shortcodes_vc'); function lorem_ipsum_books_media_store_sc_video_reg_shortcodes_vc() { vc_map( array( "base" => "trx_video", "name" => esc_html__("Video", 'trx_utils'), "description" => wp_kses_data( __("Insert video player", 'trx_utils') ), "category" => esc_html__('Content', 'trx_utils'), 'icon' => 'icon_trx_video', "class" => "trx_sc_single trx_sc_video", "content_element" => true, "is_container" => false, "show_settings_on_create" => true, "params" => array( array( "param_name" => "url", "heading" => esc_html__("URL for video file", 'trx_utils'), "description" => wp_kses_data( __("Paste URL for video file", 'trx_utils') ), "admin_label" => true, "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "ratio", "heading" => esc_html__("Ratio", 'trx_utils'), "description" => wp_kses_data( __("Select ratio for display video", 'trx_utils') ), "class" => "", "value" => array( esc_html__('16:9', 'trx_utils') => "16:9", esc_html__('4:3', 'trx_utils') => "4:3" ), "type" => "dropdown" ), array( "param_name" => "autoplay", "heading" => esc_html__("Autoplay video", 'trx_utils'), "description" => wp_kses_data( __("Autoplay video on page load", 'trx_utils') ), "admin_label" => true, "class" => "", "value" => array("Autoplay" => "on" ), "type" => "checkbox" ), array( "param_name" => "align", "heading" => esc_html__("Alignment", 'trx_utils'), "description" => wp_kses_data( __("Select block alignment", 'trx_utils') ), "class" => "", "value" => array_flip(lorem_ipsum_books_media_store_get_sc_param('align')), "type" => "dropdown" ), array( "param_name" => "image", "heading" => esc_html__("Cover image", 'trx_utils'), "description" => wp_kses_data( __("Select or upload image or write URL from other site for video preview", 'trx_utils') ), "class" => "", "value" => "", "type" => "attach_image" ), array( "param_name" => "bg_image", "heading" => esc_html__("Background image", 'trx_utils'), "description" => wp_kses_data( __("Select or upload image or write URL from other site for video background. Attention! If you use background image - specify paddings below from background margins to video block in percents!", 'trx_utils') ), "group" => esc_html__('Background', 'trx_utils'), "class" => "", "value" => "", "type" => "attach_image" ), array( "param_name" => "bg_top", "heading" => esc_html__("Top offset", 'trx_utils'), "description" => wp_kses_data( __("Top offset (padding) from background image to video block (in percent). For example: 3%", 'trx_utils') ), "group" => esc_html__('Background', 'trx_utils'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "bg_bottom", "heading" => esc_html__("Bottom offset", 'trx_utils'), "description" => wp_kses_data( __("Bottom offset (padding) from background image to video block (in percent). For example: 3%", 'trx_utils') ), "group" => esc_html__('Background', 'trx_utils'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "bg_left", "heading" => esc_html__("Left offset", 'trx_utils'), "description" => wp_kses_data( __("Left offset (padding) from background image to video block (in percent). For example: 20%", 'trx_utils') ), "group" => esc_html__('Background', 'trx_utils'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "bg_right", "heading" => esc_html__("Right offset", 'trx_utils'), "description" => wp_kses_data( __("Right offset (padding) from background image to video block (in percent). For example: 12%", 'trx_utils') ), "group" => esc_html__('Background', 'trx_utils'), "class" => "", "value" => "", "type" => "textfield" ), lorem_ipsum_books_media_store_get_vc_param('id'), lorem_ipsum_books_media_store_get_vc_param('class'), lorem_ipsum_books_media_store_get_vc_param('animation'), lorem_ipsum_books_media_store_get_vc_param('css'), lorem_ipsum_books_media_store_vc_width(), lorem_ipsum_books_media_store_vc_height(), lorem_ipsum_books_media_store_get_vc_param('margin_top'), lorem_ipsum_books_media_store_get_vc_param('margin_bottom'), lorem_ipsum_books_media_store_get_vc_param('margin_left'), lorem_ipsum_books_media_store_get_vc_param('margin_right') ) ) ); class WPBakeryShortCode_Trx_Video extends Lorem_Ipsum_Books_Media_Store_VC_ShortCodeSingle {} } } ?>