| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 5 |
|
| 6 |
if ( ! function_exists ( 'class_alias' ) ) { |
| 7 |
function class_alias($original, $alias) { |
| 8 |
$newclass = create_function('','class '.$alias.' extends '.$original.' {}'); |
| 9 |
$newclass(); |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
/** |
| 14 |
* Handle deprecated functions and backwards compatibility |
| 15 |
*/ |
| 16 |
class Vimeography_Deprecated { |
| 17 |
|
| 18 |
/** |
| 19 |
* [$_vimeography_pro_version description] |
| 20 |
* @var [type] |
| 21 |
*/ |
| 22 |
protected $_vimeography_pro_version; |
| 23 |
|
| 24 |
public function __construct() { |
| 25 |
$this->_vimeography_pro_version = get_site_option('vimeography_pro_db_version'); |
| 26 |
|
| 27 |
add_action('init', array($this, 'add_vimeo_library_class_alias') ); |
| 28 |
add_action('vimeography/deprecated/reload-pro-renderer', array($this, 'reload_pro_renderer_variables'), 10, 3 ); |
| 29 |
add_action('vimeography/deprecated/reload-pro-gallery-settings', array($this, 'reload_pro_gallery_settings'), 1, 2); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Adds a class alias for the un-namespaced Vimeo library class name |
| 34 |
*/ |
| 35 |
public function add_vimeo_library_class_alias() { |
| 36 |
if ( $this->_vimeography_pro_version && version_compare($this->_vimeography_pro_version, '0.7.1', '<' ) ) { |
| 37 |
@class_alias('Vimeography_Vimeo', 'Vimeo'); |
| 38 |
} |
| 39 |
|
| 40 |
if ( $this->_vimeography_pro_version && version_compare($this->_vimeography_pro_version, '2.0', '<') ) { |
| 41 |
@class_alias('Vimeography\Vimeo', 'Vimeography_Vimeo'); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Reload the Vimeography Pro constructor to ensure |
| 47 |
* that all of the necessary view variables exist. |
| 48 |
* |
| 49 |
* Called from lib/shortcode.php |
| 50 |
* |
| 51 |
* @since 1.2 |
| 52 |
* @supports Vimeography Pro < 0.7 |
| 53 |
* @return object $renderer |
| 54 |
*/ |
| 55 |
public function reload_pro_renderer_variables($renderer, $gallery_settings, $gallery_id) { |
| 56 |
|
| 57 |
if ( $this->_vimeography_pro_version && version_compare($this->_vimeography_pro_version, '0.7', '<' ) ) { |
| 58 |
$renderer->__construct($gallery_settings, $gallery_id); |
| 59 |
} |
| 60 |
|
| 61 |
return $renderer; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Reload the Pro gallery settings on the edit screen just before |
| 66 |
* they are sent to the gallery editor. |
| 67 |
* |
| 68 |
* @since 1.2 |
| 69 |
* @supports Vimeography Pro < 0.7 |
| 70 |
* @return array $gallery |
| 71 |
*/ |
| 72 |
public function reload_pro_gallery_settings($klass, $gallery) { |
| 73 |
|
| 74 |
if ( $this->_vimeography_pro_version && version_compare($this->_vimeography_pro_version, '0.7', '<' ) ) { |
| 75 |
$klass->__construct(); |
| 76 |
} |
| 77 |
|
| 78 |
return $gallery; |
| 79 |
} |
| 80 |
|
| 81 |
} |
| 82 |
|