Пример #1
0
 public function __construct()
 {
     $this->updater = Vimeography::get_instance()->updater;
     add_action('vimeography_action_activate_license', array($this, 'activate_license'));
     add_action('vimeography_action_deactivate_license', array($this, 'deactivate_license'));
     self::_remove_duplicate_keys();
 }
Пример #2
0
 /**
  * Retrieve and set the meta headers for the current active theme.
  *
  * @param array  Gallery settings
  */
 protected function _set_active_theme($settings)
 {
     if (!isset($settings['theme'])) {
         throw new Vimeography_Exception(__('You must specify a theme in either the admin panel or the shortcode.', 'vimeography'));
     }
     $vimeography = Vimeography::get_instance();
     $vimeography->addons->set_active_theme($settings['theme']);
     $this->_active_theme = $vimeography->addons->active_theme;
 }
Пример #3
0
 /**
  * Runs before every test.
  * Think of it as emulating what would usually happen once the plugin is activated on a Wordpress site.
  *
  */
 public function setUp()
 {
     parent::setUp();
     $this->_vimeography = \Vimeography::get_instance();
     // $z->installation_housekeeping();
     // update_option('zam_options', array(
     //     'zam_twitter_id' => 'Wern_Ancheta'
     // ));
     //update_option('vimeography_db_version', VIMEOGRAPHY_VERSION);
 }
Пример #4
0
 /**
  * Runs before every test.
  * Think of it as emulating what would usually happen once the plugin is activated on a Wordpress site.
  */
 public function setUp()
 {
     parent::setUp();
     $this->_class = new \Vimeography_Update();
     $this->_addons = \Vimeography::get_instance()->addons;
     $entry = new \stdClass();
     $entry->activation_key = 'ABCDEFED12345678';
     $entry->product_name = 'Journey';
     $entry->plugin_name = 'vimeography-journey';
     $this->_fixture_activation_keys[] = $entry;
     $bugsauce = array('name' => 'Bugsauce', 'theme-uri' => 'vimeography.com/themes/bugsauce', 'version' => '1.0.2', 'description' => 'cool theme.', 'author' => 'Dave Kiss', 'author-uri' => 'http://davekiss.com', 'basename' => 'vimeography-bugsauce/vimeography-bugsauce.php', 'slug' => 'vimeography-bugsauce', 'thumbnail' => 'path/to/thumbnail.jpg', 'file_path' => realpath(dirname(__FILE__) . '/../fixtures/vimeography-journey/vimeography-journey.php'), 'plugin_path' => realpath(dirname(__FILE__) . '/../fixtures/vimeography-journey/'), 'type' => 'theme', 'partials_path' => 'path/to/partials', 'settings_file' => realpath(dirname(__FILE__) . '/../fixtures/vimeography-journey/settings.php'));
     $journey = array('name' => 'Journey', 'theme-uri' => 'vimeography.com/themes/journey', 'version' => '1.0.5', 'description' => 'cool theme.', 'author' => 'Dave Kiss', 'author-uri' => 'http://davekiss.com', 'basename' => 'vimeography-journey/vimeography-journey.php', 'slug' => 'vimeography-journey', 'thumbnail' => 'path/to/thumbnail.jpg', 'file_path' => realpath(dirname(__FILE__) . '/../fixtures/vimeography-journey/vimeography-journey.php'), 'plugin_path' => realpath(dirname(__FILE__) . '/../fixtures/vimeography-journey/'), 'type' => 'theme', 'partials_path' => 'path/to/partials', 'settings_file' => realpath(dirname(__FILE__) . '/../fixtures/vimeography-journey/settings.php'));
     $this->_addons->themes[0] = $bugsauce;
     $this->_addons->themes[] = $journey;
     $this->_addons->installed_addons[0] = $bugsauce;
     $this->_addons->installed_addons[] = $journey;
 }
