Plugin Directory

Changeset 1296909


Ignore:
Timestamp:
11/29/2015 07:07:42 PM (10 years ago)
Author:
molven
Message:

upgrade at version 2.0

Location:
os-media/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • os-media/trunk/classes/OSmedia-base.php

    r1296549 r1296909  
    156156         */
    157157        public function activate( $network_wide ) {
    158             // create default options if not exists
    159             if( @get_option(OSmedia_OPTS) ) {
    160                 $opts = @get_option(OSmedia_OPTS);
    161             }           
    162             if( !isset($opts) || !is_array($opts) ) {
    163                 update_option( OSmedia_OPTS, OSmedia_Settings::get_default_settings() );
    164             }
    165 
    166             // add demp CPT
    167             $post_id = wp_insert_post(array (
    168                 'post_type' => 'osmedia_cpt',
    169                 'post_title' => 'OSmedia demo CPT',
    170                 'post_content' => 'OSmedia demo CPT content',
    171                 'post_status' => 'publish',
    172                 'comment_status' => 'closed',   // if you prefer
    173                 'ping_status' => 'closed',      // if you prefer
    174             ));
    175             if ($post_id) {
    176                 // insert post meta
    177                 add_post_meta($post_id, 'OSmedia_mp4', 'https://s3-eu-west-1.amazonaws.com/openstream.tv/SEP/OSmedia_demo1.mp4');
    178                 add_post_meta($post_id, 'OSmedia_webm', 'https://s3-eu-west-1.amazonaws.com/openstream.tv/SEP/OSmedia_demo1.webm');
    179                 add_post_meta($post_id, 'OSmedia_autoplay', 'on');
    180                 add_post_meta($post_id, 'OSmedia_loop', 'on');
    181             }
    182 
    183158
    184159            if ( $network_wide && is_multisite() ) {
  • os-media/trunk/classes/OSmedia-post-admin.php

    r1296549 r1296909  
    448448            }           
    449449
    450             echo '<pre> DATA_MODEL: post_id->'.$post_id.'  ';var_dump($out);  echo '</pre>'; // MONITOR
     450            // echo '<pre> DATA_MODEL: post_id->'.$post_id.'  ';var_dump($out);  echo '</pre>'; // MONITOR
    451451            return $out;
    452452        }
     
    622622            self::create_taxonomies();
    623623
     624            // add demo CPT
     625            $cpt_id = @wp_insert_post(array (
     626                'post_type' => 'osmedia_cpt',
     627                'post_title' => 'OSmedia Demo Featured Video',
     628                'post_content' => 'OSmedia Demo CPT - Featured Video Content',
     629                'post_status' => 'publish',
     630                'comment_status' => 'closed',
     631                'ping_status' => 'closed'
     632            ));
     633            if ($cpt_id && !is_wp_error( $cpt_id ) ) {
     634                add_post_meta($cpt_id, 'OSmedia_mp4', 'https://s3-eu-west-1.amazonaws.com/openstream.tv/SEP/OSmedia_demo1.mp4');
     635                add_post_meta($cpt_id, 'OSmedia_webm', 'https://s3-eu-west-1.amazonaws.com/openstream.tv/SEP/OSmedia_demo1.webm');
     636                add_post_meta($cpt_id, 'OSmedia_autoplay', 'on');
     637                add_post_meta($cpt_id, 'OSmedia_loop', 'on');
     638            }
     639
     640            // add featured video page
     641            $page_id = @wp_insert_post(array (
     642                'post_type' => 'page',
     643                'post_title' => 'OSmedia Featured Video',
     644                'post_status' => 'publish',
     645                'comment_status' => 'closed',
     646                'ping_status' => 'closed'
     647            ));
     648            if ( $page_id && !is_wp_error( $page_id ) ){
     649                update_post_meta( $page_id, '_wp_page_template', 'featured_video_list.php' );
     650            }
    624651        }
    625652
     
    639666         */
    640667        public function init() {
     668
    641669            self::get_metabox_params();
    642670
  • os-media/trunk/classes/OSmedia-post-frontend.php

    r1296137 r1296909  
    1010    class OSmedia_Post_Frontend extends OSmedia_Module  {
    1111
    12         // public static $OSmedia_postmeta = array();
    13 
    14         // private static $options = array();
    15 
    1612        public static $video_ext = array('mp4', 'ogg', 'ogv', 'webm'); // Arrays are not allowed in class constants in PHP :(
    1713
     
    3430        /**
    3531         * Metodo per il confronto dei parametri del singolo post (meta), con quelli generali (option).
    36          * Se il post è nuovo (is_edit_page('new')) i parametri meta INIZIALI sono pescati dalle options generali.
    37          * Se si edita un post esistente sono pescati dai suoi custom field
     32         *
    3833         *
    3934         * @mvc Model
     
    9388            }elseif( $atts['type'] == 'vimeo' ) {                                                               // 4. Vimeo
    9489                $view = 'frontend/vimeo.php';
     90            /* RETROCOMP ////////////////
     91            }elseif( $atts['type'] == 'old_version' ) {
     92                echo 'GUHGHGIHGIHGIHGIGIHGIHGIHGIHGIGI'.do_shortcode( $atts ); 
     93            ////////////////////////////*/
    9594            }else{                                                                                              // 5. standard HTML5
    9695                $view = 'frontend/standard.php';
     
    128127            // echo '<pre> SHORTCODE:'; var_dump($shortcode); echo '</pre>';
    129128
    130             $base_atts = self::OSmedia_data_model();    // carica i dati e li elabora pescanda dai postmeta (solo CPT)
     129            $base_atts = self::OSmedia_data_model();    // carica i dati e li elabora pescando dai postmeta (solo CPT)
    131130            // echo '<pre> BASE_ATTS:'; var_dump($base_atts); echo '</pre>';
    132131
     
    183182                if( !empty($atts['vimeo']) ) $atts['type'] ='vimeo';
    184183            }   
     184            // if( isset($atts['feat']) && $atts['feat'] == 'true' ) $atts['type'] = 'old_version'; // retrocomp.
    185185
    186186            // poster image controller
     
    190190                $post_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    191191                if( isset($post_thumbnail[0]) ) $atts['img'] = $post_thumbnail[0];
    192                 else $atts['img'] = $filepath . $file. ".jpg";
     192                elseif( $filepath && $file ) $atts['img'] = $filepath . $file. ".jpg";
    193193            }elseif( isset($atts['yt_vjs']) && $atts['yt_vjs'] =='true' && isset($atts['type']) && $atts['type'] == 'youtube'){
    194194                $atts['img'] = 'img'; // temporary trick
     
    338338         */
    339339        public function register_hook_callbacks() {
    340             // global $post; // NON FUNZIONA: DA CAPIRE PERCHÈ
    341             //////////////////// CPT & POST
    342 
    343             add_action( 'init', array( $this,           'init' ) );
    344 
    345             // RIMOSSO PER AVERE MAGGIORE CONTROLLO NEL TEMPLATE: NEI CPT IL VIDEOPLAYER È GENERATO DELLA FUNZIONE OSmedia_videoplayer()
     340
     341            add_action( 'init', array( $this, 'init' ) );
    346342            // add_action( 'get_template_part_content',     __CLASS__ . '::get_videoplayer' );
    347343            // soluz. provvisoria
    348344            if( isset(self::$OSmedia_options['OSmedia_shortcode']) )
    349                 add_shortcode( self::$OSmedia_options['OSmedia_shortcode'],     __CLASS__ . '::get_videoplayer' );
    350             // RETRO-COMPATIBILITA'
    351             add_shortcode( 'youtube',   __CLASS__ . '::get_videoplayer' );
     345                add_shortcode( self::$OSmedia_options['OSmedia_shortcode'], __CLASS__ . '::get_videoplayer' );
     346            // RETRO-COMPATIBILITY
     347            add_shortcode( 'youtube', __CLASS__ . '::get_videoplayer' );
    352348
    353349            add_filter( 'template_include', __CLASS__ . '::include_template_function', 1, 2);
     
    379375         */
    380376        public function init() {
    381             // OSmedia_Post_Admin::get_options();
     377
    382378            OSmedia_Post_Admin::get_metabox_params();
     379
    383380        }
    384381
  • os-media/trunk/classes/OSmedia-settings.php

    r1296138 r1296909  
    135135         */
    136136        public function activate( $network_wide ) {
     137
     138            // create default options if not exists
     139            if( @get_option(OSmedia_OPTS) ) {
     140                $opts = @get_option(OSmedia_OPTS);
     141            }           
     142            if( !isset($opts) || !is_array($opts) ) {
     143                update_option( OSmedia_OPTS, OSmedia_Settings::get_default_settings() );
     144            }
    137145
    138146        }
  • os-media/trunk/layout/osmedia_cpt-twentyfifteen.php

    r1296137 r1296909  
    1717        <?php while ( have_posts() ) : the_post(); ?>
    1818
    19         <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     19        <article style="padding-top:0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     20
     21            <header class="entry-header"></header><!-- .entry-header -->
    2022
    2123            <?php  echo OSmedia_video() ?>
    22 
    23             <header class="entry-header">               
    24             </header><!-- .entry-header -->
    2524
    2625            <div class="entry-content" style="margin-top:20px">
  • os-media/trunk/readme.txt

    r1296780 r1296909  
    2121There are two areas in wich can be insert multimedia content:
    2222
    23 * **Custom Post Type for "Featured Video"**, ideal for video platforms where we have a single "Featured video" for each page (like WP Featured Images). The best way to display video is to use a specific template (like **Osmedia-theme**, specifically designed for this plugin) or insert the function **Osmedia_video()** in your theme. This content are also optimized for latests WP theme like Twenty Fifteen or Twenty Fourteen.
     23* **Custom Post Type for "Featured Video"**, specifically dedicated to video platforms where we have a single "Featured video" for each page (like WP Featured Images).
    2424* in normal post or page with the classic **shortcodes** added to the post textarea.
    2525
    26 There are 5 possibility to insert and stream on-demand video:
     26There are 5 possibility to insert video:
    2727
    2828* from **self-hosted local** WP installation: you must place the PATH of this local video resource (/opt/lampp/htdocs/wp/wp-content/uploads/video) **[main file selector]**
     
    3232* from the platform **Youtube & Vimeo**. **[dedicated input]**
    3333
     34**OSmedia Featured video - Custom Post Type:**
     35
     36For this type of page, the best way to display video is to use a specific template (like **Osmedia-theme**, specifically designed for this plugin) or you can insert the function **Osmedia_video()** in your theme. This content are also optimized for latests WP theme like Twenty Fifteen or Twenty Fourteen, automatically detected by this plugin, which loads the dedicated layout for CPT content. You can also customize the file **layout/osmedia_cpt.php** loaded by default, if your theme was not recognized.
     37
    3438**Image poster for video:**
    3539
    3640* you can place URL in shortcode for post/page.
    3741* In custom Post Field you can use the Featured Image, otherwise the plugin try to load file from the same directory with the same name and .jpg extension.
     42 
    3843
    3944**Option settings:**
     
    5156**Variables list:**
    5257http://www.mariomarino.eu/wp-content/uploads/2013/10/OSmedia_vars.pdf
     58
     59**IMPORTANT NOTE about old version:**
     60The old post / page create through old version of this plugin MUST be simply manually reloaded in Admin Area and, when appear the video data on the metabox form, click "Generate Shortcode" button. This because in the new version in post and page, video are displayed only through shortcode.
    5361
    5462== Installation ==
Note: See TracChangeset for help on using the changeset viewer.