本文整理汇总了PHP中block_manager::get_available_site_blocks方法的典型用法代码示例。如果您正苦于以下问题:PHP block_manager::get_available_site_blocks方法的具体用法?PHP block_manager::get_available_site_blocks怎么用?PHP block_manager::get_available_site_blocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block_manager
的用法示例。
在下文中一共展示了block_manager::get_available_site_blocks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_blocks
private function _get_blocks()
{
$active_blocks = array();
$available_blocks = block_manager::get_available_site_blocks();
foreach (block_manager::get_active("site.sidebar") as $block) {
$id = "{$block[0]}:{$block[1]}";
if (!empty($available_blocks[$id])) {
$active_blocks[$id] = $available_blocks[$id];
unset($available_blocks[$id]);
}
}
return array($available_blocks, $active_blocks);
}
示例2: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例3: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches because we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例4: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例5: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例6: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = ORM::factory("group")->find_all();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site.sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site.sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
}