示例#1
0
 /**
  * Called during construction of the TubePress service container. If an add-on intends to add
  * services to the container, it should do so here. The incoming `tubepress_api_ioc_ContainerBuilderInterface`
  * will be completely empty, and after this method is executed will be merged into the primary service container.
  *
  * @param tubepress_api_ioc_ContainerBuilderInterface $containerBuilder An empty `tubepress_api_ioc_ContainerBuilderInterface` instance.
  *
  * @return void
  *
  * @api
  * @since 4.0.0
  */
 public function load(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register(tubepress_api_translation_TranslatorInterface::_, 'tubepress_test_integration_mocks_MockTranslator');
     $containerBuilder->register(tubepress_spi_options_PersistenceBackendInterface::_, 'tubepress_test_integration_mocks_MockPersistence');
     $containerBuilder->register('ehough_stash_interfaces_DriverInterface', 'tubepress_test_integration_mocks_MockCacheDriver');
     $containerBuilder->register(tubepress_api_http_oauth2_Oauth2EnvironmentInterface::_, 'tubepress_test_integration_mocks_MockOauth2Environment');
 }
示例#2
0
 private function _registerServices(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register(tubepress_api_options_AcceptableValuesInterface::_, 'tubepress_options_impl_AcceptableValues')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_event_EventDispatcherInterface::_));
     $containerBuilder->register(tubepress_api_options_ContextInterface::_, 'tubepress_options_impl_Context')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_options_PersistenceInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_event_EventDispatcherInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_options_ReferenceInterface::_));
     $containerBuilder->register(tubepress_api_options_ReferenceInterface::_, 'tubepress_options_impl_DispatchingReference')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_event_EventDispatcherInterface::_))->addTag(tubepress_api_ioc_ServiceTags::TAGGED_SERVICES_CONSUMER, array('tag' => tubepress_api_options_ReferenceInterface::_, 'method' => 'setReferences'));
     $containerBuilder->register(tubepress_api_options_PersistenceInterface::_, 'tubepress_options_impl_Persistence')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_options_ReferenceInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_event_EventDispatcherInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_spi_options_PersistenceBackendInterface::_));
 }
 /**
  * {@inheritdoc}
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     foreach (self::$_REQUIRED_SERVICE_IDS as $requiredId) {
         if (!$containerBuilder->hasDefinition($requiredId)) {
             return;
         }
     }
     $environment = $containerBuilder->getDefinition(tubepress_api_environment_EnvironmentInterface::_);
     $environment->addMethodCall('setWpFunctionsInterface', array(new tubepress_api_ioc_Reference(tubepress_wordpress_impl_wp_WpFunctions::_)));
 }
 private function _registerOptions(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('tubepress_api_options_Reference__shortcode', 'tubepress_api_options_Reference')->addArgument(array(tubepress_api_options_Reference::PROPERTY_DEFAULT_VALUE => array(tubepress_api_options_Names::SHORTCODE_KEYWORD => 'tubepress'), tubepress_api_options_Reference::PROPERTY_UNTRANSLATED_LABEL => array(tubepress_api_options_Names::SHORTCODE_KEYWORD => 'Shortcode keyword'), tubepress_api_options_Reference::PROPERTY_UNTRANSLATED_DESCRIPTION => array(tubepress_api_options_Names::SHORTCODE_KEYWORD => 'The word you insert (in plaintext, between square brackets) into your posts/pages to display a gallery.')))->addTag(tubepress_api_options_ReferenceInterface::_);
     $toValidate = array(tubepress_api_options_listeners_RegexValidatingListener::TYPE_ONE_OR_MORE_WORDCHARS => array(tubepress_api_options_Names::SHORTCODE_KEYWORD));
     foreach ($toValidate as $type => $optionNames) {
         foreach ($optionNames as $optionName) {
             $containerBuilder->register('regex_validator.' . $optionName, 'tubepress_api_options_listeners_RegexValidatingListener')->addArgument($type)->addArgument(new tubepress_api_ioc_Reference(tubepress_api_options_ReferenceInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_translation_TranslatorInterface::_))->addTag(tubepress_api_ioc_ServiceTags::EVENT_LISTENER, array('event' => tubepress_api_event_Events::OPTION_SET . ".{$optionName}", 'priority' => 100000, 'method' => 'onOption'));
         }
     }
 }
示例#5
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('theme_field', 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument(tubepress_api_options_Names::THEME)->addArgument('theme');
     $fieldReferences = array(new tubepress_api_ioc_Reference('theme_field'));
     $containerBuilder->register('theme_category', 'tubepress_options_ui_impl_BaseElement')->addArgument(tubepress_api_options_ui_CategoryNames::THEME)->addArgument('Theme');
     //>(translatable)<
     $categoryReferences = array(new tubepress_api_ioc_Reference('theme_category'));
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::THEME => array(tubepress_api_options_Names::THEME));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__theme', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-theme')->addArgument('Theme')->addArgument(false)->addArgument(false)->addArgument($categoryReferences)->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#6
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('multiSourceText' => array(tubepress_api_options_Names::SEARCH_ONLY_USER));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'search_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::FEED => array(tubepress_api_options_Names::SEARCH_ONLY_USER));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__search', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-search')->addArgument('Search')->addArgument(false)->addArgument(false)->addArgument(array())->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#7
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::EMBEDDED_SCROLL_ON), 'dropdown' => array(tubepress_api_options_Names::PLAYER_LOCATION), 'text' => array(tubepress_api_options_Names::EMBEDDED_SCROLL_DURATION, tubepress_api_options_Names::EMBEDDED_SCROLL_OFFSET));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'player_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::EMBEDDED => array(tubepress_api_options_Names::PLAYER_LOCATION, tubepress_api_options_Names::EMBEDDED_SCROLL_ON, tubepress_api_options_Names::EMBEDDED_SCROLL_DURATION, tubepress_api_options_Names::EMBEDDED_SCROLL_OFFSET));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__player', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-player')->addArgument('Player')->addArgument(false)->addArgument(false)->addArgument(array())->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#8
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::HTML_HTTPS), 'dropdown' => array(tubepress_api_options_Names::HTTP_METHOD));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'html_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::ADVANCED => array(tubepress_api_options_Names::HTML_HTTPS, tubepress_api_options_Names::HTTP_METHOD));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__html', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-html')->addArgument('HTML')->addArgument(false)->addArgument(false)->addArgument(array())->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#9
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $colors = array(tubepress_jwplayer5_api_OptionNames::COLOR_BACK, tubepress_jwplayer5_api_OptionNames::COLOR_FRONT, tubepress_jwplayer5_api_OptionNames::COLOR_LIGHT, tubepress_jwplayer5_api_OptionNames::COLOR_SCREEN);
     $fieldIndex = 0;
     foreach ($colors as $color) {
         $containerBuilder->register('jwplayer_field_' . $fieldIndex++, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($color)->addArgument('spectrum');
     }
     $fieldReferences = array();
     for ($x = 0; $x < $fieldIndex; ++$x) {
         $fieldReferences[] = new tubepress_api_ioc_Reference('jwplayer_field_' . $x);
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::EMBEDDED => array(tubepress_jwplayer5_api_OptionNames::COLOR_BACK, tubepress_jwplayer5_api_OptionNames::COLOR_FRONT, tubepress_jwplayer5_api_OptionNames::COLOR_LIGHT, tubepress_jwplayer5_api_OptionNames::COLOR_SCREEN));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__jwplayer5', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-jwplayer5')->addArgument('JW Player')->addArgument(false)->addArgument(true)->addArgument(array())->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#10
0
 private function _registerOptionsUiFieldProvider(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::CACHE_HTML_ENABLED), 'text' => array(tubepress_api_options_Names::CACHE_HTML_DIRECTORY, tubepress_api_options_Names::CACHE_HTML_LIFETIME_SECONDS, tubepress_api_options_Names::CACHE_HTML_CLEANING_FACTOR, tubepress_api_options_Names::CACHE_HTML_CLEANING_KEY));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'htmlcache_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::CACHE => array(tubepress_api_options_Names::CACHE_HTML_ENABLED, tubepress_api_options_Names::CACHE_HTML_DIRECTORY, tubepress_api_options_Names::CACHE_HTML_LIFETIME_SECONDS, tubepress_api_options_Names::CACHE_HTML_CLEANING_FACTOR, tubepress_api_options_Names::CACHE_HTML_CLEANING_KEY));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__cache_html', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-htmlcache')->addArgument('HTML Cache')->addArgument(false)->addArgument(true)->addArgument(array())->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
 /**
  * {@inheritdoc}
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $consumerIds = $containerBuilder->findTaggedServiceIds(tubepress_api_ioc_ServiceTags::TAGGED_SERVICES_CONSUMER);
     foreach ($consumerIds as $consumerId => $tags) {
         $consumerDefinition = $containerBuilder->getDefinition($consumerId);
         foreach ($tags as $tagData) {
             $requiredAttribites = array('tag', 'method');
             foreach ($requiredAttribites as $attributeName) {
                 if (!isset($tagData[$attributeName])) {
                     throw new LogicException(sprintf('Service %s must specify %s in its tag data', $consumerId, $attributeName));
                 }
             }
             $matchingServiceIdsToTagData = $containerBuilder->findTaggedServiceIds($tagData['tag']);
             $references = $this->_buildMethodCallArgument($matchingServiceIdsToTagData);
             $consumerDefinition->addMethodCall($tagData['method'], array($references));
         }
     }
 }
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::EMBEDDED_LAZYPLAY, tubepress_api_options_Names::EMBEDDED_SHOW_INFO, tubepress_api_options_Names::EMBEDDED_AUTOPLAY, tubepress_api_options_Names::EMBEDDED_LOOP, tubepress_api_options_Names::RESPONSIVE_EMBEDS), 'dropdown' => array(tubepress_api_options_Names::EMBEDDED_PLAYER_IMPL), 'text' => array(tubepress_api_options_Names::EMBEDDED_HEIGHT, tubepress_api_options_Names::EMBEDDED_WIDTH));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'embedded_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $categoryReferences = array();
     $serviceId = 'embedded_category_' . tubepress_api_options_ui_CategoryNames::EMBEDDED;
     $containerBuilder->register($serviceId, 'tubepress_options_ui_impl_BaseElement')->addArgument(tubepress_api_options_ui_CategoryNames::EMBEDDED)->addArgument('Player');
     //>(translatable)<
     $categoryReferences[] = new tubepress_api_ioc_Reference($serviceId);
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::EMBEDDED => array(tubepress_api_options_Names::EMBEDDED_PLAYER_IMPL, tubepress_api_options_Names::EMBEDDED_HEIGHT, tubepress_api_options_Names::EMBEDDED_WIDTH, tubepress_api_options_Names::RESPONSIVE_EMBEDS, tubepress_api_options_Names::EMBEDDED_LAZYPLAY, tubepress_api_options_Names::EMBEDDED_SHOW_INFO, tubepress_api_options_Names::EMBEDDED_AUTOPLAY, tubepress_api_options_Names::EMBEDDED_LOOP));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__embedded_common', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-embedded-common')->addArgument('Embedded')->addArgument(false)->addArgument(false)->addArgument($categoryReferences)->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
 private function _doProcess(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder, $serviceSuffix)
 {
     if (!$containerBuilder->hasDefinition('Twig_Loader_Filesystem' . $serviceSuffix)) {
         return;
     }
     $twigFsLoaderDefinition = $containerBuilder->getDefinition('Twig_Loader_Filesystem' . $serviceSuffix);
     $providerIds = $containerBuilder->findTaggedServiceIds('tubepress_spi_template_PathProviderInterface' . $serviceSuffix);
     foreach ($providerIds as $providerId => $tags) {
         /*
          * @var tubepress_spi_template_PathProviderInterface
          */
         $provider = $containerBuilder->get($providerId);
         $directories = $provider->getTemplateDirectories();
         foreach ($directories as $directory) {
             if (is_dir($directory)) {
                 $twigFsLoaderDefinition->addMethodCall('addPath', array($directory));
             }
         }
     }
 }
