当前位置: 首页>>代码示例>>PHP>>正文


PHP module::set_var方法代码示例

本文整理汇总了PHP中module::set_var方法的典型用法代码示例。如果您正苦于以下问题:PHP module::set_var方法的具体用法?PHP module::set_var怎么用?PHP module::set_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module的用法示例。


在下文中一共展示了module::set_var方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save()
 {
     access::verify_csrf();
     $form = $this->_get_edit_form_admin();
     if ($form->validate()) {
         module::set_var("gallery", "page_size", $form->edit_theme->page_size->value);
         $thumb_size = $form->edit_theme->thumb_size->value;
         if (module::get_var("gallery", "thumb_size") != $thumb_size) {
             graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
             graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), 100);
             module::set_var("gallery", "thumb_size", $thumb_size);
         }
         $resize_size = $form->edit_theme->resize_size->value;
         if (module::get_var("gallery", "resize_size") != $resize_size) {
             graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
             graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100);
             module::set_var("gallery", "resize_size", $resize_size);
         }
         module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value);
         // Sanitize values that get placed directly in HTML output by theme.
         module::set_var("gallery", "header_text", html::purify($form->edit_theme->header_text->value));
         module::set_var("gallery", "footer_text", html::purify($form->edit_theme->footer_text->value));
         module::set_var("gallery", "favicon_url", html::purify($form->edit_theme->favicon_url->value));
         module::set_var("gallery", "apple_touch_icon_url", html::purify($form->edit_theme->apple_touch_icon_url->value));
         module::event("theme_edit_form_completed", $form);
         message::success(t("Updated theme details"));
         url::redirect("admin/theme_options");
     } else {
         $view = new Admin_View("admin.html");
         $view->content = new View("admin_theme_options.html");
         $view->content->form = $form;
         print $view;
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:34,代码来源:admin_theme_options.php

示例2: index

 public function index()
 {
     $form = $this->_get_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             module::set_var("strip_exif", "exiv_path", $_POST['exiv_path']);
             if ($_POST['exif_tags'] != "") {
                 module::set_var("strip_exif", "exif_remove", isset($_POST['exif_remove']) ? $_POST['exif_remove'] : false);
                 module::set_var("strip_exif", "exif_tags", $_POST['exif_tags']);
             } else {
                 module::set_var("strip_exif", "exif_remove", false);
                 module::set_var("strip_exif", "exif_tags", self::$defExifTags);
             }
             if ($_POST['iptc_tags'] != "") {
                 module::set_var("strip_exif", "iptc_remove", isset($_POST['iptc_remove']) ? $_POST['iptc_remove'] : false);
                 module::set_var("strip_exif", "iptc_tags", $_POST['iptc_tags']);
             } else {
                 module::set_var("strip_exif", "iptc_remove", false);
                 module::set_var("strip_exif", "iptc_tags", self::$defIptcTags);
             }
             if (isset($_POST['verbose'])) {
                 module::set_var("strip_exif", "verbose", $_POST['verbose']);
             }
             message::success(t("Settings have been saved"));
             url::redirect("admin/strip_exif");
         } else {
             message::error(t("There was a problem with the submitted form. Please check your values and try again."));
         }
     }
     print $this->_get_view();
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:32,代码来源:admin_strip_exif.php

