本文整理汇总了PHP中module::is_active方法的典型用法代码示例。如果您正苦于以下问题:PHP module::is_active方法的具体用法?PHP module::is_active怎么用?PHP module::is_active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module
的用法示例。
在下文中一共展示了module::is_active方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: head
static function head($theme)
{
$session = Session::instance();
$buf = "";
$buf .= $theme->css("gallery.css");
if ($session->get("debug")) {
$buf .= $theme->css("debug.css");
}
if (module::is_active("rss")) {
if ($item = $theme->item()) {
if ($item->is_album()) {
$buf .= rss::feed_link("gallery/album/{$item->id}");
} else {
$buf .= rss::feed_link("gallery/album/{$item->parent()->id}");
}
} else {
if ($tag = $theme->tag()) {
$buf .= rss::feed_link("tag/tag/{$tag->id}");
}
}
}
if (count(locales::installed())) {
// Needed by the languages block
$buf .= $theme->script("jquery.cookie.js");
}
if ($session->get("l10n_mode", false)) {
$buf .= $theme->css("l10n_client.css") . $theme->script("jquery.cookie.js") . $theme->script("l10n_client.js");
}
$buf .= $theme->css("uploadify/uploadify.css");
return $buf;
}
示例2: head
static function head($theme)
{
$session = Session::instance();
$buf = "";
if ($session->get("debug")) {
$theme->css("modules/gallery/css/debug.css");
}
if (($theme->page_type == "album" || $theme->page_type == "photo") && access::can("edit", $theme->item())) {
$theme->css("modules/gallery/css/quick.css");
$theme->script("modules/gallery/js/quick.js");
}
if (module::is_active("rss")) {
if ($item = $theme->item()) {
$buf .= rss::feed_link("gallery/album/{$item->id}");
} else {
if ($tag = $theme->tag()) {
$buf .= rss::feed_link("tag/tag/{$tag->id}");
}
}
}
if ($session->get("l10n_mode", false)) {
$theme->css("modules/gallery/css/l10n_client.css");
$theme->script("lib/jquery.cookie.js");
$theme->script("modules/gallery/js/l10n_client.js");
}
return $buf;
}
示例3: head
static function head($theme)
{
$session = Session::instance();
$buf = "";
if ($session->get("debug")) {
$buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . url::file("modules/gallery/css/debug.css") . "\" />";
}
if (($theme->page_type == "album" || $theme->page_type == "photo") && access::can("edit", $theme->item())) {
$buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . url::file("modules/gallery/css/quick.css") . "\" />";
$buf .= html::script("modules/gallery/js/quick.js");
}
if ($theme->page_type == "photo" && access::can("view_full", $theme->item())) {
$buf .= "<script type=\"text/javascript\" >" . " var fullsize_detail = { " . " close: \"" . url::file("modules/gallery/images/ico-close.png") . "\", " . " url: \"" . $theme->item()->file_url() . "\", " . " width: " . $theme->item()->width . ", " . " height: " . $theme->item()->height . "};" . "</script>";
$buf .= html::script("modules/gallery/js/fullsize.js");
}
if (module::is_active("rss")) {
if ($item = $theme->item()) {
$buf = rss::feed_link("gallery/album/{$item->id}");
} else {
if ($tag = $theme->tag()) {
$buf = rss::feed_link("tag/tag/{$tag->id}");
}
}
}
if ($session->get("l10n_mode", false)) {
$buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . url::file("modules/gallery/css/l10n_client.css") . "\" />";
$buf .= html::script("lib/jquery.cookie.js");
$buf .= html::script("modules/gallery/js/l10n_client.js");
}
return $buf;
}
示例4: feed
public function feed($module_id, $feed_id, $id = null)
{
$page = (int) Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
}
// Configurable page size between 1 and 100, default 20
$page_size = max(1, min(100, (int) Input::instance()->get("page_size", self::$page_size)));
// Run the appropriate feed callback
if (module::is_active($module_id)) {
$class_name = "{$module_id}_rss";
if (method_exists($class_name, "feed")) {
$feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
}
}
if (empty($feed)) {
throw new Kohana_404_Exception();
}
if ($feed->max_pages && $page > $feed->max_pages) {
url::redirect(url::merge(array("page" => $feed->max_pages)));
}
$view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
unset($feed->view);
$view->feed = $feed;
$view->pub_date = date("D, d M Y H:i:s T");
$feed->uri = url::abs_site(url::merge($_GET));
if ($page > 1) {
$feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
}
if ($page < $feed->max_pages) {
$feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
}
header("Content-Type: application/rss+xml");
print $view;
}
示例5: head
static function head($theme)
{
$session = Session::instance();
$buf = "";
if ($session->get("debug")) {
$theme->css("debug.css");
}
if (module::is_active("rss")) {
if ($item = $theme->item()) {
if ($item->is_album()) {
$buf .= rss::feed_link("gallery/album/{$item->id}");
} else {
$buf .= rss::feed_link("gallery/album/{$item->parent()->id}");
}
} else {
if ($tag = $theme->tag()) {
$buf .= rss::feed_link("tag/tag/{$tag->id}");
}
}
}
if ($session->get("l10n_mode", false)) {
$theme->css("l10n_client.css");
$theme->script("jquery.cookie.js");
$theme->script("l10n_client.js");
}
return $buf;
}
示例6: 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 = $this->input->post($module_name) == 1;
if ($info->active && !$desired && module::is_active($module_name)) {
$changes->deactivate[] = $module_name;
$deactivated_names[] = $info->name;
module::deactivate($module_name);
} else {
if (!$info->active && $desired && !module::is_active($module_name)) {
$changes->activate[] = $module_name;
$activated_names[] = $info->name;
module::install($module_name);
module::activate($module_name);
}
}
}
module::event("module_change", $changes);
// @todo this type of collation is questionable from a 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");
}
示例7: export_fb
public function export_fb($a)
{
if ($_GET['a'] == "albums") {
// Generate an array of albums in the items table,
// skip id=1 as its the root album.
$albums = ORM::factory("item")->where("type", "=", "album")->where("id", "!=", "1")->viewable()->find_all();
// Loop through each album and output the necessary information.
foreach ($albums as $album) {
$album_contents = ORM::factory("item")->where("parent_id", "=", $album->id)->where("type", "=", "photo")->viewable()->find_all();
print $album->level - 2 . "\t" . $album->id . "\t" . $album->name . "\t" . count($album_contents) . "\n";
}
} else {
if ($_GET['a'] == "photos") {
// Generate an array of photo's in the specified album.
$photos = ORM::factory("item")->where("type", "=", "photo")->where("parent_id", "=", $_GET['id'])->viewable()->find_all();
// Loop through each photo, generate a list of tags (if available) and then output the necessary information.
foreach ($photos as $photo) {
$photo_keywords = "";
if (module::is_active("tag")) {
$photo_tags = ORM::factory("tag")->join("items_tags", "tags.id", "items_tags.tag_id")->where("items_tags.item_id", "=", $photo->id)->find_all();
foreach ($photo_tags as $tag) {
$photo_keywords = $photo_keywords . $tag->name . ", ";
}
// Cut off the ", " from the end of the string.
if ($photo_keywords != "") {
$photo_keywords = substr($photo_keywords, 0, -2);
}
}
print $photo->id . "\t" . $photo->title . "\t" . stristr($photo->resize_url(false), "/var/") . "\t" . stristr($photo->thumb_url(false), "/var/") . "\t\t" . $photo->description . "\t" . $photo_keywords . "\n";
}
}
}
}
示例8: save
function save($album_id)
{
access::verify_csrf();
$album = ORM::factory("item", $album_id);
access::required("edit", $album);
if (Input::instance()->post("save")) {
$titles = Input::instance()->post("title");
$descriptions = Input::instance()->post("description");
$filenames = Input::instance()->post("filename");
$internetaddresses = Input::instance()->post("internetaddress");
$tags = Input::instance()->post("tags");
$enable_tags = module::is_active("tag");
foreach (array_keys($titles) as $id) {
$item = ORM::factory("item", $id);
if ($item->loaded() && access::can("edit", $item)) {
$item->title = $titles[$id];
$item->description = $descriptions[$id];
$item->name = $filenames[$id];
$item->slug = $internetaddresses[$id];
$item->save();
if ($enable_tags) {
tag::clear_all($item);
foreach (explode(",", $tags[$id]) as $tag_name) {
if ($tag_name) {
tag::add($item, trim($tag_name));
}
}
tag::compact();
}
}
}
message::success(t("Captions saved"));
}
url::redirect($album->abs_url());
}
示例9: get_edit_form_admin
static function get_edit_form_admin()
{
$form = new Forge("admin/theme_options/save/", "", null, array("id" => "g-theme-options-form"));
$group = $form->group("requirements")->label("Prerequisites checklist");
$group->checkbox("shadowbox")->label(t("Shadowbox module"))->checked(module::is_active("shadowbox"))->disabled(true);
$file = THEMEPATH . "greydragon/theme.info";
$theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
$group = $form->group("edit_theme")->label(t("Grey Dragon Theme") . " - " . t("v.") . $theme_info->version);
$group->input("row_count")->label(t("Rows per album page"))->id("g-page-size")->rules("required|valid_digit")->value(module::get_var("gallery", "page_size") / 3);
$group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("g-resize-size")->rules("required|valid_digit")->value(module::get_var("gallery", "resize_size"));
$group->checkbox("build_resize")->label(t("Mark to build all resizes (from Maintenace page)"))->id("g-build-resize")->value(false);
$group->checkbox("build_thumbs")->label(t("Mark to build all thumbnails (200x200) (from Maintenace page)"))->id("g-build-thumb")->value(false);
$group->checkbox("photonav_top")->label(t("Show top photo navigator"))->checked(module::get_var("th_greydragon", "photonav_top"));
$group->checkbox("photonav_bottom")->label(t("Show bottom photo navigator"))->checked(module::get_var("th_greydragon", "photonav_bottom"));
$group->dropdown("sidebar_allowed")->label(t("Allowed SideBar Positions"))->options(array("any" => t("Any"), "left" => t("Left"), "right" => t("Right"), "none" => t("None")))->selected(module::get_var("th_greydragon", "sidebar_allowed"));
$group->dropdown("sidebar_visible")->label(t("Default SideBar Position"))->options(array("right" => t("Right"), "left" => t("Left"), "none" => t("None")))->selected(module::get_var("th_greydragon", "sidebar_visible"));
$group->input("header_text")->label(t("Header text"))->id("g-header-text")->value(module::get_var("gallery", "header_text"));
$group->input("footer_text")->label(t("Footer text"))->id("g-footer-text")->value(module::get_var("gallery", "footer_text"));
$group->checkbox("show_credits")->label(t("Show site credits"))->id("g-footer-text")->checked(module::get_var("gallery", "show_credits"));
$group->input("copyright")->label(t("Copyright message to display on footer"))->id("g-theme-copyright")->value(module::get_var("th_greydragon", "copyright"));
$group->input("logo_path")->label(t("URL or path to alternate logo image"))->id("g-site-logo")->value(module::get_var("th_greydragon", "logo_path"));
module::event("theme_edit_form", $form);
$group = $form->group("buttons");
$group->submit("")->value(t("Save"));
return $form;
}
示例10: feed
public function feed($module_id, $feed_id, $id = null)
{
$page = $this->input->get("page", 1);
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
}
// Configurable page size between 1 and 100, default 20
$page_size = max(1, min(100, $this->input->get("page_size", self::$page_size)));
// Run the appropriate feed callback
if (module::is_active($module_id)) {
$class_name = "{$module_id}_rss";
if (method_exists($class_name, "feed")) {
$feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
}
}
if (empty($feed)) {
Kohana::show_404();
}
if ($feed->max_pages && $page > $feed->max_pages) {
url::redirect(url::merge(array("page" => $feed->max_pages)));
}
$view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
unset($feed->view);
$view->feed = $feed;
$view->pub_date = date("D, d M Y H:i:s T");
$feed->uri = url::abs_site(Router::$current_uri);
if ($page > 1) {
$feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
}
if ($page < $feed->max_pages) {
$feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
}
rest::http_content_type(rest::RSS);
print $view;
}
示例11: thumb_info
static function thumb_info($theme, $item)
{
$results = "";
if ($item->view_count) {
$results .= "<li>";
$results .= t("Views: %view_count", array("view_count" => $item->view_count));
$results .= "</li>";
}
// rWatcher Edit: Display Tags
if (module::is_active("tag")) {
$tags = ORM::factory("tag")->join("items_tags", "tags.id", "items_tags.tag_id")->where("items_tags.item_id", "=", $item->id)->find_all();
if (count($tags) > 0) {
$results .= "<li>";
$results .= t("Tags:") . " ";
$anchors = array();
foreach ($tags as $tag) {
$anchors[] = "<a href=" . $tag->url() . ">" . html::clean($tag->name) . "</a>";
}
$results .= join(", ", $anchors) . "</li>";
}
}
// rWatcher End Edit
if ($item->owner) {
$results .= "<li>";
if ($item->owner->url) {
$results .= t("By: <a href=\"%owner_url\">%owner_name</a>", array("owner_name" => $item->owner->display_name(), "owner_url" => $item->owner->url));
} else {
$results .= t("By: %owner_name", array("owner_name" => $item->owner->display_name()));
}
$results .= "</li>";
}
return $results;
}
示例12: thumb_info
static function thumb_info($theme, $item)
{
$results = "";
if ($item->view_count) {
$results .= "<li>";
$results .= t("Views: %view_count", array("view_count" => $item->view_count));
$results .= "</li>";
}
if (module::is_active("tag")) {
$tagsItem = ORM::factory("tag")->join("items_tags", "tags.id", "items_tags.tag_id")->where("items_tags.item_id", $item->id)->find_all();
if (count($tagsItem) > 0) {
$results .= "<li>";
$results .= t("Tags:") . " ";
for ($counter = 0; $counter < count($tagsItem); $counter++) {
if ($counter < count($tagsItem) - 1) {
$results .= "<a href=" . url::site("tags/{$tagsItem[$counter]}") . ">" . html::clean($tagsItem[$counter]->name) . "</a>, ";
} else {
$results .= "<a href=" . url::site("tags/{$tagsItem[$counter]}") . ">" . html::clean($tagsItem[$counter]->name) . "</a>";
}
}
$results .= "</li>";
}
}
if ($item->owner) {
$results .= "<li>";
if ($item->owner->url) {
$results .= t("By: %owner_name", array("owner_name" => "<a href=\"{$item->owner->url}\">{$item->owner->full_name}</a>"));
} else {
$results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}"));
}
$results .= "</li>";
}
return $results;
}
示例13: can_activate
static function can_activate()
{
$messages = array();
if (!module::is_active("rss")) {
$messages["warn"][] = t("The Slideshow module requires the RSS module.");
}
return $messages;
}
示例14: module_change
static function module_change($changes)
{
if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) {
site_status::warning(t("The Slideshow module requires the RSS module. <a href=\"%url\">Activate the RSS module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "slideshow_needs_rss");
} else {
site_status::clear("slideshow_needs_rss");
}
}
示例15: module_change
static function module_change($changes)
{
// Display a warning message if the RSS module is not installed.
if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) {
site_status::warning(t("The MiniSlide Show module requires the RSS module. " . "<a href=\"%url\">Activate the RSS module now</a>", array("url" => url::site("admin/modules"))), "minislideshow_needs_rss");
} else {
site_status::clear("minislideshow_needs_rss");
}
}