示例#14
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::GALLERY_AJAX_PAGINATION, tubepress_api_options_Names::GALLERY_FLUID_THUMBS, tubepress_api_options_Names::GALLERY_PAGINATE_ABOVE, tubepress_api_options_Names::GALLERY_PAGINATE_BELOW, tubepress_api_options_Names::GALLERY_HQ_THUMBS, tubepress_api_options_Names::GALLERY_RANDOM_THUMBS, tubepress_api_options_Names::GALLERY_AUTONEXT), 'text' => array(tubepress_api_options_Names::GALLERY_THUMB_HEIGHT, tubepress_api_options_Names::GALLERY_THUMB_WIDTH), 'gallerySource' => array(tubepress_api_options_Names::GALLERY_SOURCE));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'gallery_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $categoryReferences = array();
     $categories = array(array(tubepress_api_options_ui_CategoryNames::GALLERY_SOURCE, 'Which videos?'), array(tubepress_api_options_ui_CategoryNames::THUMBNAILS, 'Thumbnails'));
     foreach ($categories as $categoryIdAndLabel) {
         $serviceId = 'gallery_category_' . $categoryIdAndLabel[0];
         $containerBuilder->register($serviceId, 'tubepress_options_ui_impl_BaseElement')->addArgument($categoryIdAndLabel[0])->addArgument($categoryIdAndLabel[1]);
         $categoryReferences[] = new tubepress_api_ioc_Reference($serviceId);
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::GALLERY_SOURCE => array(tubepress_api_options_Names::GALLERY_SOURCE), tubepress_api_options_ui_CategoryNames::EMBEDDED => array(tubepress_api_options_Names::GALLERY_AUTONEXT), tubepress_api_options_ui_CategoryNames::THUMBNAILS => array(tubepress_api_options_Names::GALLERY_THUMB_HEIGHT, tubepress_api_options_Names::GALLERY_THUMB_WIDTH, tubepress_api_options_Names::GALLERY_AJAX_PAGINATION, tubepress_api_options_Names::GALLERY_FLUID_THUMBS, tubepress_api_options_Names::GALLERY_PAGINATE_ABOVE, tubepress_api_options_Names::GALLERY_PAGINATE_BELOW, tubepress_api_options_Names::GALLERY_HQ_THUMBS, tubepress_api_options_Names::GALLERY_RANDOM_THUMBS));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__gallery', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-gallery')->addArgument('Gallery')->addArgument(false)->addArgument(false)->addArgument($categoryReferences)->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#15
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('dropdown' => array(tubepress_api_options_Names::FEED_PER_PAGE_SORT), 'text' => array(tubepress_api_options_Names::FEED_RESULT_COUNT_CAP, tubepress_api_options_Names::FEED_ITEM_ID_BLACKLIST), 'orderBy' => array(tubepress_api_options_Names::FEED_ORDER_BY), 'multiSourceText' => array(tubepress_api_options_Names::FEED_RESULTS_PER_PAGE));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'feed_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $categoryReferences = array();
     $categories = array(array(tubepress_api_options_ui_CategoryNames::FEED, 'Feed'));
     foreach ($categories as $categoryIdAndLabel) {
         $serviceId = 'feed_category_' . $categoryIdAndLabel[0];
         $containerBuilder->register($serviceId, 'tubepress_options_ui_impl_BaseElement')->addArgument($categoryIdAndLabel[0])->addArgument($categoryIdAndLabel[1]);
         $categoryReferences[] = new tubepress_api_ioc_Reference($serviceId);
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::FEED => array(tubepress_api_options_Names::FEED_RESULTS_PER_PAGE, tubepress_api_options_Names::FEED_ORDER_BY, tubepress_api_options_Names::FEED_PER_PAGE_SORT, tubepress_api_options_Names::FEED_RESULT_COUNT_CAP, tubepress_api_options_Names::FEED_ITEM_ID_BLACKLIST));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__feed', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-feed')->addArgument('Feed')->addArgument(false)->addArgument(false)->addArgument($categoryReferences)->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#16
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::META_RELATIVE_DATES), 'fieldProviderFilter' => array(tubepress_options_ui_impl_fields_templated_multi_FieldProviderFilterField::FIELD_ID), 'text' => array(tubepress_api_options_Names::META_DATEFORMAT, tubepress_api_options_Names::META_DESC_LIMIT), 'metaMultiSelect' => array('does not matter'));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'meta_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $categoryReferences = array();
     $categories = array(array(tubepress_api_options_ui_CategoryNames::META, 'Meta'));
     foreach ($categories as $categoryIdAndLabel) {
         $serviceId = 'meta_category_' . $categoryIdAndLabel[0];
         $containerBuilder->register($serviceId, 'tubepress_options_ui_impl_BaseElement')->addArgument($categoryIdAndLabel[0])->addArgument($categoryIdAndLabel[1]);
         $categoryReferences[] = new tubepress_api_ioc_Reference($serviceId);
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::META => array(tubepress_options_ui_impl_fields_templated_multi_MetaMultiSelectField::FIELD_ID, tubepress_api_options_Names::META_DATEFORMAT, tubepress_api_options_Names::META_RELATIVE_DATES, tubepress_api_options_Names::META_DESC_LIMIT));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__meta', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-meta')->addArgument('Meta')->addArgument(false)->addArgument(false)->addArgument($categoryReferences)->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
示例#17
0
 private function _registerOptionsUi(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $fieldReferences = array();
     $fieldMap = array('boolean' => array(tubepress_api_options_Names::CACHE_ENABLED), 'text' => array(tubepress_api_options_Names::CACHE_DIRECTORY, tubepress_api_options_Names::CACHE_LIFETIME_SECONDS, tubepress_api_options_Names::CACHE_CLEANING_FACTOR));
     foreach ($fieldMap as $type => $ids) {
         foreach ($ids as $id) {
             $serviceId = 'cache_api_field_' . $id;
             $containerBuilder->register($serviceId, 'tubepress_api_options_ui_FieldInterface')->setFactoryService(tubepress_api_options_ui_FieldBuilderInterface::_)->setFactoryMethod('newInstance')->addArgument($id)->addArgument($type);
             $fieldReferences[] = new tubepress_api_ioc_Reference($serviceId);
         }
     }
     $categoryReferences = array();
     $categories = array(array(tubepress_api_options_ui_CategoryNames::CACHE, 'Cache'));
     foreach ($categories as $categoryIdAndLabel) {
         $serviceId = 'cache_api_category_' . $categoryIdAndLabel[0];
         $containerBuilder->register($serviceId, 'tubepress_options_ui_impl_BaseElement')->addArgument($categoryIdAndLabel[0])->addArgument($categoryIdAndLabel[1]);
         $categoryReferences[] = new tubepress_api_ioc_Reference($serviceId);
     }
     $fieldMap = array(tubepress_api_options_ui_CategoryNames::CACHE => array(tubepress_api_options_Names::CACHE_ENABLED, tubepress_api_options_Names::CACHE_DIRECTORY, tubepress_api_options_Names::CACHE_LIFETIME_SECONDS, tubepress_api_options_Names::CACHE_CLEANING_FACTOR));
     $containerBuilder->register('tubepress_api_options_ui_BaseFieldProvider__cache_api', 'tubepress_api_options_ui_BaseFieldProvider')->addArgument('field-provider-cache-api')->addArgument('API Cache')->addArgument(false)->addArgument(true)->addArgument($categoryReferences)->addArgument($fieldReferences)->addArgument($fieldMap)->addTag('tubepress_spi_options_ui_FieldProviderInterface');
 }
 /**
  * {@inheritdoc}
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     if (!$containerBuilder->hasDefinition(tubepress_api_event_EventDispatcherInterface::_)) {
         return;
     }
     $eventDispatcherDefinition = $containerBuilder->getDefinition(tubepress_api_event_EventDispatcherInterface::_);
     $listenerServiceIds = $containerBuilder->findTaggedServiceIds(tubepress_api_ioc_ServiceTags::EVENT_LISTENER);
     foreach ($listenerServiceIds as $serviceId => $events) {
         foreach ($events as $event) {
             $priority = isset($event['priority']) ? $event['priority'] : 0;
             if (!isset($event['event'])) {
                 throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $serviceId, tubepress_api_ioc_ServiceTags::EVENT_LISTENER));
             }
             if (!isset($event['method'])) {
                 $onSuffix = preg_replace_callback(array('/(?<=\\b)[a-z]/i', '/[^a-z0-9]/i'), array($this, '_callbackStrToUpper'), $event['event']);
                 $event['method'] = 'on' . $onSuffix;
                 $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
             }
             $eventDispatcherDefinition->addMethodCall('addListenerService', array($event['event'], array($serviceId, $event['method']), $priority));
         }
     }
 }
示例#19
0
 /**
  * {@inheritdoc}
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     if (!$containerBuilder->hasDefinition(tubepress_api_event_EventDispatcherInterface::_) || !$containerBuilder->has('tubepress_internal_logger_BootLogger')) {
         return;
     }
     $eventDispatcherDefinition = $containerBuilder->getDefinition(tubepress_api_event_EventDispatcherInterface::_);
     $logger = $containerBuilder->get('tubepress_internal_logger_BootLogger');
     $clazz = $eventDispatcherDefinition->getClass();
     $logger->debug(sprintf('Event dispatcher is of type <code>%s</code>', $clazz));
     $methodCalls = $eventDispatcherDefinition->getMethodCalls();
     $events = array();
     foreach ($methodCalls as $methodCall) {
         $methodName = $methodCall[0];
         $details = $methodCall[1];
         if ($methodName !== 'addListenerService') {
             continue;
         }
         $eventName = $details[0];
         $callbackServiceId = $details[1][0];
         $callbackMethod = $details[1][1];
         $priority = count($details) > 2 ? $details[2] : 0;
         if (!$containerBuilder->hasDefinition($callbackServiceId)) {
             $logger->error(sprintf('Event listener service ID <code>%s</code> does not exist.', $callbackServiceId));
             continue;
         }
         $callbackDefinition = $containerBuilder->getDefinition($callbackServiceId);
         $callbackClass = $callbackDefinition->getClass();
         if (!isset($events[$eventName])) {
             $events[$eventName] = array();
         }
         $events[$eventName][$priority] = sprintf('%s::%s', $callbackClass, $callbackMethod);
     }
     $logger->debug(sprintf('There are %d events that can be triggered. Details follow...', count($events)));
     ksort($events);
     foreach ($events as $eventName => $listeners) {
         krsort($listeners);
         $logger->debug(sprintf('<code>&nbsp;&nbsp;%s</code>', $eventName));
         foreach ($listeners as $priority => $listener) {
             $logger->debug(sprintf('<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;priority %d - %s</code>', $priority, $listener));
         }
     }
 }
示例#20
0
 /**
  * Called during construction of the TubePress service container. If an add-on intends to add
  * services to the container, it should do so here. The incoming `tubepress_api_ioc_ContainerBuilderInterface`
  * will be completely empty, and after this method is executed will be merged into the primary service container.
  *
  * @param tubepress_api_ioc_ContainerBuilderInterface $containerBuilder An empty `tubepress_api_ioc_ContainerBuilderInterface` instance.
  *
  * @return void
  *
  * @api
  * @since 3.2.0
  */
 public function load(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register(tubepress_spi_options_PersistenceBackendInterface::_, 'tubepress_test_scripts_boot_MockPersistence');
     $containerBuilder->register(tubepress_api_translation_TranslatorInterface::_, 'tubepress_test_scripts_boot_MockTranslator');
     $containerBuilder->register(tubepress_api_http_oauth2_Oauth2EnvironmentInterface::_, 'tubepress_test_integration_mocks_MockOauth2UrlProvider');
 }