示例3: __construct

 /**
  * Attempts to load a view and pre-load view data.
  *
  * @throws  Kohana_Exception  if the requested view cannot be found
  * @param   string  $name view name
  * @param   string  $page_type page type: album, photo, tags, etc
  * @param   string  $theme_name view name
  * @return  void
  */
 public function __construct($name, $page_type)
 {
     $theme_name = module::get_var("gallery", "active_site_theme");
     if (!file_exists("themes/{$theme_name}")) {
         module::set_var("gallery", "active_site_theme", "default");
         theme::load_themes();
         Kohana::log("error", "Unable to locate theme '{$theme_name}', switching to default theme.");
     }
     parent::__construct($name);
     $this->theme_name = module::get_var("gallery", "active_site_theme");
     if (user::active()->admin) {
         $this->theme_name = Input::instance()->get("theme", $this->theme_name);
     }
     $this->item = null;
     $this->tag = null;
     $this->set_global("theme", $this);
     $this->set_global("user", user::active());
     $this->set_global("page_type", $page_type);
     $this->set_global("page_title", null);
     if ($page_type == "album") {
         $this->set_global("thumb_proportion", $this->thumb_proportion());
     }
     $maintenance_mode = Kohana::config("core.maintenance_mode", false, false);
     if ($maintenance_mode) {
         message::warning(t("This site is currently in maintenance mode"));
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:36,代码来源:Theme_View.php

示例4: upgrade

 static function upgrade($version)
 {
     $db = Database::instance();
     if ($version == 1) {
         $db->query("ALTER TABLE {comments} CHANGE `state` `state` varchar(15) default 'unpublished'");
         module::set_version("comment", $version = 2);
     }
     if ($version == 2) {
         module::set_var("comment", "access_permissions", "everybody");
         module::set_version("comment", $version = 3);
     }
     if ($version == 3) {
         // 40 bytes for server_remote_addr is enough to swallow the longest
         // representation of an IPv6 addy.
         //
         // 255 bytes for server_remote_host is enough to swallow the longest
         // legit DNS entry, with a few bytes to spare.
         $db->query("ALTER TABLE {comments} CHANGE `server_remote_addr` `server_remote_addr` varchar(40)");
         $db->query("ALTER TABLE {comments} CHANGE `server_remote_host` `server_remote_host` varchar(255)");
         module::set_version("comment", $version = 4);
     }
     if ($version == 4) {
         module::set_var("comment", "rss_visible", "all");
         module::set_version("comment", $version = 5);
     }
     // In version 5 we accidentally set the installer variable to rss_available when it should
     // have been rss_visible.  Migrate it over now, if necessary.
     if ($version == 5) {
         if (!module::get_var("comment", "rss_visible")) {
             module::set_var("comment", "rss_visible", module::get_var("comment", "rss_available"));
         }
         module::clear_var("comment", "rss_available");
         module::set_version("comment", $version = 6);
     }
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:35,代码来源:comment_installer.php

示例5: _dump_database

 private function _dump_database()
 {
     // We now have a clean install with just the packages that we want.  Make sure that the
     // database is clean too.
     $i = 1;
     foreach (array("dashboard_sidebar", "dashboard_center", "site_sidebar") as $key) {
         $blocks = array();
         foreach (unserialize(module::get_var("gallery", "blocks_{$key}")) as $rnd => $value) {
             $blocks[++$i] = $value;
         }
         module::set_var("gallery", "blocks_{$key}", serialize($blocks));
     }
     Database::instance()->query("TRUNCATE {caches}");
     Database::instance()->query("TRUNCATE {sessions}");
     Database::instance()->query("TRUNCATE {logs}");
     db::build()->update("users")->set(array("password" => ""))->where("id", "in", array(1, 2))->execute();
     $dbconfig = Kohana::config('database.default');
     $conn = $dbconfig["connection"];
     $sql_file = DOCROOT . "installer/install.sql";
     if (!is_writable($sql_file)) {
         print "{$sql_file} is not writeable";
         return;
     }
     $command = sprintf("mysqldump --compact --skip-extended-insert --add-drop-table %s %s %s %s > {$sql_file}", escapeshellarg("-h{$conn['host']}"), escapeshellarg("-u{$conn['user']}"), $conn['pass'] ? escapeshellarg("-p{$conn['pass']}") : "", escapeshellarg($conn['database']));
     exec($command, $output, $status);
     if ($status) {
         print "<pre>";
         print "{$command}\n";
         print "Failed to dump database\n";
         print implode("\n", $output);
         return;
     }
     // Post-process the sql file
     $buf = "";
     $root = ORM::factory("item", 1);
     $root_created_timestamp = $root->created;
     $root_updated_timestamp = $root->updated;
     $table_name = "";
     foreach (file($sql_file) as $line) {
         // Prefix tables
         $line = preg_replace("/(CREATE TABLE|IF EXISTS|INSERT INTO) `{$dbconfig['table_prefix']}(\\w+)`/", "\\1 {\\2}", $line);
         if (preg_match("/CREATE TABLE {(\\w+)}/", $line, $matches)) {
             $table_name = $matches[1];
         }
         // Normalize dates
         $line = preg_replace("/,{$root_created_timestamp},/", ",UNIX_TIMESTAMP(),", $line);
         $line = preg_replace("/,{$root_updated_timestamp},/", ",UNIX_TIMESTAMP(),", $line);
         // Remove ENGINE= specifications execpt for search records, it always needs to be MyISAM
         if ($table_name != "search_records") {
             $line = preg_replace("/ENGINE=\\S+ /", "", $line);
         }
         // Null out ids in the vars table since it's an auto_increment table and this will result in
         // more stable values so we'll have less churn in install.sql.
         $line = preg_replace("/^INSERT INTO {vars} VALUES \\(\\d+/", "INSERT INTO {vars} VALUES (NULL", $line);
         $buf .= $line;
     }
     $fd = fopen($sql_file, "wb");
     fwrite($fd, $buf);
     fclose($fd);
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:60,代码来源:packager.php

示例6: api_key

 static function api_key($api_key = null)
 {
     if ($api_key !== null) {
         module::set_var("gallery", "l10n_client_key", $api_key);
     }
     return module::get_var("gallery", "l10n_client_key", "");
 }
开发者ID:shai,项目名称:gallery3,代码行数:7,代码来源:l10n_client.php

示例7: saveprefs

 public function saveprefs()
 {
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     $form = $this->_get_admin_form();
     if ($form->validate()) {
         Kohana_Log::add("error", print_r($form, 1));
         module::set_var("tag_albums", "tag_page_title", $form->Tag_Albums_Tag_Sort->tag_page_title->value);
         module::set_var("tag_albums", "tag_index", $form->Tag_Albums_Tag_Sort->tag_index->value);
         module::set_var("tag_albums", "tag_index_scope", count($form->Tag_Albums_Tag_Sort->tag_index_scope->value));
         module::set_var("tag_albums", "tag_index_filter_top", count($form->Tag_Albums_Tag_Sort->tag_index_filter_top->value));
         module::set_var("tag_albums", "tag_index_filter_bottom", count($form->Tag_Albums_Tag_Sort->tag_index_filter_bottom->value));
         module::set_var("tag_albums", "tag_sort_by", $form->Tag_Albums_Tag_Sort->tag_sort_by->value);
         module::set_var("tag_albums", "tag_sort_direction", $form->Tag_Albums_Tag_Sort->tag_sort_direction->value);
         module::set_var("tag_albums", "subalbum_sort_by", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_by->value);
         module::set_var("tag_albums", "subalbum_sort_direction", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_direction->value);
         message::success(t("Your settings have been saved."));
         url::redirect("admin/tag_albums");
     }
     // Else show the page with errors
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_tag_albums.html");
     $view->content->tag_albums_form = $form;
     print $view;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:25,代码来源:admin_tag_albums.php

示例8: upgrade

 static function upgrade($version)
 {
     if ($version == 2) {
         module::set_var("tagsmap", "restrict_maps", "0");
         module::set_version("tagsmap", 3);
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:tagsmap_installer.php

示例9: upgrade

 static function upgrade($version)
 {
     // Set the default value for this module's behavior.
     module::set_var("albumpassword", "hideonly", true);
     // Set the module's version number.
     module::set_version("albumpassword", 2);
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:7,代码来源:albumpassword_installer.php

示例10: handler

 public function handler()
 {
     access::verify_csrf();
     $form = $this->_get_form();
     if ($form->validate()) {
         module::set_var("sitemap_xtra", "path", $form->sitemap->sitemap_path->value);
         module::set_var("sitemap_xtra", "base_url", $form->sitemap->sitemap_base_url->value);
         module::set_var("sitemap_xtra", "zip", $form->sitemap->sitemap_zip->value);
         module::set_var("sitemap_xtra", "ping_yandex", $form->sitemap->sitemap_ping_yandex->value);
         module::set_var("sitemap_xtra", "ping_google", $form->sitemap->sitemap_ping_google->value);
         module::set_var("sitemap_xtra", "ping_bing", $form->sitemap->sitemap_ping_bing->value);
         module::set_var("sitemap_xtra", "ping_ask", $form->sitemap->sitemap_ping_ask->value);
         module::set_var("sitemap_xtra", "robots_txt", $form->sitemap->sitemap_robots_txt->value);
         module::set_var("sitemap_xtra", "albums", $form->albums->sitemap_albums->value);
         module::set_var("sitemap_xtra", "albums_freq", $form->albums->sitemap_albums_freq->value);
         module::set_var("sitemap_xtra", "albums_prio", $form->albums->sitemap_albums_prio->value);
         module::set_var("sitemap_xtra", "photos", $form->photos->sitemap_photos->value);
         module::set_var("sitemap_xtra", "photos_freq", $form->photos->sitemap_photos_freq->value);
         module::set_var("sitemap_xtra", "photos_prio", $form->photos->sitemap_photos_prio->value);
         module::set_var("sitemap_xtra", "movies", $form->movies->sitemap_movies->value);
         module::set_var("sitemap_xtra", "movies_freq", $form->movies->sitemap_movies_freq->value);
         module::set_var("sitemap_xtra", "movies_prio", $form->movies->sitemap_movies_prio->value);
         module::set_var("sitemap_xtra", "pages", $form->pages->sitemap_pages->value);
         module::set_var("sitemap_xtra", "pages_freq", $form->pages->sitemap_pages_freq->value);
         module::set_var("sitemap_xtra", "pages_prio", $form->pages->sitemap_pages_prio->value);
         if ($form->build_sitemap->sitemap_build->value) {
             if ($status = $this->_build_sitemap()) {
                 message::info($status);
             }
         }
         message::success(t("Settings have been saved"));
         url::redirect("admin/sitemap_xtra");
     }
     print $this->_get_view($form);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:35,代码来源:admin_sitemap_xtra.php

示例11: _get_admin_view

 private function _get_admin_view($form, $errors)
 {
     $v = new Admin_View("admin.html");
     $v->content = new View("admin_register.html");
     $v->content->action = "admin/register/update";
     $v->content->policy_list = array("admin_only" => t("Only site administrators can create new user accounts."), "visitor" => t("Visitors can create accounts and no administrator approval is required."), "admin_approval" => t("Visitors can create accounts but administrator approval is required."));
     $admin = identity::admin_user();
     $v->content->disable_email = empty($admin->email) || $form["policy"] == "admin_only" ? "disabled" : "";
     if (empty($admin->email)) {
         module::set_var("registration", "email_verification", false);
     }
     $v->content->group_list = array();
     foreach (identity::groups() as $group) {
         if ($group->id != identity::everybody()->id && $group->id != identity::registered_users()->id) {
             $v->content->group_list[$group->id] = $group->name;
         }
     }
     $hidden = array("csrf" => access::csrf_token());
     if (count($v->content->group_list)) {
         $v->content->group_list = array("" => t("Choose the default group")) + $v->content->group_list;
     } else {
         $hidden["group"] = "";
     }
     $v->content->hidden = $hidden;
     $v->content->pending = ORM::factory("pending_user")->find_all();
     $v->content->activate = "admin/register/activate";
     $v->content->form = $form;
     $v->content->errors = $errors;
     return $v;
 }
开发者ID:ChrisRut,项目名称:gallery3-contrib,代码行数:30,代码来源:admin_register.php

示例12: saveprefs

 public function saveprefs()
 {
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     // Figure out which boxes where checked
     $linkOptions_array = Input::instance()->post("ContactOwnerLinkTypes");
     $ownerLink = false;
     $userLink = false;
     for ($i = 0; $i < count($linkOptions_array); $i++) {
         if ($linkOptions_array[$i] == "ContactOwner") {
             $ownerLink = true;
         }
         if ($linkOptions_array[$i] == "ContactUser") {
             $userLink = true;
         }
     }
     // Figure out the values of the text boxes
     $str_contactbutton = Input::instance()->post("owner_button_text");
     $str_contactemail = Input::instance()->post("owner_email");
     $str_contactname = Input::instance()->post("owner_name");
     $str_messageheader = Input::instance()->post("message_header");
     // Save Settings.
     module::set_var("contactowner", "contact_owner_link", $ownerLink);
     module::set_var("contactowner", "contact_user_link", $userLink);
     module::set_var("contactowner", "contact_button_text", $str_contactbutton);
     module::set_var("contactowner", "contact_owner_email", $str_contactemail);
     module::set_var("contactowner", "contact_owner_name", $str_contactname);
     module::set_var("contactowner", "contact_owner_header", $str_messageheader);
     message::success(t("Your Settings Have Been Saved."));
     // Load Admin page.
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_contactowner.html");
     $view->content->contactowner_form = $this->_get_admin_form();
     print $view;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:35,代码来源:admin_contactowner.php

示例13: saveprefs

 public function saveprefs()
 {
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     // Save Settings.
     module::set_var("ratings", "showunderphoto", Input::instance()->post("showunderphoto"));
     module::set_var("ratings", "showinsidebar", Input::instance()->post("showinsidebar"));
     module::set_var("ratings", "imageword", Input::instance()->post("imageword"));
     module::set_var("ratings", "votestring", Input::instance()->post("votestring"));
     module::set_var("ratings", "castyourvotestring", Input::instance()->post("castyourvotestring"));
     #    module::set_var("ratings", "bgcolor", Input::instance()->post("bgcolor"));
     module::set_var("ratings", "fillcolor", Input::instance()->post("fillcolor"));
     module::set_var("ratings", "votedcolor", Input::instance()->post("votedcolor"));
     module::set_var("ratings", "hovercolor", Input::instance()->post("hovercolor"));
     module::set_var("ratings", "textcolor", Input::instance()->post("textcolor"));
     module::set_var("ratings", "regonly", Input::instance()->post("regonly"));
     $iconset = Input::instance()->post("iconset");
     $iconset = preg_replace("/\\/index\\.php/", "", $iconset);
     module::set_var("ratings", "iconset", $iconset);
     message::success(t("Your Settings Have Been Saved."));
     site_status::clear("ratings_configuration");
     // Load Admin page.
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_ratings.html");
     $view->content->ratings_form = $this->_get_admin_form();
     print $view;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:27,代码来源:admin_ratings.php

示例14: install

 static function install()
 {
     $formats = movie_tools::get_formats();
     foreach ($formats as $id => $data) {
         module::set_var("movie_tools", "allow_{$id}", 0);
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:movie_tools_installer.php

示例15: initialize

 static function initialize()
 {
     $db = Database::instance();
     $db->query("CREATE TABLE IF NOT EXISTS {users} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` varchar(32) NOT NULL,\n                 `full_name` varchar(255) NOT NULL,\n                 `password` varchar(64) NOT NULL,\n                 `login_count` int(10) unsigned NOT NULL DEFAULT 0,\n                 `last_login` int(10) unsigned NOT NULL DEFAULT 0,\n                 `email` varchar(64) default NULL,\n                 `admin` BOOLEAN default 0,\n                 `guest` BOOLEAN default 0,\n                 `hash` char(32) default NULL,\n                 `url` varchar(255) default NULL,\n                 `locale` char(10) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`hash`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE IF NOT EXISTS {groups} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` char(64) default NULL,\n                 `special` BOOLEAN default 0,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE IF NOT EXISTS {groups_users} (\n                 `group_id` int(9) NOT NULL,\n                 `user_id` int(9) NOT NULL,\n                 PRIMARY KEY (`group_id`, `user_id`),\n                 UNIQUE KEY(`user_id`, `group_id`))\n               DEFAULT CHARSET=utf8;");
     $everybody = ORM::factory("group");
     $everybody->name = "Everybody";
     $everybody->special = true;
     $everybody->save();
     $registered = ORM::factory("group");
     $registered->name = "Registered Users";
     $registered->special = true;
     $registered->save();
     $guest = ORM::factory("user");
     $guest->name = "guest";
     $guest->full_name = "Guest User";
     $guest->password = "";
     $guest->guest = true;
     $guest->save();
     $admin = ORM::factory("user");
     $admin->name = "admin";
     $admin->full_name = "Gallery Administrator";
     $admin->password = "admin";
     $admin->email = "unknown@unknown.com";
     $admin->admin = true;
     $admin->save();
     $root = ORM::factory("item", 1);
     access::allow($everybody, "view", $root);
     access::allow($everybody, "view_full", $root);
     access::allow($registered, "view", $root);
     access::allow($registered, "view_full", $root);
     module::set_version("user", 2);
     module::set_var("user", "mininum_password_length", 5);
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:35,代码来源:user_installer.php


注:本文中的module::set_var方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。