本文整理汇总了PHP中AppContext::get_extension_provider_service方法的典型用法代码示例。如果您正苦于以下问题:PHP AppContext::get_extension_provider_service方法的具体用法?PHP AppContext::get_extension_provider_service怎么用?PHP AppContext::get_extension_provider_service使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppContext
的用法示例。
在下文中一共展示了AppContext::get_extension_provider_service方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __static
public static function __static()
{
$extension_points = AppContext::get_extension_provider_service()->get_extension_point(CssFilesExtensionPoint::EXTENSION_POINT);
foreach ($extension_points as $module_id => $provider) {
self::$modules_css_files[$module_id] = $provider;
}
}
示例2: execute
public function execute(HTTPRequestCustom $request)
{
$module_id = $request->get_getstring('module_id', '');
if (empty($module_id)) {
AppContext::get_response()->redirect(Environment::get_home_page());
}
$this->init();
$module_category_id = $request->get_getint('module_category_id', 0);
$feed_name = $request->get_getstring('feed_name', Feed::DEFAULT_FEED_NAME);
$feed = new ATOM($module_id, $feed_name, $module_category_id);
if ($feed !== null && $feed->is_in_cache()) {
$this->tpl->put('SYNDICATION', $feed->read());
} else {
$eps = AppContext::get_extension_provider_service();
if ($eps->provider_exists($module_id, FeedProvider::EXTENSION_POINT)) {
$provider = $eps->get_provider($module_id);
$feeds = $provider->feeds();
$data = $feeds->get_feed_data_struct($module_category_id, $feed_name);
if ($data === null) {
AppContext::get_response()->set_header('content-type', 'text/html');
DispatchManager::redirect(PHPBoostErrors::unexisting_element());
} else {
$feed->load_data($data);
$feed->cache();
$this->tpl->put('SYNDICATION', $feed->export());
}
} else {
DispatchManager::redirect(PHPBoostErrors::module_not_installed());
}
}
return $this->build_response($this->tpl);
}
示例3: build_form
private function build_form()
{
$modules = AppContext::get_extension_provider_service()->get_extension_point(UserExtensionPoint::EXTENSION_POINT);
foreach ($modules as $module) {
$img = $module->get_messages_list_link_img();
$this->tpl->assign_block_vars('available_modules_msg', array('NAME_USER_MSG' => $module->get_messages_list_link_name(), 'IMG_USER_MSG' => $img, 'C_IMG_USER_MSG' => !empty($img), 'U_LINK_USER_MSG' => $module->get_messages_list_url($this->user->get_id())));
}
$this->tpl->put_all(array('L_MESSAGES' => $this->lang['messages']));
}
示例4: get_modules_weighting
public function get_modules_weighting()
{
$weighting = array();
$provider_service = AppContext::get_extension_provider_service();
foreach ($provider_service->get_providers(SearchableExtensionPoint::EXTENSION_POINT) as $module_id => $provider) {
$weighting[$module_id] = $this->get_module_weighting($module_id);
}
return $weighting;
}
示例5: test_get_module
function test_get_module()
{
global $MODULES;
self::assertTrue(count($MODULES) > 0);
$modulediscovery = AppContext::get_extension_provider_service();
$ret = $modulediscovery->get_provider('news');
self::assertIsA($ret, 'ExtensionPointProvider');
self::assertIsA($modulediscovery->loaded_modules['news'], 'ExtensionPointProvider');
}
示例6: load_commands_list
private function load_commands_list()
{
$provider_service = AppContext::get_extension_provider_service();
$extension_point = $provider_service->get_extension_point(CLICommands::EXTENSION_POINT);
foreach ($extension_point as $commands) {
foreach ($commands->get_commands() as $command) {
$this->commands[$command] = $commands;
}
}
}
示例7: get_tree_links
public static function get_tree_links($module_name)
{
try {
return AppContext::get_extension_provider_service()->get_provider($module_name)->get_extension_point(ModuleTreeLinksExtensionPoint::EXTENSION_POINT);
} catch (UnexistingExtensionPointProviderException $e) {
return null;
} catch (ExtensionPointNotFoundException $e) {
return null;
}
}
示例8: call
private function call($command, array $args)
{
$provider_service = AppContext::get_extension_provider_service();
$providers = $provider_service->get_providers(CLICommands::EXTENSION_POINT);
foreach ($providers as $provider) {
$commands = $provider->get_extension_point(CLICommands::EXTENSION_POINT);
if (in_array($command, $commands->get_commands())) {
$commands->help($command, $args);
return;
}
}
CLIOutput::writeln('command ' . $command . ' does not exist');
$this->help(array());
}
示例9: get_html_results
/**
* Renvoie une chaine contenant les resultats
*/
function get_html_results(&$results, &$html_results, &$results_name)
{
$provider_service = AppContext::get_extension_provider_service();
$display_all_results = $results_name == 'all' ? true : false;
$tpl_results = new FileTemplate('search/search_generic_pagination_results.tpl');
$tpl_results->assign_vars(array('RESULTS_NAME' => $results_name, 'C_ALL_RESULTS' => $display_all_results));
$nb_pages = round(count($results) / NB_RESULTS_PER_PAGE) + 1;
$nb_results = count($results);
if (!$display_all_results) {
$provider = $provider_service->get_provider(strtolower($results_name));
$extension_point = $provider->get_extension_point(SearchableExtensionPoint::EXTENSION_POINT);
$results_data = array();
$personnal_parse_results = $extension_point->has_customized_results();
if ($personnal_parse_results && $results_name != 'all') {
$results_data = $extension_point->compute_search_results(array('results' => $results));
$nb_results = min($nb_results, count($results_data));
}
}
for ($num_page = 0; $num_page < $nb_pages; $num_page++) {
$tpl_results->assign_block_vars('page', array('NUM_PAGE' => $num_page, 'BLOCK_DISPLAY' => $num_page == 0 ? 'block' : 'none'));
for ($i = 0; $i < NB_RESULTS_PER_PAGE; $i++) {
$num_item = $num_page * NB_RESULTS_PER_PAGE + $i;
if ($num_item >= $nb_results) {
break;
}
if ($display_all_results || !$personnal_parse_results) {
$tpl_result = new FileTemplate('search/search_generic_results.tpl');
$module = ModulesManager::get_module($results[$num_item]['module']);
if ($display_all_results) {
$tpl_result->assign_vars(array('C_ALL_RESULTS' => true, 'L_MODULE_NAME' => $module->get_configuration()->get_name()));
} else {
$tpl_result->assign_vars(array('C_ALL_RESULTS' => false, 'L_MODULE_NAME' => $module->get_configuration()->get_name()));
}
$tpl_result->assign_vars(array('TITLE' => $results[$num_item]['title'], 'U_LINK' => url($results[$num_item]['link'])));
$tpl_results->assign_block_vars('page.results', array('result' => $tpl_result->render()));
} else {
$tpl_results->assign_block_vars('page.results', array('result' => $extension_point->parse_search_result($results_data[$num_item])));
}
}
}
$html_results = $tpl_results->render();
}
示例10: execute
public function execute(HTTPRequestCustom $request)
{
$general_config = GeneralConfig::load();
$other_home_page = $general_config->get_other_home_page();
if (strpos($other_home_page, '/index.php') !== false) {
AppContext::get_response()->redirect(UserUrlBuilder::home());
} else {
if (!empty($other_home_page)) {
AppContext::get_response()->redirect($other_home_page);
} else {
try {
$module = AppContext::get_extension_provider_service()->get_provider($general_config->get_module_home_page());
if ($module->has_extension_point(HomePageExtensionPoint::EXTENSION_POINT)) {
$home_page = $module->get_extension_point(HomePageExtensionPoint::EXTENSION_POINT)->get_home_page();
return $this->build_response($home_page->get_view(), $home_page->get_title());
} else {
AppContext::get_response()->redirect(UserUrlBuilder::home());
}
} catch (UnexistingExtensionPointProviderException $e) {
AppContext::get_response()->redirect(UserUrlBuilder::home());
}
}
}
}
示例11: array
$tpl->assign_block_vars('image_up', array('NAME' => stripslashes($imageup['name']), 'IMG' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '&id=' . $g_idpics . '#pics_max"><img src="pics/' . $imageup['path'] . '" alt="' . $imageup['name'] . '" /></a>', 'L_SUCCESS_UPLOAD' => $LANG['success_upload_img'], 'U_CAT' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '">' . $categories[$imageup['idcat']]->get_name() . '</a>'));
}
//Affichage du quota d'image uploadée.
$category_authorizations = GalleryService::get_categories_manager()->get_heritated_authorizations($id_category, Category::WRITE_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY);
$quota = isset($category_authorizations['r-1']) ? $category_authorizations['r-1'] != '3' : true;
if ($quota) {
switch (AppContext::get_current_user()->get_level()) {
case 2:
$l_pics_quota = $LANG['illimited'];
break;
case 1:
$l_pics_quota = $config->get_moderator_max_pics_number();
break;
default:
$l_pics_quota = $config->get_member_max_pics_number();
}
$nbr_upload_pics = $Gallery->get_nbr_upload_pics(AppContext::get_current_user()->get_id());
$tpl->assign_block_vars('image_quota', array('L_IMAGE_QUOTA' => sprintf($LANG['image_quota'], $nbr_upload_pics, $l_pics_quota)));
}
$search_category_children_options = new SearchCategoryChildrensOptions();
$search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS);
$search_category_children_options->add_authorizations_bits(Category::WRITE_AUTHORIZATIONS);
$tpl->put_all(array('CAT_ID' => $id_category, 'GALLERY' => !empty($id_category) ? $categories[$id_category]->get_name() : $LANG['gallery'], 'CATEGORIES_TREE' => GalleryService::get_categories_manager()->get_select_categories_form_field('cat', LangLoader::get_message('form.category', 'common'), $id_category, $search_category_children_options)->display()->render(), 'WIDTH_MAX' => $config->get_max_width(), 'HEIGHT_MAX' => $config->get_max_height(), 'WEIGHT_MAX' => $config->get_max_weight(), 'IMG_FORMAT' => 'JPG, PNG, GIF', 'L_IMG_FORMAT' => $LANG['img_format'], 'L_WIDTH_MAX' => $LANG['width_max'], 'L_HEIGHT_MAX' => $LANG['height_max'], 'L_WEIGHT_MAX' => $LANG['weight_max'], 'L_ADD_IMG' => $LANG['add_pic'], 'L_GALLERY' => $LANG['gallery'], 'L_GALLERY_INDEX' => $LANG['gallery_index'], 'L_CATEGORIES' => $LANG['categories'], 'L_NAME' => $LANG['name'], 'L_UNIT_PX' => LangLoader::get_message('unit.pixels', 'common'), 'L_UNIT_KO' => LangLoader::get_message('unit.kilobytes', 'common'), 'L_UPLOAD' => $LANG['upload_img'], 'U_GALLERY_CAT_LINKS' => $cat_links, 'U_GALLERY_ACTION_ADD' => GalleryUrlBuilder::get_link_cat_add($id_category, null, AppContext::get_session()->get_token()), 'U_INDEX' => url('.php')));
$tpl->display();
} else {
$module = AppContext::get_extension_provider_service()->get_provider('gallery');
if ($module->has_extension_point(HomePageExtensionPoint::EXTENSION_POINT)) {
echo $module->get_extension_point(HomePageExtensionPoint::EXTENSION_POINT)->get_home_page()->get_view()->display();
}
}
require_once '../kernel/footer.php';
示例12: get_extension_point
public static function get_extension_point()
{
return AppContext::get_extension_provider_service()->get_extension_point(MenusExtensionPoint::EXTENSION_POINT);
}
示例13: get_extended_fields_class_name
private function get_extended_fields_class_name()
{
$providers = AppContext::get_extension_provider_service()->get_providers(ExtendedFieldExtensionPoint::EXTENSION_POINT);
$extended_fields_class_name = array();
foreach ($providers as $name_provider => $properties) {
$extended_fields_extension_point = $properties->get_extension_point(ExtendedFieldExtensionPoint::EXTENSION_POINT);
$extended_fields = $extended_fields_extension_point->get_extended_fields();
$extended_fields_list = array();
foreach ($extended_fields as $extended_field) {
if (!$extended_field->get_field_used_once() || get_class($extended_field) == $this->extended_field['field_type']) {
$extended_fields_list[] = $extended_field;
}
}
if (!empty($extended_fields_list)) {
$extended_fields_class_name[$name_provider] = $extended_fields_list;
}
}
return $extended_fields_class_name;
}
示例14: get_parsed
/**
* @desc Export a feed
* @param string $module_id the module id
* @param string $name the feed name / type
* @param int $idcat the feed data category
* @param mixed $tpl If false, uses de default tpl. If an associative array,
* uses the default tpl but assigns it the array vars first.
* It could also be a Template object
* @param int $number the number of item to display
* @param int $begin_at the first item to display
* @return string The exported feed
* @static
*/
public static function get_parsed($module_id, $name = self::DEFAULT_FEED_NAME, $idcat = 0, $template = false, $number = 10, $begin_at = 0)
{
if (!$template instanceof Template) {
$template = new FileTemplate($module_id . '/framework/content/syndication/feed.tpl');
if (gettype($template) == 'array') {
$template->put_all($template);
}
}
$feed_data_cache_file_exists = true;
// Get the cache content or recreate it if not existing
$feed_data_cache_file = FEEDS_PATH . $module_id . '_' . $name . '_' . $idcat . '.php';
if (!file_exists($feed_data_cache_file)) {
$extension_provider_service = AppContext::get_extension_provider_service();
$provider = $extension_provider_service->get_provider($module_id);
if (!$provider->has_extension_point(FeedProvider::EXTENSION_POINT)) {
// If the module is not installed or doesn't have the get_feed_data_struct
// functionality we break
return '';
}
$feed_provider = $provider->get_extension_point(FeedProvider::EXTENSION_POINT);
$data = $feed_provider->get_feed_data_struct($idcat);
$feed_data_cache_file_exists = self::update_cache($module_id, $name, $data, $idcat);
}
if ($feed_data_cache_file_exists) {
include $feed_data_cache_file;
$feed = new Feed($module_id, $name);
$feed->load_data($__feed_object);
return $feed->export($template, $number, $begin_at);
} else {
MessageHelper::display(sprintf(ERROR_GETTING_CACHE, $module_id, $idcat), MessageHelper::WARNING);
return '';
}
}
示例15: add_in_visit_counter
public static function add_in_visit_counter()
{
$ip_address = AppContext::get_request()->get_ip_address();
$has_already_visited = PersistenceContext::get_querier()->row_exists(DB_TABLE_VISIT_COUNTER, 'WHERE ip=:ip', array('ip' => $ip_address));
$is_robot = Robots::is_robot();
if (!$has_already_visited && !$is_robot) {
$now = new Date(Date::DATE_NOW, Timezone::SITE_TIMEZONE);
$time = $now->format('Y-m-d', Timezone::SITE_TIMEZONE);
PersistenceContext::get_querier()->inject("UPDATE " . DB_TABLE_VISIT_COUNTER . " SET ip = ip + 1, time=:time, total = total + 1 WHERE id = 1", array('time' => $time));
PersistenceContext::get_querier()->insert(DB_TABLE_VISIT_COUNTER, array('ip' => $ip_address, 'time' => $time, 'total' => 0));
}
$jobs = AppContext::get_extension_provider_service()->get_extension_point(ScheduledJobExtensionPoint::EXTENSION_POINT);
foreach ($jobs as $job) {
$job->on_new_session(!$has_already_visited, $is_robot);
}
}