示例#21
0
 /**
  * {@inheritdoc}
  */
 public function load(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('container_aware_event_dispatcher', 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher')->addArgument(new tubepress_api_ioc_Reference('symfony_service_container'));
     $containerBuilder->register(tubepress_api_event_EventDispatcherInterface::_, 'tubepress_event_impl_tickertape_EventDispatcher')->addArgument(new tubepress_api_ioc_Reference('container_aware_event_dispatcher'));
 }
示例#22
0
 private function _registerPlayer(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('tubepress_youtube3_impl_player_YouTubePlayerLocation', 'tubepress_youtube3_impl_player_YouTubePlayerLocation')->addTag('tubepress_spi_player_PlayerLocationInterface');
 }
示例#23
0
 /**
  * {@inheritdoc}
  */
 public function load(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register(tubepress_api_array_ArrayReaderInterface::_, 'tubepress_array_impl_ArrayReader');
 }
示例#24
0
 private function _process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder, $id)
 {
     $logger = $containerBuilder->get('tubepress_internal_logger_BootLogger');
     $finderFactory = $containerBuilder->get('finder_factory');
     $bootSettings = $containerBuilder->get(tubepress_api_boot_BootSettingsInterface::_);
     $context = $containerBuilder->get(tubepress_api_options_ContextInterface::_);
     $urlFactory = $containerBuilder->get(tubepress_api_url_UrlFactoryInterface::_);
     $langUtils = $containerBuilder->get(tubepress_api_util_LangUtilsInterface::_);
     $stringUtils = $containerBuilder->get(tubepress_api_util_StringUtilsInterface::_);
     $serializer = new tubepress_internal_boot_helper_uncached_Serializer($bootSettings);
     $factory = new tubepress_internal_boot_helper_uncached_contrib_ThemeFactory($context, $urlFactory, $langUtils, $logger, $stringUtils, $finderFactory);
     $manifestFinder = new tubepress_internal_boot_helper_uncached_contrib_ManifestFinder(TUBEPRESS_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . $id, DIRECTORY_SEPARATOR . $id, 'theme.json', $logger, $bootSettings, $finderFactory);
     $manifests = $manifestFinder->find();
     $themes = array();
     foreach ($manifests as $path => $manifestData) {
         $theme = $factory->fromManifestData($path, $manifestData);
         if (is_array($theme)) {
             continue;
         }
         if ($theme->getName() === 'changeme/themename') {
             //ignore the starter theme
             continue;
         }
         $themes[] = $theme;
     }
     $bootArtifacts = $containerBuilder->getParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS);
     $bootArtifacts = array_merge($bootArtifacts, array($id => $serializer->serialize($themes)));
     $containerBuilder->setParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS, $bootArtifacts);
     $containerBuilder->set('tubepress_internal_boot_helper_uncached_contrib_ThemeFactory', $factory);
 }