Пример #5
0
 /**
  * Creates the theme list to show in the appearance tab.
  *
  * @access public
  * @return array
  */
 public function themes()
 {
     $themes = Vimeography::get_instance()->addons->themes;
     $activated_themes = get_option('vimeography_activation_keys');
     $items = array();
     foreach ($themes as $theme) {
         if (isset($this->_gallery)) {
             $theme['active'] = strtolower($theme['name']) == strtolower($this->_gallery[0]->theme_name) ? TRUE : FALSE;
         }
         if (is_array($activated_themes)) {
             foreach ($activated_themes as $activation) {
                 if (strtolower($activation->plugin_name) == strtolower($theme['slug'])) {
                     $theme['activation_key'] = TRUE;
                 }
             }
         }
         $items[] = $theme;
     }
     return $items;
 }
Пример #6
0
 /**
  * [_set_active_theme description]
  * @since   1.3
  * @param   string $theme_name [description]
  * @return  array Theme meta
  */
 private static function _set_active_theme($theme_name)
 {
     $vimeography = Vimeography::get_instance();
     $vimeography->addons->set_active_theme($theme_name);
     return $vimeography->addons->active_theme;
 }
Пример #7
0
 /**
  * Add a plugins page message to any Vimeography add-ons that are installed,
  * but that do not have an activation key associated with the installation.
  *
  * @return void
  */
 public function vimeography_check_for_missing_activation_keys()
 {
     $addons = Vimeography::get_instance()->addons->installed_addons;
     if (!empty($addons)) {
         // If the activation key is not found for the installed plugin,
         // add the plugin message hook
         $addons_with_missing_keys = array_filter($addons, array($this, 'vimeography_is_addon_missing_activation_key'));
         if (!empty($addons_with_missing_keys)) {
             foreach ($addons_with_missing_keys as $plugin) {
                 $hook = 'after_plugin_row_' . $plugin['basename'];
                 add_action($hook, array($this, 'vimeography_addon_update_message'), 10, 2);
             }
         }
     }
 }
Пример #8
0
                $url = array_values(array_filter(explode('/', $url['path']), 'strlen'));
                // If the array doesn't contain one of the following strings, it
                // must be either a user or a video
                if (in_array($url[0], array('album', 'channels', 'groups', 'categories')) !== TRUE) {
                    if (is_numeric($url[0])) {
                        array_unshift($url, 'videos');
                    } else {
                        array_unshift($url, 'users');
                        if (isset($url[2])) {
                            if ($host != 'vimeo.com') {
                                // Convert /users/username/portfolio_name to /users/username/portfolios/portfolio_name
                                array_splice($url, 2, 0, array('portfolios'));
                            } elseif ($url[2] === 'videos') {
                                // Remove 'videos' from '/users/username/videos'
                                unset($url[2]);
                            }
                        }
                    }
                }
                // Make sure the resource is plural
                $url[0] = rtrim($url[0], 's') . 's';
                $resource = '/' . implode('/', $url);
                return $resource;
            } else {
                throw new Vimeography_Exception(__('That site doesn\'t look like a valid link to a Vimeo collection.', 'vimeography'));
            }
        }
    }
}
Vimeography::get_instance();
Пример #9
0
 /**
  * Retrieve and store more information about any saved license keys.
  *
  * @return void
  */
 public static function vimeography_update_db_to_1_2_8()
 {
     if (version_compare(self::$_version, '1.2.8', '<')) {
         $licenses = get_site_option('vimeography_activation_keys');
         if (!class_exists('Vimeography_Update')) {
             require_once VIMEOGRAPHY_PATH . 'lib/update.php';
             $updater = new Vimeography_Update();
         } else {
             $updater = Vimeography::get_instance()->updater;
         }
         if ($licenses) {
             foreach ($licenses as $index => $license) {
                 // Retrieve more information about the license
                 $result = $updater->check_license($license);
                 $license->status = $result->license;
                 $license->expires = $result->expires;
                 $license->limit = $result->license_limit;
                 $license->activations_left = $result->activations_left;
                 $licenses[$index] = $license;
             }
             update_site_option('vimeography_activation_keys', $licenses);
         }
     }
 }