/**
  * Output plugin settings page
  */
 public function plugin_settings()
 {
     $options = cvm_get_settings();
     $player_opt = cvm_get_player_settings();
     // fire up Vimeo class
     require_once CVM_PATH . 'includes/libs/vimeo.class.php';
     $vimeo = new CVM_Vimeo();
     if (!empty($options['vimeo_consumer_key']) && !empty($options['vimeo_secret_key'])) {
         if (empty($options['oauth_token'])) {
             // account token
             $token = $vimeo->get_unauth_token();
             if (!is_wp_error($token)) {
                 $options['oauth_token'] = $token;
                 update_option('_cvm_plugin_settings', $options);
             } else {
                 $authorize_error = $token->get_error_message();
             }
         }
     }
     include CVM_PATH . 'views/plugin_settings.php';
 }
Exemplo n.º 2
0
/**
 * Display update notices on plugin pages.
 */
function cvm_admin_messages()
{
    global $CVM_POST_TYPE;
    if (!isset($_GET['post_type']) || $CVM_POST_TYPE->get_post_type() != $_GET['post_type']) {
        return;
    }
    $messages = array();
    $o = cvm_get_settings();
    if (empty($o['vimeo_consumer_key']) || empty($o['vimeo_secret_key'])) {
        $messages[] = 'In order to be able to bulk import videos using Vimeo videos plugin, you must register on <a href="https://developer.vimeo.com/apps/new">Vimeo App page</a>.<br />
					   Please note that you must have a valid Vimeo account and also you must be logged into Vimeo before being able to register your app.<br />
					   After you registered your app, please visit <a href="' . menu_page_url('cvm_settings', false) . '#cvm_vimeo_keys">Settings page</a> and enter your Vimeo consumer and secret keys.';
    }
    if ($messages) {
        echo '<div class="update-nag"><span>' . implode('</span><hr /><span>', $messages) . '</span></div>';
    }
}
 /**
  * Constructor, fires up the parent by providing it with
  * client ID, secret and token, if any
  */
 public function __construct($args = array())
 {
     // set plugin settings
     $this->settings = cvm_get_settings();
     // set the token
     $token = null;
     if (!empty($this->settings['oauth_secret'])) {
         $token = $this->settings['oauth_secret'];
     } else {
         if (!empty($this->settings['oauth_token'])) {
             $token = $this->settings['oauth_token'];
         }
     }
     // set up redirect URL
     $redirect_url = admin_url('edit.php?post_type=' . cvm_get_post_type() . '&page=cvm_settings');
     // start the parent
     parent::__construct($this->settings['vimeo_consumer_key'], $this->settings['vimeo_secret_key'], $token, $redirect_url);
     if (!$args) {
         return;
     }
     $default = array('feed' => '', 'feed_id' => false, 'feed_type' => 'videos', 'sort' => 'new', 'page' => 1, 'per_page' => 20, 'response' => 'json');
     $this->params = wp_parse_args($args, $default);
 }