示例#25
0
 private function _registerTemplatePathProvider(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('tubepress_api_template_BasePathProvider__oauth2', 'tubepress_api_template_BasePathProvider')->addArgument(array(TUBEPRESS_ROOT . '/src/add-ons/http-oauth2/templates'))->addTag('tubepress_spi_template_PathProviderInterface.admin');
 }
示例#26
0
 private function _registerListeners(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('tubepress_http_impl_listeners_UserAgentListener', 'tubepress_http_impl_listeners_UserAgentListener')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_environment_EnvironmentInterface::_))->addTag(tubepress_api_ioc_ServiceTags::EVENT_LISTENER, array('event' => tubepress_api_http_Events::EVENT_HTTP_REQUEST, 'priority' => 100000, 'method' => 'onRequest'));
 }
示例#27
0
 /**
  * {@inheritdoc}
  */
 public function load(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register('tubepress_embedplus_impl_EmbedPlus', 'tubepress_embedplus_impl_EmbedPlus')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_url_UrlFactoryInterface::_))->addTag('tubepress_spi_embedded_EmbeddedProviderInterface')->addTag('tubepress_spi_template_PathProviderInterface')->addTag(tubepress_api_ioc_ServiceTags::EVENT_LISTENER, array('event' => tubepress_api_event_Events::GALLERY_INIT_JS, 'method' => 'onGalleryInitJs', 'priority' => 94000));
 }
