| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 5 |
|
| 6 |
/** |
| 7 |
* Vimeography_Base class |
| 8 |
*/ |
| 9 |
class Vimeography_Base { |
| 10 |
public function __construct() { } |
| 11 |
|
| 12 |
/** |
| 13 |
* Holds any messages to be shown in the template. |
| 14 |
* |
| 15 |
* (default value: array()) |
| 16 |
* |
| 17 |
* @var array |
| 18 |
* @access public |
| 19 |
*/ |
| 20 |
public $messages = array(); |
| 21 |
|
| 22 |
/** |
| 23 |
* You don't know what this function does? Shame on you... |
| 24 |
* |
| 25 |
* @access public |
| 26 |
* @return html |
| 27 |
*/ |
| 28 |
public function vimeography() { |
| 29 |
if ( function_exists('do_shortcode') ) { |
| 30 |
return do_shortcode( "[vimeography id='" . $this->_gallery[0]->id . "']" ); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Returns the base admin url for the plugin. |
| 36 |
* |
| 37 |
* @access public |
| 38 |
* @static |
| 39 |
* @return string |
| 40 |
*/ |
| 41 |
public static function admin_url() { |
| 42 |
return get_admin_url().'admin.php?page=vimeography-'; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
/** |
| 47 |
* The path to the Vimeography Pro icon assets |
| 48 |
* |
| 49 |
* @return string |
| 50 |
*/ |
| 51 |
public function icons_url() { |
| 52 |
return VIMEOGRAPHY_URL . 'lib/admin/assets/img/icons/'; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Checks if the Vimeography Pro plugin is installed and activated |
| 57 |
* |
| 58 |
* @return boolean |
| 59 |
*/ |
| 60 |
public static function has_pro() { |
| 61 |
return is_plugin_active('vimeography-pro/vimeography-pro.php'); |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Gets the default settings created when Vimeography is installed. |
| 66 |
* |
| 67 |
* @access public |
| 68 |
* @return array |
| 69 |
*/ |
| 70 |
public function get_vimeography_defaults() { |
| 71 |
return get_option('vimeography_default_settings'); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Creates the theme list to show in the appearance tab. |
| 76 |
* |
| 77 |
* @access public |
| 78 |
* @return array |
| 79 |
*/ |
| 80 |
public function themes() { |
| 81 |
$themes = Vimeography::get_instance()->addons->themes; |
| 82 |
$activated_themes = get_option('vimeography_activation_keys'); |
| 83 |
|
| 84 |
$items = array(); |
| 85 |
foreach ($themes as $theme) { |
| 86 |
if (isset($this->_gallery)) |
| 87 |
$theme['active'] = strtolower($theme['name']) == strtolower($this->_gallery[0]->theme_name) ? TRUE : FALSE; |
| 88 |
|
| 89 |
if (is_array($activated_themes)) { |
| 90 |
foreach ($activated_themes as $activation) { |
| 91 |
if (strtolower($activation->plugin_name) == strtolower($theme['slug'])) |
| 92 |
$theme['activation_key'] = TRUE; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
$items[] = $theme; |
| 97 |
} |
| 98 |
|
| 99 |
return $items; |
| 100 |
} |
| 101 |
|
| 102 |
} |
| 103 |
|