本文整理汇总了PHP中module::is_installed方法的典型用法代码示例。如果您正苦于以下问题:PHP module::is_installed方法的具体用法?PHP module::is_installed怎么用?PHP module::is_installed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module
的用法示例。
在下文中一共展示了module::is_installed方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($module_name, $var_name)
{
access::verify_csrf();
if (module::is_installed($module_name)) {
module::set_var($module_name, $var_name, Input::instance()->post("value"));
message::success(t("Saved value for %var (%module_name)", array("var" => $var_name, "module_name" => $module_name)));
json::reply(array("result" => "success"));
}
}
示例2: head
static function head($theme)
{
if (module::is_installed("rss") && ($theme->item() || $theme->tag())) {
if ($item = $theme->item()) {
$url = rss::feed_link("gallery/album/{$item->id}");
} else {
if ($tag = $theme->tag()) {
$url = rss::feed_link("tag/tag/{$tag->id}");
}
}
// Polar Rose doesn't understand relative URLs. Hack around that until they fix it.
$url = url::abs_site(substr($url, strpos($url, "index.php") + 10));
return "<script type=\"text/javascript\">" . "var polarroseconfig = {" . "partner: 'gallery3'," . "rss: '{$url}'," . "insert: 'g-polar-rose'," . "optin: ''," . "theme: 'dark'," . "progress: true" . "}</script>" . "<script type=\"text/javascript\" " . "src=\"http://cdn.widget.polarrose.com/polarrosewidget.js\">" . "</script>";
}
}
示例3: head
static function head($theme)
{
if (module::is_installed("media_rss")) {
if ($theme->item()) {
$url = media_rss::item_feed($theme->item());
} else {
if ($theme->tag()) {
$url = media_rss::tag_feed($theme->tag());
}
}
// Polar Rose doesn't understand relative URLs. Hack around that until they fix it.
$url = url::abs_site(substr($url, strpos($url, "index.php") + 10));
return "<script type=\"text/javascript\">" . "var polarroseconfig = {" . "partner: 'gallery3'," . "rss: '{$url}'," . "insert: 'gPolarRose'," . "optin: ''," . "theme: 'dark'" . "}</script>" . "<script type=\"text/javascript\" " . "src=\"http://cdn.widget.polarrose.com/widgetanddashboard/" . "polarrosewidgetanddashboard.js\">" . "</script>";
}
}
示例4: _add
/**
* Add a log entry.
*
* @param string $category an arbitrary category we can use to filter log messages
* @param string $message a detailed log message
* @param integer $severity INFO, WARNING or ERROR
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
private static function _add($category, $message, $html, $severity)
{
$log = ORM::factory("log");
$log->category = $category;
$log->message = $message;
$log->severity = $severity;
$log->html = $html;
$log->url = url::abs_current(true);
$log->referer = request::referrer(null);
$log->timestamp = time();
if (module::is_installed("user")) {
$log->user_id = user::active()->id;
}
$log->save();
}
示例5: save
public function save()
{
access::verify_csrf();
$changes->activate = array();
$changes->deactivate = array();
$activated_names = array();
$deactivated_names = array();
foreach (module::available() as $module_name => $info) {
if ($info->locked) {
continue;
}
$desired = Input::instance()->post($module_name) == 1;
if ($info->active && !$desired && module::is_active($module_name)) {
$changes->deactivate[] = $module_name;
$deactivated_names[] = t($info->name);
module::deactivate($module_name);
} else {
if (!$info->active && $desired && !module::is_active($module_name)) {
$changes->activate[] = $module_name;
$activated_names[] = t($info->name);
if (module::is_installed($module_name)) {
module::upgrade($module_name);
} else {
module::install($module_name);
}
module::activate($module_name);
}
}
}
module::event("module_change", $changes);
// @todo this type of collation is questionable from an i18n perspective
if ($activated_names) {
message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
}
if ($deactivated_names) {
message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
}
url::redirect("admin/modules");
}
示例6: available
/**
* Return the list of available modules, including uninstalled modules.
*/
static function available()
{
if (empty(self::$available)) {
$modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
foreach (glob(MODPATH . "*/module.info") as $file) {
$module_name = basename(dirname($file));
$modules->{$module_name} = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
foreach ($modules->{$module_name} as &$value) {
$value = html::purify($value);
}
$m =& $modules->{$module_name};
$m->installed = module::is_installed($module_name);
$m->active = module::is_active($module_name);
$m->code_version = $m->version;
$m->version = module::get_version($module_name);
$m->locked = false;
if ($m->active && $m->version != $m->code_version) {
site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::abs_site("upgrader"))), "upgrade_now");
}
}
// Lock certain modules
$modules->gallery->locked = true;
$identity_module = module::get_var("gallery", "identity_provider", "user");
$modules->{$identity_module}->locked = true;
$modules->uasort(array("module", "module_comparator"));
self::$available = $modules;
}
return self::$available;
}
示例7: _do_save
private function _do_save()
{
$changes = new stdClass();
$changes->activate = array();
$changes->deactivate = array();
$activated_names = array();
$deactivated_names = array();
foreach (module::available() as $module_name => $info) {
if ($info->locked) {
continue;
}
try {
$desired = Input::instance()->post($module_name) == 1;
if ($info->active && !$desired && module::is_active($module_name)) {
module::deactivate($module_name);
$changes->deactivate[] = $module_name;
$deactivated_names[] = t($info->name);
} else {
if (!$info->active && $desired && !module::is_active($module_name)) {
if (module::is_installed($module_name)) {
module::upgrade($module_name);
} else {
module::install($module_name);
}
module::activate($module_name);
$changes->activate[] = $module_name;
$activated_names[] = t($info->name);
}
}
} catch (Exception $e) {
message::warning(t("An error occurred while installing the <b>%module_name</b> module", array("module_name" => $info->name)));
Kohana_Log::add("error", (string) $e);
}
}
module::event("module_change", $changes);
// @todo this type of collation is questionable from an i18n perspective
if ($activated_names) {
message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
}
if ($deactivated_names) {
message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
}
}
示例8: _get_all_groups
/**
* Internal method to get all available groups.
*
* @return ORM_Iterator
*/
private static function _get_all_groups()
{
if (module::is_installed("user")) {
return ORM::factory("group")->find_all();
} else {
return array();
}
}
示例9: t
</th>
<th> <?php
echo t("Description");
?>
</th>
</tr>
<? $i = 0 ?>
<? foreach ($available as $module_name => $module_info): ?>
<tr class="<?php
echo $i % 2 == 0 ? "gEvenRow" : "gOddRow";
?>
">
<? $data = array("name" => $module_name); ?>
<? if ($module_info->locked) $data["disabled"] = 1; ?>
<td> <?php
echo form::checkbox($data, '1', module::is_installed($module_name));
?>
</td>
<td> <?php
echo t($module_info->name);
?>
</td>
<td> <?php
echo $module_info->version;
?>
</td>
<td> <?php
echo t($module_info->description);
?>
</td>
</tr>