public function alter_galleryTemplate(org_tubepress_api_template_Template $template, org_tubepress_api_provider_ProviderResult $providerResult, $page, $providerName) { $ioc = org_tubepress_impl_ioc_IocContainer::getInstance(); $context = $ioc->get('org_tubepress_api_exec_ExecutionContext'); $pm = $ioc->get('org_tubepress_api_plugin_PluginManager'); $pagination = $this->_getHtml($providerResult->getEffectiveTotalResultCount()); $pagination = $pm->runFilters(org_tubepress_api_const_plugin_FilterPoint::HTML_PAGINATION, $pagination); if ($context->get(org_tubepress_api_const_options_names_Display::PAGINATE_ABOVE)) { $template->setVariable(org_tubepress_api_const_template_Variable::PAGINATION_TOP, $pagination); } if ($context->get(org_tubepress_api_const_options_names_Display::PAGINATE_BELOW)) { $template->setVariable(org_tubepress_api_const_template_Variable::PAGINATION_BOTTOM, $pagination); } return $template; }
public function alter_providerResult(org_tubepress_api_provider_ProviderResult $providerResult) { $totalResults = $providerResult->getEffectiveTotalResultCount(); $ioc = org_tubepress_impl_ioc_IocContainer::getInstance(); $context = $ioc->get(org_tubepress_api_exec_ExecutionContext::_); $limit = $context->get(org_tubepress_api_const_options_names_Feed::RESULT_COUNT_CAP); $firstCut = $limit == 0 ? $totalResults : min($limit, $totalResults); $secondCut = min($firstCut, self::_calculateRealMax($context, $firstCut)); $videos = $providerResult->getVideoArray(); $resultCount = count($videos); org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Effective total result count (taking into account user-defined limit) is %d video(s)', $secondCut); if ($resultCount > $secondCut) { org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Result has %d video(s), limit is %d. So we\'re chopping it down.', $resultCount, $secondCut); $providerResult->setVideoArray(array_splice($videos, 0, $secondCut - $resultCount)); } $providerResult->setEffectiveTotalResultCount($secondCut); return $providerResult; }