本文整理汇总了PHP中SetupBlock::add_bool_option方法的典型用法代码示例。如果您正苦于以下问题:PHP SetupBlock::add_bool_option方法的具体用法?PHP SetupBlock::add_bool_option怎么用?PHP SetupBlock::add_bool_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SetupBlock
的用法示例。
在下文中一共展示了SetupBlock::add_bool_option方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSetupBuilding
public function onSetupBuilding(SetupBuildingEvent $event)
{
$sb = new SetupBlock("Pools");
$sb->add_int_option("poolsMaxImportResults", "Max results on import: ");
$sb->add_int_option("poolsImagesPerPage", "<br>Images per page: ");
$sb->add_int_option("poolsListsPerPage", "<br>Index list items per page: ");
$sb->add_int_option("poolsUpdatedPerPage", "<br>Updated list items per page: ");
$sb->add_bool_option("poolsInfoOnViewImage", "<br>Show pool info on image: ");
$sb->add_bool_option("poolsShowNavLinks", "<br>Show 'Prev' & 'Next' links when viewing pool images: ");
$sb->add_bool_option("poolsAutoIncrementOrder", "<br>Autoincrement order when post is added to pool:");
//$sb->add_bool_option("poolsAdderOnViewImage", "<br>Show pool adder on image: ");
$event->panel->add_block($sb);
}
示例2: onSetupBuilding
public function onSetupBuilding(SetupBuildingEvent $event)
{
$sb = new SetupBlock("Image Resize");
$sb->add_bool_option("resize_enabled", "Allow resizing images: ");
$sb->add_bool_option("resize_upload", "<br>Resize on upload: ");
$sb->add_label("<br>Preset/Default Width: ");
$sb->add_int_option("resize_default_width");
$sb->add_label(" px");
$sb->add_label("<br>Preset/Default Height: ");
$sb->add_int_option("resize_default_height");
$sb->add_label(" px");
$sb->add_label("<br>(enter 0 for no default)");
$event->panel->add_block($sb);
}
示例3: receive_event
public function receive_event(Event $event)
{
global $config, $database, $page, $user;
//if(is_null($this->theme)) $this->theme = get_theme_object($this);
if ($event instanceof ImageInfoBoxBuildingEvent) {
if (!$config->get_bool("tageditcloud_disable")) {
if ($this->can_tag($event->image)) {
if (!($cfg_minusage = $config->get_int("tageditcloud_minusage"))) {
$cfg_minusage = 2;
}
if (!($cfg_defcount = $config->get_int("tageditcloud_defcount"))) {
$cfg_defcount = 40;
}
if (!($cfg_maxcount = $config->get_int("tageditcloud_maxcount"))) {
$cfg_maxcount = 4096;
}
if ($config->get_string("tageditcloud_sort") != "p") {
$event->add_part($this->build_tag_map($event->image, $cfg_minusage, false), 40);
} else {
$event->add_part($this->build_tag_map($event->image, $cfg_defcount, $cfg_maxcount), 40);
}
}
}
}
if ($event instanceof InitExtEvent) {
$config->set_default_bool("tageditcloud_disable", false);
$config->set_default_bool("tageditcloud_usedfirst", true);
$config->set_default_string("tageditcloud_sort", 'a');
$config->set_default_int("tageditcloud_minusage", 2);
$config->set_default_int("tageditcloud_defcount", 40);
$config->set_default_int("tageditcloud_maxcount", 4096);
}
if ($event instanceof SetupBuildingEvent) {
$sort_by = array('Alphabetical' => 'a', 'Popularity' => 'p');
$sb = new SetupBlock("Tag Edit Cloud");
$sb->add_bool_option("tageditcloud_disable", "Disable Tag Selection Cloud: ");
$sb->add_choice_option("tageditcloud_sort", $sort_by, "<br>Sort the tags by:");
$sb->add_bool_option("tageditcloud_usedfirst", "<br>Always show used tags first: ");
$sb->add_label("<br><b>Alpha sort</b>:<br>Only show tags used at least ");
$sb->add_int_option("tageditcloud_minusage");
$sb->add_label(" times.<br><b>Popularity sort</b>:<br>Show ");
$sb->add_int_option("tageditcloud_defcount");
$sb->add_label(" tags by default.<br>Show a maximum of ");
$sb->add_int_option("tageditcloud_maxcount");
$sb->add_label(" tags.");
$event->panel->add_block($sb);
}
}
示例4: onSetupBuilding
public function onSetupBuilding(SetupBuildingEvent $event)
{
$sb = new SetupBlock("Pools");
$sb->add_int_option("poolsMaxImportResults", "Max results on import: ");
$sb->add_int_option("poolsImagesPerPage", "<br>Images per page: ");
$sb->add_int_option("poolsListsPerPage", "<br>Index list items per page: ");
$sb->add_int_option("poolsUpdatedPerPage", "<br>Updated list items per page: ");
$sb->add_bool_option("poolsInfoOnViewImage", "<br>Show pool info on image: ");
//$sb->add_bool_option("poolsAdderOnViewImage", "<br>Show pool adder on image: ");
$event->panel->add_block($sb);
}
示例5: receive_event
public function receive_event(Event $event)
{
global $config, $database, $page, $user;
if (is_null($this->theme)) {
$this->theme = get_theme_object($this);
}
if ($event instanceof SetupBuildingEvent) {
$sb = new SetupBlock("Downtime");
$sb->add_bool_option("downtime", "Disable non-admin access: ");
$sb->add_longtext_option("downtime_message", "<br>");
$event->panel->add_block($sb);
}
if ($event instanceof PageRequestEvent) {
if ($config->get_bool("downtime")) {
$this->check_downtime($event);
$this->theme->display_notification($page);
}
}
}
示例6: receive_event
//.........这里部分代码省略.........
$tags = '';
// Tags aren't changed when uploading. Set to null to stop PHP warnings.
if (count($_FILES)) {
foreach ($_FILES as $file) {
$ok = $this->try_upload($file, $tags, $source, $image_id);
break;
// leave the foreach loop.
}
} else {
foreach ($_POST as $name => $value) {
if (substr($name, 0, 3) == "url" && strlen($value) > 0) {
$ok = $this->try_transload($value, $tags, $source, $image_id);
break;
// leave the foreach loop.
}
}
}
$this->theme->display_upload_status($page, $ok);
} else {
if (!empty($_GET['url'])) {
$url = $_GET['url'];
$ok = $this->try_transload($url, $tags, $url, $image_id);
$this->theme->display_upload_status($page, $ok);
} else {
$this->theme->display_replace_page($page, $image_id);
}
}
}
// END of if admin / can_upload
} else {
if ($event->page_matches("upload")) {
if (!$this->can_upload($user)) {
$this->theme->display_permission_denied($page);
} else {
/* Regular Upload Image */
if (count($_FILES) + count($_POST) > 0) {
$tags = Tag::explode($_POST['tags']);
$source = isset($_POST['source']) ? $_POST['source'] : null;
$ok = true;
foreach ($_FILES as $file) {
$ok = $ok & $this->try_upload($file, $tags, $source);
}
foreach ($_POST as $name => $value) {
if (substr($name, 0, 3) == "url" && strlen($value) > 0) {
$ok = $ok & $this->try_transload($value, $tags, $source);
}
}
$this->theme->display_upload_status($page, $ok);
} else {
if (!empty($_GET['url'])) {
$url = $_GET['url'];
$tags = array('tagme');
if (!empty($_GET['tags']) && $_GET['tags'] != "null") {
$tags = Tag::explode($_GET['tags']);
}
$ok = $this->try_transload($url, $tags, $url);
$this->theme->display_upload_status($page, $ok);
} else {
if (!$is_full) {
$this->theme->display_page($page);
}
}
}
}
// END of if can_upload
}
}
}
// END of if PageRequestEvent
if ($event instanceof SetupBuildingEvent) {
$tes = array();
$tes["Disabled"] = "none";
if (function_exists("curl_init")) {
$tes["cURL"] = "curl";
}
$tes["fopen"] = "fopen";
$tes["WGet"] = "wget";
$sb = new SetupBlock("Upload");
$sb->position = 10;
// Output the limits from PHP so the user has an idea of what they can set.
$sb->add_label("<i>PHP's Upload Limit = " . ini_get('max_file_uploads') . "</i><br/>");
$sb->add_int_option("upload_count", "Max uploads: ");
$sb->add_label("<br/><i>PHP's Max Size Upload = " . ini_get('upload_max_filesize') . "</i><br/>");
$sb->add_shorthand_int_option("upload_size", "<br/>Max size per file: ");
$sb->add_bool_option("upload_anon", "<br/>Allow anonymous uploads: ");
$sb->add_bool_option("upload_replace", "<br/>Allow replacing images: ");
$sb->add_choice_option("transload_engine", $tes, "<br/>Transload: ");
$event->panel->add_block($sb);
}
if ($event instanceof DataUploadEvent) {
if ($is_full) {
throw new UploadException("Upload failed; disk nearly full");
}
if (filesize($event->tmpname) > $config->get_int('upload_size')) {
$size = to_shorthand_int(filesize($event->tmpname));
$limit = to_shorthand_int($config->get_int('upload_size'));
throw new UploadException("File too large ({$size} > {$limit})");
}
}
}
示例7: onSetupBuilding
public function onSetupBuilding($event)
{
$sb = new SetupBlock("Comment Options");
$sb->add_bool_option("comment_anon", "Allow anonymous comments: ");
$sb->add_bool_option("comment_captcha", "<br>Require CAPTCHA for anonymous comments: ");
$sb->add_label("<br>Limit to ");
$sb->add_int_option("comment_limit");
$sb->add_label(" comments per ");
$sb->add_int_option("comment_window");
$sb->add_label(" minutes");
$sb->add_label("<br>Show ");
$sb->add_int_option("comment_count");
$sb->add_label(" recent comments on the index");
$sb->add_label("<br>Show ");
$sb->add_int_option("comment_list_count");
$sb->add_label(" comments per image on the list");
$event->panel->add_block($sb);
}
示例8: onSetupBuilding
public function onSetupBuilding($event)
{
$sb = new SetupBlock("Image Zoom");
$sb->add_bool_option("image_zoom", "Zoom by default: ");
$event->panel->add_block($sb);
}
示例9: receive_event
public function receive_event(Event $event)
{
global $config, $database, $page, $user;
if (is_null($this->theme)) {
$this->theme = get_theme_object($this);
}
$is_full = disk_free_space(realpath("./images/")) < 100 * 1024 * 1024;
if ($event instanceof InitExtEvent) {
global $config;
$config->set_default_int('upload_count', 3);
$config->set_default_int('upload_size', '1MB');
$config->set_default_bool('upload_anon', false);
}
if ($event instanceof PostListBuildingEvent) {
global $user;
if ($this->can_upload($user)) {
if ($is_full) {
$this->theme->display_full($page);
} else {
$this->theme->display_block($page);
}
}
}
if ($event instanceof PageRequestEvent && $event->page_matches("upload")) {
if (count($_FILES) + count($_POST) > 0) {
$tags = Tag::explode($_POST['tags']);
$source = isset($_POST['source']) ? $_POST['source'] : null;
if ($this->can_upload($user)) {
$ok = true;
foreach ($_FILES as $file) {
$ok = $ok & $this->try_upload($file, $tags, $source);
}
foreach ($_POST as $name => $value) {
if (substr($name, 0, 3) == "url" && strlen($value) > 0) {
$ok = $ok & $this->try_transload($value, $tags, $source);
}
}
$this->theme->display_upload_status($page, $ok);
} else {
$this->theme->display_permission_denied($page);
}
} else {
if (!empty($_GET['url'])) {
global $user;
if ($this->can_upload($user)) {
$url = $_GET['url'];
$tags = array('tagme');
if (!empty($_GET['tags']) && $_GET['tags'] != "null") {
$tags = Tag::explode($_GET['tags']);
}
$ok = $this->try_transload($url, $tags, $url);
$this->theme->display_upload_status($page, $ok);
} else {
$this->theme->display_permission_denied($page);
}
} else {
if (!$is_full) {
$this->theme->display_page($page);
}
}
}
}
if ($event instanceof SetupBuildingEvent) {
$sb = new SetupBlock("Upload");
$sb->position = 10;
$sb->add_int_option("upload_count", "Max uploads: ");
$sb->add_shorthand_int_option("upload_size", "<br>Max size per file: ");
$sb->add_bool_option("upload_anon", "<br>Allow anonymous uploads: ");
$sb->add_choice_option("transload_engine", array("Disabled" => "none", "cURL" => "curl", "fopen" => "fopen", "WGet" => "wget"), "<br>Transload: ");
$event->panel->add_block($sb);
}
if ($event instanceof DataUploadEvent) {
global $config;
if ($is_full) {
throw new UploadException("Upload failed; disk nearly full");
}
if (filesize($event->tmpname) > $config->get_int('upload_size')) {
$size = to_shorthand_int(filesize($event->tmpname));
$limit = to_shorthand_int($config->get_int('upload_size'));
throw new UploadException("File too large ({$size} > {$limit})");
}
}
}
示例10: onSetupBuilding
public function onSetupBuilding(Event $event)
{
global $config;
$hosts = array("None" => "none", "Gravatar" => "gravatar");
$sb = new SetupBlock("User Options");
$sb->add_bool_option("login_signup_enabled", "Allow new signups: ");
$sb->add_longtext_option("login_tac", "<br>Terms & Conditions:<br>");
$sb->add_choice_option("avatar_host", $hosts, "<br>Avatars: ");
if ($config->get_string("avatar_host") == "gravatar") {
$sb->add_label("<br> <br><b>Gravatar Options</b>");
$sb->add_choice_option("avatar_gravatar_type", array('Default' => 'default', 'Wavatar' => 'wavatar', 'Monster ID' => 'monsterid', 'Identicon' => 'identicon'), "<br>Type: ");
$sb->add_choice_option("avatar_gravatar_rating", array('G' => 'g', 'PG' => 'pg', 'R' => 'r', 'X' => 'x'), "<br>Rating: ");
}
$event->panel->add_block($sb);
}