示例#28
0
 /**
  * {@inheritdoc}
  */
 public function load(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register(tubepress_api_util_TimeUtilsInterface::_, 'tubepress_util_impl_TimeUtils')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_util_StringUtilsInterface::_));
     $containerBuilder->register(tubepress_api_util_LangUtilsInterface::_, 'tubepress_util_impl_LangUtils');
     $containerBuilder->register(tubepress_api_util_StringUtilsInterface::_, 'tubepress_util_impl_StringUtils');
 }
示例#29
0
 private function _registerServices(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $containerBuilder->register(tubepress_api_media_AttributeFormatterInterface::_, 'tubepress_media_impl_AttributeFormatter')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_options_ContextInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_util_TimeUtilsInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_translation_TranslatorInterface::_));
     $containerBuilder->register(tubepress_api_media_CollectorInterface::_, 'tubepress_media_impl_Collector')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_log_LoggerInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_options_ContextInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_event_EventDispatcherInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_environment_EnvironmentInterface::_));
     $containerBuilder->register(tubepress_api_media_HttpCollectorInterface::_, 'tubepress_media_impl_HttpCollector')->addArgument(new tubepress_api_ioc_Reference(tubepress_api_log_LoggerInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_event_EventDispatcherInterface::_))->addArgument(new tubepress_api_ioc_Reference(tubepress_api_http_HttpClientInterface::_));
 }
示例#30
0
 /**
  * {@inheritdoc}
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     if (!$containerBuilder->hasDefinition(tubepress_api_http_oauth2_Oauth2EnvironmentInterface::_)) {
         $containerBuilder->register(tubepress_api_http_oauth2_Oauth2EnvironmentInterface::_, 'tubepress_http_oauth2_impl_Oauth2Environment');
     }
 }