diff --git a/admin/class-flowplayer5-admin.php b/admin/class-flowplayer5-admin.php index 1f10b4f..4ae20b1 100644 --- a/admin/class-flowplayer5-admin.php +++ b/admin/class-flowplayer5-admin.php @@ -60,9 +60,6 @@ private function __construct() { add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); - // Add custom post type - add_action( 'init', array( $this, 'add_fp5_videos' ) ); - // Add action links $plugin_basename = plugin_basename( plugin_dir_path( FP5_PLUGIN_FILE ) . 'flowplayer.php' ); add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) ); @@ -237,66 +234,16 @@ public function add_action_links( $links ) { } - /** - * NOTE: Actions are points in the execution of a page or process - * lifecycle that WordPress fires. - * - * @since 1.0.0 - */ - public function add_fp5_videos() { - - $labels = apply_filters( 'fp5_post_type_labels', array( - 'name' => _x( 'Videos', 'Post Type General Name', $this->plugin_slug ), - 'singular_name' => _x( 'Video', 'Post Type Singular Name', $this->plugin_slug ), - 'menu_name' => __( 'Video', $this->plugin_slug ), - 'parent_item_colon' => __( 'Parent Video', $this->plugin_slug ), - 'all_items' => __( 'All Videos', $this->plugin_slug ), - 'view_item' => __( 'View Video', $this->plugin_slug ), - 'add_new_item' => __( 'Add New Video', $this->plugin_slug ), - 'add_new' => __( 'New Video', $this->plugin_slug ), - 'edit_item' => __( 'Edit Video', $this->plugin_slug ), - 'update_item' => __( 'Update Video', $this->plugin_slug ), - 'search_items' => __( 'Search videos', $this->plugin_slug ), - 'not_found' => __( 'No videos found', $this->plugin_slug ), - 'not_found_in_trash' => __( 'No videos found in Trash', $this->plugin_slug ), - ) ); - - $args = apply_filters( 'fp5_post_type_args', array( - 'label' => __( 'Video', $this->plugin_slug ), - 'description' => __( 'Flowplayer videos', $this->plugin_slug ), - 'labels' => $labels, - 'supports' => array( 'title' ), - 'hierarchical' => false, - 'public' => false, - 'show_ui' => true, - 'show_in_menu' => true, - 'show_in_nav_menus' => true, - 'show_in_admin_bar' => true, - 'menu_position' => 15, - 'menu_icon' => '', - 'can_export' => true, - 'has_archive' => false, - 'exclude_from_search' => true, - 'publicly_queryable' => false, - 'query_var' => 'video', - 'rewrite' => false, - 'capability_type' => 'page', - ) ); - - register_post_type( 'flowplayer5', $args ); - - } - /** * Edit custom post type messages. * * @since 1.0.0 */ - public function set_messages($messages) { + public function set_messages( $messages ) { global $post; - $messages[$this->plugin_slug] = array( + $messages[$this->plugin_slug] = apply_filters( 'fp5_filter_set_messages', array( 0 => '', // Unused. Messages start at index 1. 1 => __( 'Video updated.', $this->plugin_slug ) . ' ' . sprintf( __( 'Shortcode: %1$s', $this->plugin_slug ), '[flowplayer id="' . get_the_ID() . '"]' ), @@ -310,7 +257,7 @@ public function set_messages($messages) { 9 => sprintf( __( 'Video scheduled for: %1$s', $this->plugin_slug ), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ), 10 => __( 'Video draft updated.', $this->plugin_slug ), - ); + ) ); return $messages; diff --git a/flowplayer.php b/flowplayer.php index f3fd72e..d92a9d3 100644 --- a/flowplayer.php +++ b/flowplayer.php @@ -11,7 +11,7 @@ * Plugin Name: Flowplayer 5 for WordPress * Plugin URI: http://wordpress.org/plugins/flowplayer5/ * Description: A HTML5 responsive video player plugin. From the makers of Flowplayer. Supports all three default Flowplayer skins, subtitles, tracking with Google Analytics, splash images. You can use your own watermark logo if you own a Commercial Flowplayer license. - * Version: 1.2.0 + * Version: 1.3.0 * Author: Flowplayer ltd. * Author URI: http://flowplayer.org/ * Text Domain: flowplayer5 @@ -42,7 +42,7 @@ require_once( plugin_dir_path( __FILE__ ) . 'admin/class-flowplayer-drive.php' ); } else { require_once( plugin_dir_path( __FILE__ ) . 'frontend/class-flowplayer5-frontend.php' ); - require_once( plugin_dir_path( __FILE__ ) . 'frontend/shortcode.php' ); + require_once( plugin_dir_path( __FILE__ ) . 'frontend/class-flowplayer5-shortcode.php' ); } // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. @@ -56,4 +56,5 @@ Flowplayer_Drive::get_instance(); } else { Flowplayer5_Frontend::get_instance(); + Flowplayer5_Shortcode::get_instance(); } \ No newline at end of file diff --git a/frontend/class-flowplayer5-frontend.php b/frontend/class-flowplayer5-frontend.php index c440972..c742296 100644 --- a/frontend/class-flowplayer5-frontend.php +++ b/frontend/class-flowplayer5-frontend.php @@ -50,6 +50,9 @@ private function __construct() { add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); + // Filter video output to video post + add_filter( 'the_content', array( $this, 'get_video_output' ) ); + // Load script for Flowplayer global configuration add_action( 'wp_head', array( $this, 'global_config_script' ) ); @@ -94,7 +97,9 @@ public function enqueue_styles() { // Register stylesheets if( function_exists( 'has_shortcode' ) ) { - if( has_shortcode( $post->post_content, 'flowplayer' ) ) { + $post_content = isset( $post->post_content ) ? $post->post_content : ''; + $has_shortcode = ''; + if( has_shortcode( $post_content, 'flowplayer' ) || 'flowplayer5' == get_post_type() || apply_filters( 'fp5_filter_has_shortcode', $has_shortcode ) ) { wp_enqueue_style( $this->plugin_slug .'-skins' , trailingslashit( $flowplayer5_directory ) . 'all-skins.css', array(), $this->player_version ); wp_enqueue_style( $this->plugin_slug .'-logo-origin', plugins_url( '/assets/css/public.css', __FILE__ ), array(), $this->plugin_version ); } @@ -131,7 +136,9 @@ public function enqueue_scripts() { // Register JavaScript if( function_exists( 'has_shortcode' ) ) { - if( has_shortcode( $post->post_content, 'flowplayer' ) ) { + $post_content = isset( $post->post_content ) ? $post->post_content : ''; + $has_shortcode = ''; + if( has_shortcode( $post_content, 'flowplayer' ) || 'flowplayer5' == get_post_type() || apply_filters( 'fp5_filter_has_shortcode', $has_shortcode ) ) { wp_enqueue_script( $this->plugin_slug . '-script', trailingslashit( $flowplayer5_directory ) . 'flowplayer.min.js', array( 'jquery' ), $this->player_version, false ); } } else { @@ -140,6 +147,20 @@ public function enqueue_scripts() { } + /** + * Add video to post + * + * Add video html to flowplayer video posts + * + * @since 1.3.0 + */ + public function get_video_output( $content ) { + if( is_singular( 'flowplayer5') || is_post_type_archive( 'flowplayer5') && is_main_query() ) { + $content .= Flowplayer5_Shortcode::create_fp5_video_output( get_the_ID() ); + } + return $content; + } + /** * Flowplayer global JavaScript settings. * diff --git a/frontend/class-flowplayer5-shortcode.php b/frontend/class-flowplayer5-shortcode.php new file mode 100644 index 0000000..d6488e5 --- /dev/null +++ b/frontend/class-flowplayer5-shortcode.php @@ -0,0 +1,197 @@ + + * @license GPL-2.0+ + * @link http://flowplayer.org/ + * @copyright 2013 Flowplayer Ltd + */ + +// If this file is called directly, abort. +if ( ! defined( 'WPINC' ) ) { + die; +} + +/** + * Flowplayer Shortcode Class + * + * @package Flowplayer5_Shortcode + * @author Ulrich Pogson + */ +class Flowplayer5_Shortcode { + + /** + * Instance of this class. + * + * @since 1.3.0 + * + * @var object + */ + protected static $instance = null; + + /** + * Initialize the class by adding the shortcode. + * + * @since 1.3.0 + */ + private function __construct() { + + // Register shortcode + add_shortcode( 'flowplayer', array( $this, 'create_fp5_video_output' ) ); + + } + + /** + * Return an instance of this class. + * + * @since 1.3.0 + * + * @return object A single instance of this class. + */ + public static function get_instance() { + + // If the single instance hasn't been set, set it now. + if ( null == self::$instance ) { + self::$instance = new self; + } + + return self::$instance; + + } + + /** + * Create Flowplayer Video HTML Output + * + * Retrieves a media files and settings to display a video. + * + * @since 1.3.0 + * + * @param array $atts Shortcode attributes + */ + public function create_fp5_video_output( $atts ) { + + global $post; + + if ( isset( $atts['id'] ) ) { + $id = $atts['id']; + } elseif ( 'flowplayer5' == get_post_type() ) { + $id = get_the_ID(); + } + + if ( isset( $id ) ) { + + /** + * New flowplayer shortcode + * + * @example [flowplayer id="123"] + */ + + // get the meta from the post type + $loop = get_post_meta( $id, 'fp5-loop', true ); + $autoplay = get_post_meta( $id, 'fp5-autoplay', true ); + $preload = get_post_meta( $id, 'fp5-preload', true ); + $poster = ''; + $fixed_controls = get_post_meta( $id, 'fp5-fixed-controls', true ); + $coloring = get_post_meta( $id, 'fp5-coloring', true ); + $skin = get_post_meta( $id, 'fp5-select-skin', true ); + $splash = get_post_meta( $id, 'fp5-splash-image', true ); + $mp4 = get_post_meta( $id, 'fp5-mp4-video', true ); + $webm = get_post_meta( $id, 'fp5-webm-video', true ); + $ogg = get_post_meta( $id, 'fp5-ogg-video', true) ; + $subtitles = get_post_meta( $id, 'fp5-vtt-subtitles', true ); + $max_width = get_post_meta( $id, 'fp5-max-width', true ); + $width = get_post_meta( $id, 'fp5-width', true ); + $height = get_post_meta( $id, 'fp5-height', true ); + $ratio = get_post_meta( $id, 'fp5-aspect-ratio', true ); + $fixed = get_post_meta( $id, 'fp5-fixed-width', true ); + + } else { + + /** + * Old flowplayer shortcode + * + * @example [flowplayer splash="trailer_1080p.jpg" webm="trailer_1080p.webm" mp4="trailer_1080p.mp4" ogg="trailer_1080p.ogv" width="1920" height="1080" skin="functional" autoplay="true" loop="true" fixed="false" subtitles="bunny-en.vtt" fixed_controls="true" coloring="default" preload="auto"] + */ + + // Attributes + extract( + shortcode_atts( + array( + 'mp4' => '', + 'webm' => '', + 'ogg' => '', + 'skin' => 'minimalist', + 'splash' => '', + 'autoplay' => 'false', + 'loop' => 'false', + 'subtitles' => '', + 'width' => '', + 'height' => '', + 'fixed' => 'false', + 'fixed_controls' => '', + 'coloring' => 'default', + 'preload' => 'auto', + 'poster' => '' + ), + $atts + ) + ); + + $max_width = $width; + + } + + // set the options for the shortcode - pulled from the register-settings.php + $options = get_option('fp5_settings_general'); + $key = ( isset( $options['key'] ) ) ? $options['key'] : ''; + $logo = ( isset( $options['logo'] ) ) ? $options['logo'] : ''; + $ga_account_id = ( isset( $options['ga_account_id'] ) ) ? $options['ga_account_id'] : ''; + $logo_origin = ( isset( $options['logo_origin'] ) ) ? $options['logo_origin'] : ''; + + // Shortcode processing + $ratio = ( ( $width != 0 && $height != 0 ) ? intval( $height ) / intval( $width ) : '' ); + $size = ( $fixed == 'true' && $width != '' && $height != '' ? 'width:' . $width . 'px; height:' . $height . 'px; ' : ( ( $max_width != 0 ) ? 'max-width:' . $max_width . 'px; ' : '' ) ); + $splash_style = 'background: #777 url(' . $splash . ') no-repeat;'; + $class = 'flowplayer ' . $skin . ' ' . ( ! empty ( $splash ) ? 'is-splash ' : '' ) . ( ! empty ( $logo_origin ) ? 'commercial ' : '' ); + $data_key = ( 0 < strlen ( $key ) ? 'data-key="' . $key . '" ' : ''); + $data_logo = ( 0 < strlen ( $key ) && 0 < strlen ( $logo ) ? 'data-logo="' . $logo . '" ' : '' ); + $data_analytics = ( 0 < strlen ( $ga_account_id ) ? 'data-analytics="' . $ga_account_id . '" ' : '' ); + $data_ratio = ( $ratio != 0 ? 'data-ratio="' . $ratio . '" ' : '' ); + + $modifier_classes = ( ( $fixed_controls == 'true' ) ? 'fixed-controls ' : '' ) . ( $coloring != 'default' ? $coloring : '' ); + $flowplayer_data = $data_key . $data_logo . $data_analytics . $data_ratio; + $attributes = ( ( $autoplay == 'true' ) ? 'autoplay ' : '' ) . ( ( $loop == 'true' ) ? 'loop ' : '' ) . ( isset ( $preload ) ? 'preload="' . $preload . '" ' : '' ) . ( ( $poster == 'true' ) ? 'poster' : '' ); + + // Shortcode output + $return = '
'; + ob_start(); + $return .= do_action( 'fp5_video_top' ); + $return .= ob_get_contents(); + ob_clean(); + $return .= ''; + ob_start(); + $return .= do_action( 'fp5_video_bottom' ); + $return .= ob_get_contents(); + ob_clean(); + $return .= '
'; + + // Extra options + $return .= ''; + + // Check if a video has been added before output + if ( $webm || $mp4 || $ogg ) { + return $return; + } + + } + +} \ No newline at end of file diff --git a/frontend/shortcode.php b/frontend/shortcode.php deleted file mode 100644 index 22306e3..0000000 --- a/frontend/shortcode.php +++ /dev/null @@ -1,173 +0,0 @@ - - * @license GPL-2.0+ - * @link http://flowplayer.org/ - * @copyright 2013 Flowplayer Ltd - */ - -// If this file is called directly, abort. -if ( ! defined( 'WPINC' ) ) { - die; -} - -/** - * Flowplayer video Shortcode - * - * Retrieves a media files and settings to display a video. - * - * @since 1.0.0 - * @param array $atts Shortcode attributes - * @example [flowplayer id='39'] - */ -function add_fp5_shortcode( $atts ) { - - global $post; - - - if ( isset( $atts['id'] ) ) { - - // get post id - $id = $atts['id']; - - // get the meta from the post type - $loop = get_post_meta( $id, 'fp5-loop', true ); - $autoplay = get_post_meta( $id, 'fp5-autoplay', true ); - $preload = get_post_meta( $id, 'fp5-preload', true ); - $poster = ''; - $fixed_controls = get_post_meta( $id, 'fp5-fixed-controls', true ); - $coloring = get_post_meta( $id, 'fp5-coloring', true ); - $skin = get_post_meta( $id, 'fp5-select-skin', true ); - $splash = get_post_meta( $id, 'fp5-splash-image', true ); - $mp4 = get_post_meta( $id, 'fp5-mp4-video', true ); - $webm = get_post_meta( $id, 'fp5-webm-video', true ); - $ogg = get_post_meta( $id, 'fp5-ogg-video', true) ; - $subtitles = get_post_meta( $id, 'fp5-vtt-subtitles', true ); - $max_width = get_post_meta( $id, 'fp5-max-width', true ); - $width = get_post_meta( $id, 'fp5-width', true ); - $height = get_post_meta( $id, 'fp5-height', true ); - $ratio = get_post_meta( $id, 'fp5-aspect-ratio', true ); - $fixed = get_post_meta( $id, 'fp5-fixed-width', true ); - - // set the options for the shortcode - pulled from the register-settings.php - $options = get_option('fp5_settings_general'); - $key = ( isset( $options['key'] ) ) ? $options['key'] : ''; - $logo = ( isset( $options['logo'] ) ) ? $options['logo'] : ''; - $ga_account_id = ( isset( $options['ga_account_id'] ) ) ? $options['ga_account_id'] : ''; - $logo_origin = ( isset( $options['logo_origin'] ) ) ? $options['logo_origin'] : ''; - - // Shortcode processing - $ratio = ( ( $width != 0 && $height != 0 ) ? intval( $height ) / intval( $width ) : '' ); - $size = ( $fixed == 'true' && $width != '' && $height != '' ? 'width:' . $width . 'px; height:' . $height . 'px; ' : ( ( $max_width != 0 ) ? 'max-width:' . $max_width . 'px; ' : '' ) ); - $splash_style = 'background: #777 url(' . $splash . ') no-repeat;'; - $class = 'flowplayer ' . $skin . ' ' . ( ! empty ( $splash ) ? 'is-splash ' : '' ) . ( ! empty ( $logo_origin ) ? 'commercial ' : '' ); - $data_key = ( 0 < strlen ( $key ) ? 'data-key="' . $key . '" ' : ''); - $data_logo = ( 0 < strlen ( $key ) && 0 < strlen ( $logo ) ? 'data-logo="' . $logo . '" ' : '' ); - $data_analytics = ( 0 < strlen ( $ga_account_id ) ? 'data-analytics="' . $ga_account_id . '" ' : '' ); - $data_ratio = ( $ratio != 0 ? 'data-ratio="' . $ratio . '" ' : '' ); - - $modifier_classes = ( ( $fixed_controls == 'true' ) ? 'fixed-controls ' : '' ) . ( $coloring != 'default' ? $coloring : '' ); - $flowplayer_data = $data_key . $data_logo . $data_analytics . $data_ratio; - $attributes = ( ( $autoplay == 'true' ) ? 'autoplay ' : '' ) . ( ( $loop == 'true' ) ? 'loop ' : '' ) . ( isset ( $preload ) ? 'preload="' . $preload . '" ' : '' ) . ( ( $poster == 'true' ) ? 'poster' : '' ); - - // Shortcode output - $return = '
'; - ob_start(); - $return .= do_action( 'fp5_video_top' ); - $return .= ob_get_contents(); - ob_clean(); - $return .= ''; - ob_start(); - $return .= do_action( 'fp5_video_bottom' ); - $return .= ob_get_contents(); - ob_clean(); - $return .= '
'; - - // Extra options - $return .= ''; - - // Check if a video has been added before output - if ( $webm || $mp4 || $ogg ) { - return $return; - } - - } else { - - /** - * Old flowplayer shortcode - * - * @example [flowplayer splash="trailer_1080p.jpg" webm="trailer_1080p.webm" mp4="trailer_1080p.mp4" ogg="trailer_1080p.ogv" width="1920" height="1080" skin="functional" autoplay="true" loop="true" fixed="false" subtitles="bunny-en.vtt"] - */ - - // Attributes - extract( shortcode_atts( - array( - 'mp4' => '', - 'webm' => '', - 'ogg' => '', - 'skin' => 'minimalist', - 'splash' => '', - 'autoplay' => 'false', - 'loop' => 'false', - 'subtitles' => '', - 'width' => '', - 'height' => '', - 'fixed' => 'false' - ), - $atts - ) ); - - // set the options for the shortcode - pulled from the register-settings.php - $options = get_option('fp5_settings_general'); - $key = ( isset( $options['key'] ) ) ? $options['key'] : ''; - $logo = ( isset( $options['logo'] ) ) ? $options['logo'] : ''; - $ga_account_id = ( isset( $options['ga_account_id'] ) ) ? $options['ga_account_id'] : ''; - - // Shortcode processing - $ratio = ( ( $width != 0 && $height != 0 ) ? intval( $height ) / intval( $width ) : '' ); - $size = ( $fixed == 'true' && $width != '' && $height != '' ? 'width:' . $width . 'px; height:' . $height . 'px; ' : ( ( $width != 0 ) ? 'max-width:' . $width . 'px; ' : '' ) ); - $splash_style = 'background: #777 url(' . $splash . ') no-repeat;'; - $class = 'flowplayer ' . $skin . ' ' . ( ! empty ( $splash ) ? 'is-splash ' : '' ); - $data_key = ( 0 < strlen ( $key ) ? 'data-key="' . $key . '" ' : ''); - $data_logo = ( 0 < strlen ( $key ) && 0 < strlen ( $logo ) ? 'data-logo="' . $logo . '" ' : '' ); - $data_analytics = ( 0 < strlen ( $ga_account_id ) ? 'data-analytics="' . $ga_account_id . '" ' : '' ); - $data_ratio = ( $ratio != 0 ? 'data-ratio="' . $ratio . '" ' : '' ); - $flowplayer_data = $data_key . $data_logo . $data_analytics . $data_ratio; - $attributes = ( ( $autoplay == 'true' ) ? 'autoplay ' : '' ) . ( ( $loop == 'true' ) ? 'loop ' : '' ); - - // Shortcode output - $return = '
'; - ob_start(); - $return .= do_action( 'fp5_video_top' ); - $return .= ob_get_contents(); - ob_clean(); - $return .= ''; - ob_start(); - $return .= do_action( 'fp5_video_bottom' ); - $return .= ob_get_contents(); - ob_clean(); - $return .= '
'; - - return $return; - - } - -} - -// Register shortcode -add_shortcode( 'flowplayer', 'add_fp5_shortcode' ); \ No newline at end of file diff --git a/includes/class-flowplayer5.php b/includes/class-flowplayer5.php index 8826e36..049b7a3 100644 --- a/includes/class-flowplayer5.php +++ b/includes/class-flowplayer5.php @@ -29,7 +29,7 @@ class Flowplayer5 { * * @var string */ - protected $plugin_version = '1.2.0'; + protected $plugin_version = '1.3.0'; /** * Player version, used for cache-busting of style and script file references. @@ -71,6 +71,9 @@ private function __construct() { // Load plugin text domain add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); + // Add custom post type + add_action( 'init', array( $this, 'add_fp5_videos' ) ); + // Add file support add_filter( 'upload_mimes', array( $this, 'flowplayer_custom_mimes' ) ); @@ -164,6 +167,66 @@ public function load_plugin_textdomain() { } + /** + * Add video Custom Post Type for flowplayer5 + * + * @since 1.0.0 + */ + public function add_fp5_videos() { + + $labels = apply_filters( 'fp5_post_type_labels', array( + 'name' => _x( 'Videos', 'Post Type General Name', $this->plugin_slug ), + 'singular_name' => _x( 'Video', 'Post Type Singular Name', $this->plugin_slug ), + 'menu_name' => __( 'Videos', $this->plugin_slug ), + 'parent_item_colon' => __( 'Parent Video', $this->plugin_slug ), + 'all_items' => __( 'All Videos', $this->plugin_slug ), + 'view_item' => __( 'View Video', $this->plugin_slug ), + 'add_new_item' => __( 'Add New Video', $this->plugin_slug ), + 'add_new' => __( 'New Video', $this->plugin_slug ), + 'edit_item' => __( 'Edit Video', $this->plugin_slug ), + 'update_item' => __( 'Update Video', $this->plugin_slug ), + 'search_items' => __( 'Search Videos', $this->plugin_slug ), + 'not_found' => __( 'No Videos found', $this->plugin_slug ), + 'not_found_in_trash' => __( 'No Videos found in Trash', $this->plugin_slug ), + ) ); + + $supports = apply_filters( 'fp5_post_type_supports', array( + 'title', + ) ); + + $rewrite = apply_filters( 'fp5_post_type_rewrite', array( + 'slug' => __( 'video', $this->plugin_slug ), + 'with_front' => true, + 'pages' => true, + 'feeds' => true, + ) ); + + $args = apply_filters( 'fp5_post_type_args', array( + 'label' => __( 'flowplayer5', $this->plugin_slug ), + 'description' => __( 'Flowplayer Videos', $this->plugin_slug ), + 'labels' => $labels, + 'supports' => $supports, + 'hierarchical' => false, + 'public' => false, + 'show_ui' => true, + 'show_in_menu' => true, + 'show_in_nav_menus' => false, + 'show_in_admin_bar' => true, + 'menu_position' => 15, + 'menu_icon' => '', + 'can_export' => true, + 'has_archive' => false, + 'exclude_from_search' => true, + 'publicly_queryable' => true, + 'rewrite' => $rewrite, + 'query_var' => 'video', + 'capability_type' => 'page', + ) ); + + register_post_type( 'flowplayer5', $args ); + + } + /** * Add mime support for webm and vtt. * diff --git a/readme.txt b/readme.txt index 82c270e..01d9ad0 100644 --- a/readme.txt +++ b/readme.txt @@ -1,21 +1,37 @@ === Flowplayer 5 for WordPress === Contributors: flowplayerorg, grapplerulrich, anssi Donate link: http://flowplayer.org/download -Tags: video, html5 video, flowplayer, responsive, flowplayer5 +Tags: video, html5 video, flowplayer, responsive, flowplayer5, player Requires at least: 3.5 Tested up to: 3.7.1 Stable tag: trunk License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html -A HTML5 responsive video player plugin. From the makers of Flowplayer. +The video player for the web. HTML5 responsive video player. From the makers of Flowplayer. == Description == -The main features are: +Flowplayer 5 for WordPress lets you manage your self hosted videos easily and dispaly them with a simply and minimalistic player. This is the official Flowplayer.org WordPress Plugin. + += Includes Flowplayer Designer = + +[Video transcoding and hosting solution](http://flowplayer.org/designer/) integrated in the Flowplayer 5 for WordPress. + +* Maximum browser coverage with Flowplayer 5 using MP4 and WEBM encodings +* Optimal device compatibility with 640px video width +* Rigorously optimized encoder for best results +* Maximum streaming throughout on a global video network +* Completely free with Flowplayer watermark + +__The video upload in Flowplayer Designer is just the beginning…__ + +__Stay tuned for a BIG announcement at the end of this year!__ + += Main features = * One central place to manage all of your videos -* Video can be added using shortcodes e.g. [flowplayer5 id="1"] +* Video can be added using shortcodes e.g. [flowplayer5 id="123"] * Skin selection with three default Flowplayer skins: Minimalist, Functional and Playful * Show your video in any desired player size * [Subtitles support](http://flowplayer.org/docs/subtitles.html) @@ -24,17 +40,18 @@ The main features are: * Include a [splash image](http://flowplayer.org/docs/setup.html#splash) for your video * Video selection using the WordPress 3.5 Media Library * Detects the video dimensions for configuring the correct player size -* Commercial Flowplayer version can be enabled by supplying a [license key](http://flowplayer.org/download) -* Use your own logo watermark images when using the commercial Flowplayer version -== Credits == -The plugin can also be found on [GitHub](https://github.com/flowplayer/wordpress-flowplayer). += Commercial Flowplayer = -Thank you [Tom McFarlin](http://tommcfarlin.com/) for the [WordPress Plugin Boilerplate](https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate) +The commercial version is free of Flowplayer branding and you can use your logo. The commercial Flowplayer version can be enabled by supplying a [license key](http://flowplayer.org/download). -The settings code was adapted from [Easy Digital Downloads](https://github.com/easydigitaldownloads/Easy-Digital-Downloads) by [Pippin Williamson](http://pippinsplugins.com/) +== Credits == + +The plugin can also be found on [GitHub](https://github.com/flowplayer/wordpress-flowplayer). -The meta box settings was adapted from [Theme Foundation](http://themefoundation.com/wordpress-meta-boxes-guide/) by [Alex Mansfield](http://sackclothstudios.com/) +* Thank you [Tom McFarlin](http://tommcfarlin.com/) for the [WordPress Plugin Boilerplate](https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate) +* The settings code was adapted from [Easy Digital Downloads](https://github.com/easydigitaldownloads/Easy-Digital-Downloads) by [Pippin Williamson](http://pippinsplugins.com/) +* The meta box settings was adapted from [Theme Foundation](http://themefoundation.com/wordpress-meta-boxes-guide/) by [Alex Mansfield](http://sackclothstudios.com/) == Installation == @@ -66,7 +83,7 @@ You can configure Google Analytics, a Commercial Flowplayer license key and a cu == Frequently Asked Questions == -= Why use Flowplayer when there is video support in WordPress 3.6? = += Why use Flowplayer when there is video support since WordPress 3.6? = Flowplayer 5 for WordPress provides a video management system where you can manage all of your video froma centeral place. This plugin also allows for simple customisation of the videos. We are continuasly adding further features to the plugin. @@ -74,9 +91,9 @@ Flowplayer 5 for WordPress provides a video management system where you can mana If you want to load the Flowplayer assets (JS, CSS and SWF) for your site then you can download the files from [your account](http://flowplayer.org/account/). Create a new folder `flowplayer-commercial` in `wp-content`. Place the files in this new folder. The option in the settings to use Floplayer CDN should be disabled. -= API Issues? = += Flowplayer Designer API Issues? = -If you are unable to conect to the Flowplayer Designer videos, make sure you are conected to the internet and are logined in. You can add your username and password in the Video Settings. +If you are unable to connect to the Flowplayer Designer API, make sure you are conected to the internet and that you are logged in. You can login in the Settings. = Known Flowplayer Issues? = @@ -90,6 +107,56 @@ Nothing, other then it being disabled. Why would you want to do that? :-) If you do need to uninstall the plugin all of the data (Flowplayer videos and settings) will be deleted so that you do not have unnecessary data left on your database. Your media files will not be deleted. If you want to backup the Flowplayer videos that you have created you can easily export them under Tools -> Export -> Videos. += Developer Docs = + += Filters = + +* [fp5_filter_set_messages()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/admin/class-flowplayer5-admin.php#L246) +* [fp5_post_type_labels()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/includes/class-flowplayer5.php#L177) +* [fp5_post_type_supports()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/includes/class-flowplayer5.php#L193) +* [fp5_post_type_rewrite()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/includes/class-flowplayer5.php#L197) +* [fp5_post_type_args()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/includes/class-flowplayer5.php#L204) +* [fp5_filter_flowplayer_data()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/frontend/class-flowplayer5-shortcode.php#L168) +* [fp5_filter_has_shortcode()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/frontend/class-flowplayer5-frontend.php#L98) + += Actions = + +* [fp5_video_top()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/frontend/class-flowplayer5-shortcode.php#L170) +* [fp5_video_bottom()](https://github.com/flowplayer/wordpress-flowplayer/blob/master/frontend/class-flowplayer5-shortcode.php#L180) + += Examples = + +Here are a few code examples of things that have been asked. +`/** + * Allow flowplayer files should be loaded on the home page. + */ +function fp5_has_shortcode( $has_shortcode ) { + $has_shortcode = is_front_page(); + return $has_shortcode; +} +add_filter( 'fp5_filter_has_shortcode', 'fp5_has_shortcode' );` + +`/** + * Change post type arg to support hierarchical format. + */ +function fp5_post_type_arg_hierarchical( $args ) { + $args['supports'] = array( 'title', 'page-attributes' ); + $args['hierarchical'] = true; + return $args; +} +add_filter( 'fp5_post_type_args', 'fp5_post_type_arg_hierarchical' );` + +`/** + * Display links for single video posts and activate archive page. + */ +function fp5_post_type_arg_video_post( $args ) { + $args['public'] = true; + $args['show_in_nav_menus'] = true; + $args['has_archive'] = true; + return $args; +} +add_filter( 'fp5_post_type_args', 'fp5_post_type_arg_video_post' );` + == Screenshots == 1. Posting a video @@ -97,11 +164,18 @@ Why would you want to do that? :-) If you do need to uninstall the plugin all of == Changelog == +We have alot of plans for this plugin. You can see some of the up and comming features in the [roadmap](https://github.com/flowplayer/wordpress-flowplayer/issues?labels=enhancement&page=1&state=open) + += 1.3.0 = +* code improvements +* added a few extra filters +* updated [FAQ](http://wordpress.org/plugins/flowplayer5/faq/) with more code documention + = 1.2.0 = * added functionality to fetch videos from Flowplayer Designer directly in the admin area * added a few filters and actions * reorganisations of files and folders -* Update to Flowplayer 5.4.4 +* update to Flowplayer 5.4.4 * enable subtitle after being disabled in version 1.0.0 = 1.1.0 = @@ -142,6 +216,9 @@ Why would you want to do that? :-) If you do need to uninstall the plugin all of == Upgrade Notice == += 1.3.0 = +* code improvemnts + = 1.2.0 = * add videos from Flowplayer Designer directly in the admin area