本文整理汇总了PHP中wpl_global::get_current_blog_id方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_global::get_current_blog_id方法的具体用法?PHP wpl_global::get_current_blog_id怎么用?PHP wpl_global::get_current_blog_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_global
的用法示例。
在下文中一共展示了wpl_global::get_current_blog_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall_wpl
/**
* Uninstalling WPL
* @author Howard <howard@realtyna.com>
* @return boolean
*/
public function uninstall_wpl()
{
$tables = wpl_db::select('SHOW TABLES');
$database = wpl_db::get_DBO();
foreach ($tables as $table_name => $table) {
if (strpos($table_name, $database->prefix . 'wpl_') !== false) {
/** drop table **/
wpl_db::q("DROP TABLE `{$table_name}`");
}
}
/** delete options **/
wpl_db::q("DELETE FROM `#__options` WHERE `option_name` LIKE 'wpl_%' AND `option_name` NOT LIKE 'wpl_theme%'", 'delete');
/** remove WPL upload directory **/
if (function_exists('is_multisite') and is_multisite() and wpl_global::check_addon('multisite')) {
$original_blog_id = wpl_global::get_current_blog_id();
// Get all blogs
$blogs = wpl_db::select("SELECT `blog_id` FROM `#__blogs`", 'loadColumn');
foreach ($blogs as $blog) {
if (!isset($blog->blog_id)) {
continue;
}
switch_to_blog($blog->blog_id);
$upload_path = wpl_global::get_upload_base_path($blog->blog_id);
if (wpl_folder::exists($upload_path)) {
wpl_folder::delete($upload_path);
}
}
switch_to_blog($original_blog_id);
} else {
$upload_path = wpl_global::get_upload_base_path();
if (wpl_file::exists($upload_path)) {
wpl_file::delete($upload_path);
}
}
return true;
}
示例2: get_upload_base_url
/**
* This functions will take care of multisite usage
* @author Howard <howard@realtyna.com>
* @param type $blog_id
* @return string WPL base url for uploaded files
*/
public static function get_upload_base_url($blog_id = NULL)
{
if (!$blog_id) {
$blog_id = wpl_global::get_current_blog_id();
}
$ABSPATH = WPL_UP_ABSPATH;
if (!$blog_id or $blog_id == 1) {
return wpl_global::get_wp_site_url() . 'wp-content/uploads/WPL/';
} else {
$path = rtrim($ABSPATH, DS) . $blog_id . DS;
if (!wpl_folder::exists($path)) {
wpl_folder::create($path);
}
return wpl_global::get_wp_site_url() . 'wp-content/uploads/WPL' . $blog_id . '/';
}
}