Plugin Directory

Changeset 451514


Ignore:
Timestamp:
10/16/2011 05:29:26 AM (14 years ago)
Author:
thiudis
Message:

Fixed a bug where an error may have occurred if the type, width, or height attributes were not specified.

Location:
mobileme-movie/trunk
Files:
16 added
2 edited

Legend:

Unmodified
Added
Removed
  • mobileme-movie/trunk/mobileme-movie.php

    r412115 r451514  
    22/*
    33Plugin Name: MobileMe Movie
    4 Plugin URI: http://www.evolonix.com/wordpress/plugins/mobileme-movie/
     4Plugin URI: http://www.evolonix.com/wordpress/plugins/mobileme-movie
    55Description: This plugin allows you to insert a movie you have hosted on your MobileMe Gallery's website in your post or page. Use [mobileme url="http://gallery.me.com/appleid#albumid/moviename" type="m4v or mov" width="width" height="height"] to insert the movie. The easiest way to get the "url" is to copy it from your browser's address bar when viewing the movie on the Gallery's site. The "type" attribute is optional if the movie is an .m4v file, which it uses by default, but required for .mov files. If it doesn't work without specifying the "type" attribute, then try adding it with the "mov" value. The "width" and "height" attributes are optional and default to width="640" and height="360". If one is specified, the other must be also, otherwise it uses the defaults.
    6 Version: 1.1
     6Version: 1.2
    77Author: Evolonix
    88Author URI: http://www.evolonix.com
    99License: GPL2
     10Text Domain: mobileme-movie
    1011*/
    1112?>
     
    2930<?php
    3031
    31 if ( ! function_exists( 'get_mobileme_movie' ) ) :
     32// Install
     33// NOTE: References shortcode.
     34require_once(plugin_dir_path(__FILE__) . 'class-mobileme-movie-install.php');
     35register_activation_hook(__FILE__, array('MobileMe_Movie_Install', 'activate'));
     36register_deactivation_hook(__FILE__, array('MobileMe_Movie_Install', 'deactivate'));
    3237
    33 function get_mobileme_movie($atts) {
    34     $url = $atts["url"];
    35     $type = $atts["type"];
    36     if ( ! isset( $type ) ) {
    37         $type = 'm4v';
    38     }
    39     $width = $atts["width"];
    40     $height = $atts["height"];
    41     if ( ! isset( $width ) || ! isset( $height ) ) {
    42         $width = '640';
    43         $height = '360';
    44     }
    45    
    46     $url = str_replace('#', '/', $url);
    47     $url = stristr($url, "&amp;bgcolor=", true);
    48    
    49     $content = '<object id="GalleryMovie" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="' . $width . '" height="' . $height . '" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" class=""><param value="' . $url . '/video.' . $type . '" name="src"><object type="video/quicktime" data="' . $url . '/video.' . $type . '" id="GalleryMovieInner" width="' . $width . '" height="' . $height . '" class=""><param value="false" name="autoplay"><param value="true" name="controller"><param value="true" name="cache"><param value="false" name="kioskmode"><param value="false" name="showlogo"><param value="aspect" name="scale"><param value="true" name="saveembedtags"></object><param value="false" name="autoplay"><param value="true" name="controller"><param value="true" name="cache"><param value="false" name="kioskmode"><param value="false" name="showlogo"><param value="aspect" name="scale"><param value="true" name="saveembedtags"></object>';
    50     return $content;
    51 }
     38// I18n
     39add_action('init', function() { load_plugin_textdomain('mobileme-movie', false, basename(dirname(__FILE__)) . '/languages'); });
    5240
    53 endif; //get_mobileme_movie
     41// Admin
     42require_once(plugin_dir_path(__FILE__) . 'class-mobileme-movie-admin.php');
     43$mobileme_movie_admin = new MobileMe_Movie_Admin();
     44add_action('admin_init', array(&$mobileme_movie_admin, 'init'));
     45add_action('wp_before_admin_bar_render', array(&$mobileme_movie_admin, 'before_admin_bar_render')); // (optional)
    5446
    55 add_shortcode('mobileme', 'get_mobileme_movie');
     47// Front-end (optional)
     48require_once(plugin_dir_path(__FILE__) . 'class-mobileme-movie.php');
     49$mobileme_movie = new MobileMe_Movie();
     50add_action('plugins_loaded', array(&$mobileme_movie, 'init'));
     51
     52// Shortcode (optional)
     53require_once(plugin_dir_path(__FILE__) . 'class-mobileme-movie-shortcode.php');
     54$mobileme_movie_shortcode = new MobileMe_Movie_Shortcode();
     55add_shortcode('mobileme', array(&$mobileme_movie_shortcode, 'content'));
     56
    5657?>
  • mobileme-movie/trunk/readme.txt

    r412115 r451514  
    1818
    19191. Upload `mobileme-movie` to the `/wp-content/plugins/` directory
    20 2. Activate the plugin through the 'Plugins' menu in WordPress
    21 3. Place `[mobileme url="http://gallery.me.com/appleid#albumid/moviename" type="m4v or mov" width="width" height="height"]` in your posts or pages wherever you want the movie to display.
     201. Activate the plugin through the 'Plugins' menu in WordPress
     211. Place `[mobileme url="http://gallery.me.com/appleid#albumid/moviename" type="m4v or mov" width="width" height="height"]` in your posts or pages wherever you want the movie to display.
     22
     23== Frequently Asked Questions ==
     24
     25
     26
     27== Screenshots ==
     28
     29
    2230
    2331== Changelog ==
     32
     33= 1.2 =
     34* Fixed a bug where an error may have occurred if the type, width, or height attributes were not specified.
    2435
    2536= 1.1 =
     
    2839== Upgrade Notice ==
    2940
     41= 1.2 =
     42Upgrade to this version if you are trying to use the shortcode without a type, width, or height specified. Previous versions may have resulted in an error if any of the mentioned attributes were not provided.
     43
    3044= 1.1 =
    3145You should upgrade from 1.0 so that it is easier to understand what movie you are specifying. Before, where you would have specified [mobileme url:the_url] you now write it like [mobileme url="the_url"]. Much more cleaner and easier to read. You also had to specify &type=mov in the url before, where you now specify it in an attribute like type="mov".
     46
     47== Arbitrary section ==
     48
Note: See TracChangeset for help on using the changeset viewer.