/**
  * Handles form submission.
  *
  * @return array An array of failure messages if there's a problem, otherwise null.
  */
 public final function onSubmit()
 {
     $hrps = tubepress_impl_patterns_sl_ServiceLocator::getHttpRequestParameterService();
     $id = $this->getId();
     if ($this->_optionDescriptor->isBoolean()) {
         return $this->sendToStorage($id, $hrps->hasParam($id));
     }
     if (!$hrps->hasParam($id)) {
         /* not submitted. */
         return null;
     }
     $value = $hrps->getParamValue($id);
     return $this->sendToStorage($id, $this->convertIncomingStringValueToStorageFormat($value));
 }
 /**
  * Fetch all the option descriptors from this provider.
  *
  * @return tubepress_spi_options_OptionDescriptor[]
  */
 public function getOptionDescriptors()
 {
     $environmentDetector = tubepress_impl_patterns_sl_ServiceLocator::getEnvironmentDetector();
     $toReturn = array();
     if ($environmentDetector->isWordPress()) {
         $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_wordpress_api_const_options_names_WordPress::WIDGET_TITLE);
         $option->setDefaultValue('TubePress');
         $toReturn[] = $option;
         $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_wordpress_api_const_options_names_WordPress::WIDGET_SHORTCODE);
         $option->setDefaultValue('[tubepress thumbHeight=\'105\' thumbWidth=\'135\']');
         $toReturn[] = $option;
     }
     return $toReturn;
 }
 /**
  * Fetch all the option descriptors from this provider.
  *
  * @return tubepress_spi_options_OptionDescriptor[]
  */
 function getOptionDescriptors()
 {
     $toReturn = array();
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_jwplayer_api_const_options_names_Embedded::COLOR_BACK);
     $option->setDefaultValue('FFFFFF');
     $option->setLabel('Background color');
     //>(translatable)<                                                                                                                                                                                                                                 //>(translatable)<
     $option->setDescription(sprintf('Default is %s', "FFFFFF"));
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexColor);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_jwplayer_api_const_options_names_Embedded::COLOR_FRONT);
     $option->setDefaultValue('000000');
     $option->setLabel('Front color');
     //>(translatable)<                                                                                                                                                                                                                                 //>(translatable)<
     $option->setDescription(sprintf('Default is %s', "000000"));
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexColor);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_jwplayer_api_const_options_names_Embedded::COLOR_LIGHT);
     $option->setDefaultValue('000000');
     $option->setLabel('Light color');
     //>(translatable)<                                                                                                                                                                                                                                 //>(translatable)<
     $option->setDescription(sprintf('Default is %s', "000000"));
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexColor);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_jwplayer_api_const_options_names_Embedded::COLOR_SCREEN);
     $option->setDefaultValue('000000');
     $option->setLabel('Screen color');
     //>(translatable)<                                                                                                                                                                                                                                 //>(translatable)<
     $option->setDescription(sprintf('Default is %s', "000000"));
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexColor);
     $toReturn[] = $option;
     return $toReturn;
 }
 /**
  * Register a new option descriptor for use by TubePress.
  *
  * @param tubepress_spi_options_OptionDescriptor $optionDescriptor The new option descriptor.
  *
  * @return void
  */
 private function _registerOptionDescriptor(tubepress_spi_options_OptionDescriptor $optionDescriptor)
 {
     $name = $optionDescriptor->getName();
     if (isset($this->_nameToOptionDescriptorMap[$name])) {
         if ($this->_shouldLog) {
             $this->_logger->warn($optionDescriptor->getName() . ' is already registered as an option descriptor');
         }
         return;
     }
     $optionRegistrationEvent = new tubepress_spi_event_EventBase($optionDescriptor);
     $eventDispatcher = tubepress_impl_patterns_sl_ServiceLocator::getEventDispatcher();
     $eventDispatcher->dispatch(tubepress_api_const_event_EventNames::OPTIONS_DESCRIPTOR_REGISTRATION, $optionRegistrationEvent);
     $this->_nameToOptionDescriptorMap[$name] = $optionDescriptor;
 }
 private function _noChangeBetweenIncomingAndCurrent($filteredValue, tubepress_spi_options_OptionDescriptor $descriptor)
 {
     $boolean = $descriptor->isBoolean();
     $currentValue = $this->fetch($descriptor->getName());
     if ($boolean) {
         return (bool) $filteredValue === (bool) $currentValue;
     }
     return $currentValue == $filteredValue;
 }
 /**
  * Fetch all the option descriptors from this provider.
  *
  * @return tubepress_spi_options_OptionDescriptor[]
  */
 public function getOptionDescriptors()
 {
     $_valueMapTime = array(tubepress_addons_youtube_api_const_options_values_YouTube::TIMEFRAME_ALL_TIME => 'all time', tubepress_addons_youtube_api_const_options_values_YouTube::TIMEFRAME_TODAY => 'today');
     $_regexWordChars = '/\\w+/';
     $_regexYouTubeVideo = '/[a-zA-Z0-9_-]{11}/';
     $toReturn = array();
     /**
      * EMBEDDED PLAYER OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::AUTOHIDE);
     $option->setLabel('Fade progress bar and video controls');
     //>(translatable)<
     $option->setDefaultValue(tubepress_addons_youtube_api_const_options_values_YouTube::AUTOHIDE_HIDE_BAR_SHOW_CONTROLS);
     $option->setAcceptableValues(array(tubepress_addons_youtube_api_const_options_values_YouTube::AUTOHIDE_HIDE_BAR_SHOW_CONTROLS => 'Fade progress bar only', tubepress_addons_youtube_api_const_options_values_YouTube::AUTOHIDE_HIDE_BOTH => 'Fade progress bar and video controls', tubepress_addons_youtube_api_const_options_values_YouTube::AUTOHIDE_SHOW_BOTH => 'Disable fading - always show both'));
     $option->setDescription('After video playback begins, choose which elements (if any) of the embedded video player to automatically hide.');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::CLOSED_CAPTIONS);
     $option->setLabel('Show closed captions by default');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $option->setProOnly();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::DISABLE_KEYBOARD);
     $option->setLabel('Disable keyboard controls');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $option->setProOnly();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::FULLSCREEN);
     $option->setLabel('Allow fullscreen playback.');
     //>(translatable)<
     $option->setDefaultValue(true);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::MODEST_BRANDING);
     $option->setDefaultValue(true);
     $option->setLabel('"Modest" branding');
     //>(translatable)<
     $option->setDescription('Hide the YouTube logo from the control area.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::SHOW_ANNOTATIONS);
     $option->setLabel('Show video annotations by default');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $option->setProOnly();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::SHOW_CONTROLS);
     $option->setLabel('Show or hide video controls');
     //>(translatable)<
     $option->setDefaultValue(tubepress_addons_youtube_api_const_options_values_YouTube::CONTROLS_SHOW_IMMEDIATE_FLASH);
     $option->setProOnly();
     $option->setAcceptableValues(array(tubepress_addons_youtube_api_const_options_values_YouTube::CONTROLS_SHOW_IMMEDIATE_FLASH => 'Show controls - load Flash player immediately', tubepress_addons_youtube_api_const_options_values_YouTube::CONTROLS_SHOW_DELAYED_FLASH => 'Show controls - load Flash player when playback begins', tubepress_addons_youtube_api_const_options_values_YouTube::CONTROLS_HIDE => 'Hide controls'));
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::SHOW_RELATED);
     $option->setDefaultValue(true);
     $option->setLabel('Show related videos');
     //>(translatable)<
     $option->setDescription('Toggles the display of related videos after a video finishes.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Embedded::THEME);
     $option->setLabel('YouTube player theme');
     //>(translatable)<
     $option->setAcceptableValues(array(tubepress_addons_youtube_api_const_options_values_YouTube::PLAYER_THEME_DARK => 'Dark', tubepress_addons_youtube_api_const_options_values_YouTube::PLAYER_THEME_LIGHT => 'Light'));
     $option->setDefaultValue(tubepress_addons_youtube_api_const_options_values_YouTube::PLAYER_THEME_DARK);
     $option->setProOnly();
     $toReturn[] = $option;
     /**
      * FEED OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Feed::DEV_KEY);
     $option->setDefaultValue('AI39si5uUzupiQW9bpzGqZRrhvqF3vBgRqL-I_28G1zWozmdNJlskzMDQEhpZ-l2RqGf_6CNWooL96oJZRrqKo-eJ9QO_QppMg');
     $option->setLabel('YouTube API Developer Key');
     //>(translatable)<
     $option->setDescription('YouTube will use this developer key for logging and debugging purposes if you experience a service problem on their end. You can register a new client ID and developer key <a href="http://code.google.com/apis/youtube/dashboard/" target="_blank">here</a>. Don\'t change this unless you know what you\'re doing.');
     //>(translatable)<
     $option->setValidValueRegex('/[\\w-]+/');
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Feed::EMBEDDABLE_ONLY);
     $option->setDefaultValue(true);
     $option->setLabel('Only retrieve embeddable videos');
     //>(translatable)<
     $option->setDescription('Some videos have embedding disabled. Checking this option will exclude these videos from your galleries.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Feed::FILTER);
     $option->setLabel('Filter "racy" content');
     //>(translatable)<
     $option->setDescription('Don\'t show videos that may not be suitable for minors.');
     //>(translatable)<
     $option->setDefaultValue(tubepress_addons_youtube_api_const_options_values_YouTube::SAFESEARCH_MODERATE);
     $option->setAcceptableValues(array(tubepress_addons_youtube_api_const_options_values_YouTube::SAFESEARCH_NONE => 'none', tubepress_addons_youtube_api_const_options_values_YouTube::SAFESEARCH_MODERATE => 'moderate', tubepress_addons_youtube_api_const_options_values_YouTube::SAFESEARCH_STRICT => 'strict'));
     $toReturn[] = $option;
     /**
      * GALLERY SOURCE OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_GallerySource::YOUTUBE_MOST_POPULAR_VALUE);
     $option->setDefaultValue(tubepress_addons_youtube_api_const_options_values_YouTube::TIMEFRAME_TODAY);
     $option->setAcceptableValues($_valueMapTime);
     $option->setLabel('Most-viewed YouTube videos from');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_GallerySource::YOUTUBE_RELATED_VALUE);
     $option->setLabel('Videos related to this YouTube video');
     //>(translatable)<
     $option->setValidValueRegex($_regexYouTubeVideo);
     $option->setDefaultValue('P9M__yYbsZ4');
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_GallerySource::YOUTUBE_PLAYLIST_VALUE);
     $option->setDefaultValue('F679CB240DD4C112');
     $option->setDescription(sprintf('The URL to any YouTube playlist (e.g. <a href="%s" target="_blank">%s</a>) or just the playlist identifier (e.g. %s).', 'http://youtube.com/playlist?list=48A83AD3506C9D36', 'http://youtube.com/playlist?list=48A83AD3506C9D36', '48A83AD3506C9D36'));
     $option->setLabel('This YouTube playlist');
     //>(translatable)<
     $option->setValidValueRegex('/[\\w-]+/');
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_GallerySource::YOUTUBE_FAVORITES_VALUE);
     $option->setDefaultValue('FPSRussia');
     $option->setLabel('This YouTube user\'s "favorites"');
     //>(translatable)<
     $option->setValidValueRegex($_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE);
     $option->setDefaultValue('pittsburgh steelers');
     $option->setDescription('YouTube limits this to 1,000 results.');
     //>(translatable)<
     $option->setLabel('YouTube search for');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_GallerySource::YOUTUBE_USER_VALUE);
     $option->setDefaultValue('3hough');
     $option->setLabel('Videos from this YouTube user');
     //>(translatable)<
     $option->setValidValueRegex('/[\\w-]+/');
     $toReturn[] = $option;
     /**
      * META OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Meta::RATING);
     $option->setLabel('Average rating');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_youtube_api_const_options_names_Meta::RATINGS);
     $option->setLabel('Number of ratings');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     return $toReturn;
 }
 public function getOptionDescriptors()
 {
     $_regexPositiveInteger = '/[1-9][0-9]{0,6}/';
     $_regexNonNegativeInteger = '/0|[1-9][0-9]{0,6}/';
     $_regexWordChars = '/\\w+/';
     $toReturn = array();
     /**
      * ADVANCED OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Advanced::DEBUG_ON);
     $option->setDefaultValue(true);
     $option->setLabel('Enable debugging');
     //>(translatable)<
     $option->setDescription('If checked, anyone will be able to view your debugging information. This is a rather small privacy risk. If you\'re not having problems with TubePress, or you\'re worried about revealing any details of your TubePress pages, feel free to disable the feature.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Advanced::HTTPS);
     $option->setDefaultValue(false);
     $option->setLabel('Enable HTTPS');
     //>(translatable)<
     $option->setDescription('Serve thumbnails and embedded video player over a secure connection.');
     //>(translatable)<
     $option->setBoolean();
     $option->setProOnly();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Advanced::GALLERY_ID);
     $option->setValidValueRegex($_regexWordChars);
     $option->setDoNotPersist();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Advanced::KEYWORD);
     $option->setDefaultValue('tubepress');
     $option->setLabel('Shortcode keyword');
     //>(translatable)<
     $option->setDescription('The word you insert (in plaintext, between square brackets) into your posts/pages to display a gallery.');
     //>(translatable)<
     $option->setValidValueRegex($_regexWordChars);
     $option->setCannotBeSetViaShortcode();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Advanced::HTTP_METHOD);
     $option->setDefaultValue(ehough_shortstop_api_HttpRequest::HTTP_METHOD_GET);
     $option->setLabel('HTTP method');
     //>(translatable)<
     $option->setDescription('Defines the HTTP method used in most TubePress Ajax operations');
     //>(translatable)<
     $option->setAcceptableValues(array(ehough_shortstop_api_HttpRequest::HTTP_METHOD_GET => ehough_shortstop_api_HttpRequest::HTTP_METHOD_GET, ehough_shortstop_api_HttpRequest::HTTP_METHOD_POST => ehough_shortstop_api_HttpRequest::HTTP_METHOD_POST));
     $toReturn[] = $option;
     /**
      * CACHE OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Cache::CACHE_CLEAN_FACTOR);
     $option->setDefaultValue(20);
     $option->setLabel('Cache cleaning factor');
     //>(translatable)<
     $option->setDescription('If you enter X, the entire cache will be cleaned every 1/X cache writes. Enter 0 to disable cache cleaning.');
     //>(translatable)<
     $option->setValidValueRegex($_regexNonNegativeInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Cache::CACHE_DIR);
     $option->setLabel('Cache directory');
     //>(translatable)<
     $option->setDescription('Leave blank to attempt to use your system\'s temp directory. Otherwise enter the absolute path of a writeable directory.');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Cache::CACHE_ENABLED);
     $option->setDefaultValue(false);
     $option->setLabel('Enable API cache');
     //>(translatable)<
     $option->setDescription('Store API responses in a cache file to significantly reduce load times for your galleries at the slight expense of freshness.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Cache::CACHE_LIFETIME_SECONDS);
     $option->setDefaultValue(3600);
     $option->setLabel('Cache expiration time (seconds)');
     //>(translatable)<
     $option->setDescription('Cache entries will be considered stale after the specified number of seconds. Default is 3600 (one hour).');
     //>(translatable)<
     $option->setValidValueRegex($_regexPositiveInteger);
     $toReturn[] = $option;
     /**
      * EMBEDDED PLAYER OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::AUTONEXT);
     $option->setLabel('Play videos sequentially without user intervention');
     //>(translatable)<
     $option->setDescription('When a video finishes, this will start playing the next video in the gallery.');
     //>(translatable)<
     $option->setDefaultValue(true);
     $option->setBoolean();
     $option->setProOnly();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $option->setLabel('Auto-play all videos');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::EMBEDDED_HEIGHT);
     $option->setDefaultValue(350);
     $option->setLabel('Max height (px)');
     //>(translatable)<
     $option->setDescription('Default is 350.');
     //>(translatable)<
     $option->setValidValueRegex($_regexNonNegativeInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::EMBEDDED_WIDTH);
     $option->setDefaultValue(425);
     $option->setLabel('Max width (px)');
     //>(translatable)<
     $option->setDescription('Default is 425.');
     //>(translatable)<
     $option->setValidValueRegex($_regexNonNegativeInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::ENABLE_JS_API);
     $option->setDefaultValue(true);
     $option->setLabel('Enable JavaScript API');
     //>(translatable)<
     $option->setDescription('Allow TubePress to communicate with the embedded video player via JavaScript. This incurs a very small performance overhead, but is required for some features.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::LAZYPLAY);
     $option->setDefaultValue(true);
     $option->setLabel('"Lazy" play videos');
     //>(translatable)<
     $option->setDescription('Auto-play each video after thumbnail click.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::LOOP);
     $option->setDefaultValue(false);
     $option->setLabel('Loop');
     //>(translatable)<
     $option->setDescription('Continue playing the video until the user stops it.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::PLAYER_IMPL);
     $option->setDefaultValue(tubepress_api_const_options_values_PlayerImplementationValue::PROVIDER_BASED);
     $option->setLabel('Implementation');
     //>(translatable)<
     $option->setDescription('The brand of the embedded player. Default is the provider\'s player (YouTube, Vimeo, etc).');
     //>(translatable)<
     $option->setAcceptableValuesCallback(array($this, '_callbackGetValidPlayerImplementations'));
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::PLAYER_LOCATION);
     $option->setLabel('Play each video');
     //>(translatable)<
     $option->setDefaultValue('normal');
     $option->setAcceptableValuesCallback(array($this, '_callbackGetValidPlayerLocations'));
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::SEQUENCE);
     $option->setDoNotPersist();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Embedded::SHOW_INFO);
     $option->setLabel('Show title and rating before video starts');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     /**
      * FEED OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Feed::ORDER_BY);
     $option->setDefaultValue(tubepress_api_const_options_values_OrderByValue::DEFAULTT);
     $option->setLabel('Order videos by');
     //>(translatable)<
     $option->setDescription('Not all sort orders can be applied to all gallery types. See the <a href="http://tubepress.com/documentation" target="_blank">documentation</a> for more info.');
     //>(translatable)<
     $option->setAcceptableValues(array(tubepress_api_const_options_values_OrderByValue::DEFAULTT => 'default', tubepress_api_const_options_values_OrderByValue::COMMENT_COUNT => 'comment count', tubepress_api_const_options_values_OrderByValue::NEWEST => 'date published (newest first)', tubepress_api_const_options_values_OrderByValue::OLDEST => 'date published (oldest first)', tubepress_api_const_options_values_OrderByValue::DURATION => 'length', tubepress_api_const_options_values_OrderByValue::POSITION => 'position in a playlist', tubepress_api_const_options_values_OrderByValue::REV_POSITION => 'reversed position in a playlist', tubepress_api_const_options_values_OrderByValue::RANDOM => 'randomly', tubepress_api_const_options_values_OrderByValue::RATING => 'rating', tubepress_api_const_options_values_OrderByValue::RELEVANCE => 'relevance', tubepress_api_const_options_values_OrderByValue::TITLE => 'title', tubepress_api_const_options_values_OrderByValue::VIEW_COUNT => 'view count'));
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Feed::PER_PAGE_SORT);
     $option->setDefaultValue(tubepress_api_const_options_values_PerPageSortValue::NONE);
     $option->setLabel('Per-page sort order');
     //>(translatable)<
     $option->setDescription('Additional sort order applied to each individual page of a gallery');
     //>(translatable)<
     $option->setAcceptableValues(array(tubepress_api_const_options_values_PerPageSortValue::COMMENT_COUNT => 'comment count', tubepress_api_const_options_values_PerPageSortValue::NEWEST => 'date published (newest first)', tubepress_api_const_options_values_PerPageSortValue::OLDEST => 'date published (oldest first)', tubepress_api_const_options_values_PerPageSortValue::DURATION => 'length', tubepress_api_const_options_values_PerPageSortValue::NONE => 'none', tubepress_api_const_options_values_PerPageSortValue::RANDOM => 'random', tubepress_api_const_options_values_PerPageSortValue::RATING => 'rating', tubepress_api_const_options_values_PerPageSortValue::TITLE => 'title', tubepress_api_const_options_values_PerPageSortValue::VIEW_COUNT => 'view count'));
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Feed::RESULT_COUNT_CAP);
     $option->setDefaultValue(300);
     $option->setLabel('Maximum total videos to retrieve');
     //>(translatable)<
     $option->setDescription('This can help to reduce the number of pages in your gallery. Set to "0" to remove any limit.');
     //>(translatable)<
     $option->setValidValueRegex($_regexNonNegativeInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Feed::SEARCH_ONLY_USER);
     $option->setLabel('Restrict search results to videos from author');
     //>(translatable)<
     $option->setDescription('A YouTube or Vimeo user name. Only applies to search-based galleries.');
     //>(translatable)<
     $option->setValidValueRegex('/\\w*/');
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Feed::VIDEO_BLACKLIST);
     $option->setLabel('Video blacklist');
     //>(translatable)<
     $option->setDescription('A list of video IDs that should never be displayed.');
     //>(translatable)<
     $toReturn[] = $option;
     /**
      * INTERACTIVE SEARCH OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_InteractiveSearch::SEARCH_PROVIDER);
     $option->setAcceptableValuesCallback(array($this, '_callbackGetValidVideoProviderNames'));
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_InteractiveSearch::SEARCH_RESULTS_ONLY);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_InteractiveSearch::SEARCH_RESULTS_URL);
     $toReturn[] = $option;
     /**
      * META DISPLAY OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::AUTHOR);
     $option->setLabel('Author');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::CATEGORY);
     $option->setLabel('Category');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::DESCRIPTION);
     $option->setLabel('Description');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::ID);
     $option->setLabel('ID');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::KEYWORDS);
     $option->setLabel('Keywords');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::LENGTH);
     $option->setLabel('Runtime');
     //>(translatable)<
     $option->setDefaultValue(true);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::TITLE);
     $option->setLabel('Title');
     //>(translatable)<
     $option->setDefaultValue(true);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::UPLOADED);
     $option->setLabel('Date posted');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::URL);
     $option->setLabel('URL');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::VIEWS);
     $option->setLabel('View count');
     //>(translatable)<
     $option->setDefaultValue(true);
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::DATEFORMAT);
     $option->setDefaultValue('M j, Y');
     $option->setLabel('Date format');
     //>(translatable)<
     $option->setDescription('Set the textual formatting of date information for videos. See <a href="http://us.php.net/date" target="_blank">date</a> for examples.');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::DESC_LIMIT);
     $option->setDefaultValue(80);
     $option->setLabel('Maximum description length');
     //>(translatable)<
     $option->setDescription('Maximum number of characters to display in video descriptions. Set to 0 for no limit.');
     //>(translatable)<
     $option->setValidValueRegex($_regexNonNegativeInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Meta::RELATIVE_DATES);
     $option->setDefaultValue(false);
     $option->setLabel('Use relative dates');
     //>(translatable)<
     $option->setDescription('e.g. "yesterday" instead of "November 3, 1980".');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     /**
      * OPTIONS UI OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_OptionsUi::DISABLED_OPTIONS_PAGE_PARTICIPANTS);
     $option->setLabel('Only show options applicable to...');
     //>(translatable)<
     $toReturn[] = $option;
     /**
      * OUTPUT OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Output::GALLERY_SOURCE);
     $option->setDefaultValue(tubepress_addons_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_POPULAR);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Output::OUTPUT);
     $option->setDoNotPersist();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Output::VIDEO);
     $option->setDoNotPersist();
     $toReturn[] = $option;
     /**
      * THUMBNAIL OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::AJAX_PAGINATION);
     $option->setLabel('<a href="http://wikipedia.org/wiki/Ajax_(programming)" target="_blank">Ajax</a>-enabled pagination');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setProOnly();
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::FLUID_THUMBS);
     $option->setDefaultValue(true);
     $option->setLabel('Use "fluid" thumbnails');
     //>(translatable)<
     $option->setDescription('Dynamically set thumbnail spacing based on the width of their container.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::HQ_THUMBS);
     $option->setDefaultValue(false);
     $option->setLabel('Use high-quality thumbnails');
     //>(translatable)<
     $option->setDescription('Note: this option cannot be used with the "randomize thumbnails" feature.');
     //>(translatable)<
     $option->setProOnly();
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::PAGINATE_ABOVE);
     $option->setDefaultValue(true);
     $option->setLabel('Show pagination above thumbnails');
     //>(translatable)<
     $option->setDescription('Only applies to galleries that span multiple pages.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::PAGINATE_BELOW);
     $option->setDefaultValue(true);
     $option->setLabel('Show pagination below thumbnails');
     //>(translatable)<
     $option->setDescription('Only applies to galleries that span multiple pages.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::RANDOM_THUMBS);
     $option->setDefaultValue(true);
     $option->setLabel('Randomize thumbnail images');
     //>(translatable)<
     $option->setDescription('Most videos come with several thumbnails. By selecting this option, each time someone views your gallery they will see the same videos with each video\'s thumbnail randomized. Note: this option cannot be used with the "high quality thumbnails" feature.');
     //>(translatable)<
     $option->setBoolean();
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::RESULTS_PER_PAGE);
     $option->setDefaultValue(20);
     $option->setLabel('Thumbnails per page');
     //>(translatable)<
     $option->setDescription('Default is 20. Maximum is 50.');
     //>(translatable)<
     $option->setValidValueRegex($_regexPositiveInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::THEME);
     $option->setLabel('Theme');
     //>(translatable)<
     $option->setDescription('The TubePress theme to use for this gallery. Your themes can be found at <code>%s</code>, and default themes can be found at <code>%s</code>.');
     //>(translatable)<
     $option->setAcceptableValuesCallback(array($this, '_callbackGetValidThemeOptions'));
     $option->setDefaultValue('default');
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::THUMB_HEIGHT);
     $option->setDefaultValue(90);
     $option->setLabel('Height (px) of thumbs');
     //>(translatable)<
     $option->setDescription('Default is 90.');
     //>(translatable)<
     $option->setValidValueRegex($_regexPositiveInteger);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_api_const_options_names_Thumbs::THUMB_WIDTH);
     $option->setDefaultValue(120);
     $option->setLabel('Width (px) of thumbs');
     //>(translatable)<
     $option->setDescription('Default is 120.');
     //>(translatable)<
     $option->setValidValueRegex($_regexPositiveInteger);
     $toReturn[] = $option;
     return $toReturn;
 }
 /**
  * Fetch all the option descriptors from this provider.
  *
  * @return tubepress_spi_options_OptionDescriptor[]
  */
 public function getOptionDescriptors()
 {
     $toReturn = array();
     /**
      * EMBEDDED PLAYER OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_Embedded::PLAYER_COLOR);
     $option->setDefaultValue('999999');
     $option->setLabel('Main color');
     //>(translatable)<
     $option->setDescription(sprintf('Default is %s', "999999"));
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexColor);
     $toReturn[] = $option;
     /**
      * FEED OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_Feed::VIMEO_KEY);
     $option->setLabel('Vimeo API "Consumer Key"');
     //>(translatable)<
     $option->setDescription('<a href="http://vimeo.com/api/applications/new" target="_blank">Click here</a> to register for a consumer key and secret.');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_Feed::VIMEO_SECRET);
     $option->setLabel('Vimeo API "Consumer Secret"');
     //>(translatable)<
     $option->setDescription('<a href="http://vimeo.com/api/applications/new" target="_blank">Click here</a> to register for a consumer key and secret.');
     //>(translatable)<
     $toReturn[] = $option;
     /**
      * GALLERY SOURCE OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_ALBUM_VALUE);
     $option->setDefaultValue('140484');
     $option->setLabel('Videos from this Vimeo album');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_APPEARS_IN_VALUE);
     $option->setDefaultValue('royksopp');
     $option->setLabel('Videos this Vimeo user appears in');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_CHANNEL_VALUE);
     $option->setDefaultValue('splitscreenstuff');
     $option->setLabel('Videos in this Vimeo channel');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_CREDITED_VALUE);
     $option->setDefaultValue('patricklawler');
     $option->setLabel('Videos credited to this Vimeo user (either appears in or uploaded by)');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_GROUP_VALUE);
     $option->setDefaultValue('hdxs');
     $option->setLabel('Videos from this Vimeo group');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_LIKES_VALUE);
     $option->setDefaultValue('coiffier');
     $option->setLabel('Videos this Vimeo user likes');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_SEARCH_VALUE);
     $option->setDefaultValue('glacier national park');
     $option->setLabel('Vimeo search for');
     //>(translatable)<
     $toReturn[] = $option;
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_GallerySource::VIMEO_UPLOADEDBY_VALUE);
     $option->setDefaultValue('AvantGardeDiaries');
     $option->setLabel('Videos uploaded by this Vimeo user');
     //>(translatable)<
     $option->setValidValueRegex(self::$_regexWordChars);
     $toReturn[] = $option;
     /**
      * META OPTIONS
      */
     $option = new tubepress_spi_options_OptionDescriptor(tubepress_addons_vimeo_api_const_options_names_Meta::LIKES);
     $option->setLabel('Number of "likes"');
     //>(translatable)<
     $option->setDefaultValue(false);
     $option->setBoolean();
     $toReturn[] = $option;
     return $toReturn;
 }