本文整理汇总了PHP中module::installed方法的典型用法代码示例。如果您正苦于以下问题:PHP module::installed方法的具体用法?PHP module::installed怎么用?PHP module::installed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module
的用法示例。
在下文中一共展示了module::installed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: site
static function site($menu, $theme)
{
if (file_exists(APPPATH . "controllers/welcome.php")) {
$menu->append(Menu::factory("link")->id("browse")->label("Scaffold")->url(url::site("welcome")));
}
$menu->append(Menu::factory("link")->id("home")->label(t("Home"))->url(url::site("albums/1")));
$item = $theme->item();
if ($item && access::can("edit", $item)) {
$menu->append($options_menu = Menu::factory("submenu")->id("options_menu")->label(t("Options"))->append(Menu::factory("dialog")->id("edit_item")->label($item->type == "album" ? t("Edit album") : t("Edit photo"))->url(url::site("form/edit/{$item->type}s/{$item->id}"))));
// @todo Move album options menu to the album quick edit pane
// @todo Create resized item quick edit pane menu
if ($item->type == "album") {
$options_menu->append(Menu::factory("dialog")->id("add_item")->label(t("Add a photo"))->url(url::site("form/add/albums/{$item->id}?type=photo")))->append(Menu::factory("dialog")->id("add_album")->label(t("Add an album"))->url(url::site("form/add/albums/{$item->id}?type=album")))->append(Menu::factory("dialog")->id("edit_permissions")->label(t("Edit permissions"))->url(url::site("permissions/browse/{$item->id}")));
}
}
if (user::active()->admin) {
$menu->append($admin_menu = Menu::factory("submenu")->id("admin_menu")->label(t("Admin")));
self::admin($admin_menu, $theme);
foreach (module::installed() as $module) {
if ($module->name == "core") {
continue;
}
$class = "{$module->name}_menu";
if (method_exists($class, "admin")) {
call_user_func_array(array($class, "admin"), array(&$admin_menu, $this));
}
}
}
}
示例2: _get_task_definitions
/**
* Get all available tasks
* @todo move task definition out into the modules
*/
private function _get_task_definitions()
{
$tasks = array();
foreach (module::installed() as $module_name => $module_info) {
$class_name = "{$module_name}_task";
if (method_exists($class_name, "available_tasks")) {
foreach (call_user_func(array($class_name, "available_tasks")) as $task) {
$tasks[$task->callback] = $task;
}
}
}
return $tasks;
}
示例3: update_record
static function update_record($record)
{
$data = array();
foreach (module::installed() as $module_name => $module_info) {
$class_name = "{$module_name}_search";
if (method_exists($class_name, "item_index_data")) {
$data[] = call_user_func(array($class_name, "item_index_data"), $record->item());
}
}
$record->data = join(" ", $data);
$record->dirty = 0;
$record->save();
}
示例4: get_available
static function get_available()
{
$blocks = array();
foreach (module::installed() as $module) {
$class_name = "{$module->name}_block";
if (method_exists($class_name, "get_list")) {
foreach (call_user_func(array($class_name, "get_list")) as $id => $title) {
$blocks["{$module->name}:{$id}"] = $title;
}
}
}
return $blocks;
}
示例5: __call
/**
* Handle all theme functions that insert module content.
*/
public function __call($function, $args)
{
switch ($function) {
case "album_blocks":
case "album_bottom":
case "album_top":
case "credits":
case "footer":
case "head":
case "header_bottom":
case "header_top":
case "page_bottom":
case "page_top":
case "photo_blocks":
case "photo_top":
case "sidebar_blocks":
case "sidebar_bottom":
case "sidebar_top":
case "tag_bottom":
case "tag_top":
case "thumb_bottom":
case "thumb_info":
case "thumb_top":
case "photo_bottom":
$blocks = array();
foreach (module::installed() as $module) {
$helper_class = "{$module->name}_theme";
if (method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(array($helper_class, $function), array_merge(array($this), $args));
}
}
if (Session::instance()->get("debug")) {
if ($function != "head") {
array_unshift($blocks, "<div class=\"gAnnotatedThemeBlock gAnnotatedThemeBlock_{$function} gClearFix\">" . "<div class=\"title\">{$function}</div>");
$blocks[] = "</div>";
}
}
return implode("\n", $blocks);
default:
throw new Exception("@todo UNKNOWN_THEME_FUNCTION: {$function}");
}
}
示例6: edit
public function edit($id)
{
$page = ORM::factory('page', (int) $id);
if (!$page->loaded) {
message::error(__('Invalid ID'), 'admin/page');
}
$form = Formo::factory()->plugin('csrf')->add_group('type', array('none' => __('Do nothing'), 'module' => __('Load module'), 'redirect' => __('Redirect to')))->add_select('module', module::installed_as_array(), array('value' => $page->target))->add_select('redirect', $page->paths(), array('value' => $page->target))->add('submit', 'submit', array('label' => __('Save')));
foreach (Kohana::config('locale.languages') as $key => $value) {
$page_content = ORM::factory('page_content')->where(array('page_id' => $page->id, 'language' => $key))->find();
$form->add('text', 'title_' . $key, array('label' => __('Title'), 'value' => $page_content->title))->add('text', 'content_' . $key, array('label' => __('Content'), 'value' => $page_content->content))->add_rule('title_' . $key, 'required', __('Please choose a title'));
}
if ($form->validate()) {
$title = array();
foreach (Kohana::config('locale.languages') as $key => $value) {
$page_content = ORM::factory('page_content')->where(array('page_id' => $page->id, 'language' => $key))->find();
if (!$page_content->loaded) {
$page_content->page_id = $page->id;
$page_content->language = $key;
$page_content->date = date("Y-m-d H:i:s");
}
$page_content->title = $form->{'title_' . $key}->value;
$page_content->uri = url::title($form->{'title_' . $key}->value);
$page_content->content = $form->{'content_' . $key}->value;
$page_content->modified = date("Y-m-d H:i:s");
$page_content->save();
$title[] = $page_content->title;
}
$type = NULL;
$target = NULL;
/*
* TODO workaround for:
* http://projects.kohanaphp.com/boards/5/topics/114
* and
* http://projects.kohanaphp.com/issues/1697
*
* fixed in Formo 1.2
*
*/
$_type = NULL;
foreach ($form->type->elements as $key => $value) {
if ($form->type->{$key}->checked) {
$_type = $value;
break;
}
}
if ($_type == 'redirect') {
$redirect = trim($form->redirect->value);
if (!empty($redirect)) {
$type = 'redirect';
$target = $redirect;
}
} elseif ($_type == 'module') {
$module = trim($form->module->value);
if (!empty($module)) {
$type = 'module';
$target = $module;
}
}
$page->type = $type;
$page->target = $target;
$page->title = implode(' / ', $title);
$page->save();
Cache::instance()->delete_tag('menu');
Cache::instance()->delete_tag('route');
message::info(__('Page edited successfully'), 'admin/page');
}
$this->template->content = View::factory('page/edit', $form->get(TRUE));
$this->template->content->page = $page;
$this->template->content->modules = module::installed();
}
示例7: __
<?php
echo html::anchor('admin/modules/status/' . $module . '/on', __('enable'));
?>
<?php
}
?>
<?php
} else {
?>
<?php
echo html::anchor('admin/modules/install/' . $module, __('install'));
?>
<?php
}
?>
</td>
<td class="delete">
<?php
if (module::installed($module)) {
echo html::anchor('admin/modules/uninstall/' . $module, html::image('themes/admin/images/delete.png', array('alt' => __('Uninstall Module'), 'title' => __('Uninstall Module'))));
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}