本文整理汇总了PHP中WPFB_Core::GetOldCustomCssPath方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::GetOldCustomCssPath方法的具体用法?PHP WPFB_Core::GetOldCustomCssPath怎么用?PHP WPFB_Core::GetOldCustomCssPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::GetOldCustomCssPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnActivateOrVerChange
static function OnActivateOrVerChange($old_ver = null)
{
global $wpdb;
// make sure that either wp-filebase or wp-filebase pro is enabled bot not both!
if (!function_exists('is_plugin_active')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (is_plugin_active('wp-filebase-pro/wp-filebase.php')) {
deactivate_plugins('wp-filebase/wp-filebase.php');
}
wpfb_loadclass('Admin', 'File', 'Category');
self::SetupDBTables($old_ver);
$old_options = get_option(WPFB_OPT_NAME);
self::AddOptions();
self::AddTpls($old_ver);
$new_options = get_option(WPFB_OPT_NAME);
WPFB_Admin::SettingsUpdated($old_options, $new_options);
self::ProtectUploadPath();
$sync_data_file = WPFB_Core::UploadDir() . '/._sync.data';
is_file($sync_data_file) && unlink($sync_data_file);
WPFB_Admin::WPCacheRejectUri(WPFB_Core::$settings->download_base . '/', $old_options['download_base'] . '/');
// TODO, do this in background
if (WPFB_Category::GetNumCats() < self::MANY_CATEGORIES && WPFB_File::GetNumFiles() < self::MANY_FILES) {
// avoid long activation time
wpfb_loadclass('Sync');
WPFB_Sync::SyncCats();
WPFB_Sync::UpdateItemsPath();
}
if (!wp_next_scheduled(WPFB . '_cron')) {
wp_schedule_event(time() + 20, 'hourly', WPFB . '_cron');
}
if (!get_option('wpfb_install_time')) {
add_option('wpfb_install_time', ($ft = (int) mysql2date('U', $wpdb->get_var("SELECT file_mtime FROM {$wpdb->wpfilebase_files} ORDER BY file_mtime ASC LIMIT 1"))) > 0 ? $ft : time(), null, 'no');
}
$wp_upload = wp_upload_dir();
// move old css
if (file_exists(WPFB_Core::GetOldCustomCssPath())) {
$wp_upload_ok = empty($wp_upload['error']) && is_writable($wp_upload['basedir']);
if ($wp_upload_ok && @rename(WPFB_Core::GetOldCustomCssPath(), $wp_upload['basedir'] . '/wp-filebase.css')) {
update_option('wpfb_css', $wp_upload['baseurl'] . '/wp-filebase.css?t=' . time());
}
}
// refresh css URL (in case upload_dir changed or upgrade from free to pro)
update_option('wpfb_css', trailingslashit(file_exists($wp_upload['basedir'] . '/wp-filebase.css') ? $wp_upload['baseurl'] : WPFB_PLUGIN_URI) . 'wp-filebase.css?t=' . time());
flush_rewrite_rules();
// change mapping of file browser folder icons (2340897_sdf.svg => svg-.....svg!)
$image_mappings = array('1449888880_folder.svg' => 'svg-folder.svg', '1449888883_folder.svg' => 'svg-folder-blue.svg', '1449888885_folder-blue.svg' => 'svg-folderblue.svg', '1449888886_folder-green.svg' => 'svg-folder-green.svg');
$folder_icons_base = '/plugins/wp-filebase/images/folder-icons/';
$folder_icon = substr(WPFB_Core::$settings->folder_icon, strlen($folder_icons_base));
if (isset($image_mappings[$folder_icon])) {
WPFB_Core::UpdateOption('folder_icon', $folder_icons_base . $image_mappings[$folder_icon]);
}
//delete_option('wpfilebase_dismiss_support_ending');
// fixes files that where offline
if ($old_ver === "3.4.2") {
$wpdb->query("UPDATE `{$wpdb->wpfilebase_files}` SET file_offline = '0' WHERE 1");
wpfb_loadclass('Sync');
WPFB_Sync::list_files(WPFB_Core::UploadDir());
}
}
示例2: OnActivateOrVerChange
static function OnActivateOrVerChange($old_ver = null)
{
global $wpdb;
// make sure that either wp-filebase or wp-filebase pro is enabled bot not both!
if (!function_exists('is_plugin_active')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (is_plugin_active('wp-filebase-pro/wp-filebase.php')) {
deactivate_plugins('wp-filebase/wp-filebase.php');
}
wpfb_loadclass('Admin', 'File', 'Category');
self::SetupDBTables($old_ver);
$old_options = get_option(WPFB_OPT_NAME);
self::AddOptions();
self::AddTpls($old_ver);
$new_options = get_option(WPFB_OPT_NAME);
WPFB_Admin::SettingsUpdated($old_options, $new_options);
self::ProtectUploadPath();
WPFB_Admin::WPCacheRejectUri(WPFB_Core::$settings->download_base . '/', $old_options['download_base'] . '/');
$ncats = WPFB_Category::GetNumCats();
$nfiles = WPFB_File::GetNumFiles();
if ($ncats < self::MANY_CATEGORIES && $nfiles < self::MANY_FILES) {
// avoid long activation time
wpfb_loadclass('Sync');
WPFB_Sync::SyncCats();
WPFB_Sync::UpdateItemsPath();
}
if (!wp_next_scheduled(WPFB . '_cron')) {
wp_schedule_event(time(), 'hourly', WPFB . '_cron');
}
if (!get_option('wpfb_install_time')) {
add_option('wpfb_install_time', ($ft = (int) mysql2date('U', $wpdb->get_var("SELECT file_mtime FROM {$wpdb->wpfilebase_files} ORDER BY file_mtime ASC LIMIT 1"))) > 0 ? $ft : time(), null, 'no');
}
// move old css
if (file_exists(WPFB_Core::GetOldCustomCssPath())) {
$wp_upload = wp_upload_dir();
$wp_upload_ok = empty($wp_upload['error']) && is_writable($wp_upload['basedir']);
if ($wp_upload_ok && @rename(WPFB_Core::GetOldCustomCssPath(), $wp_upload['basedir'] . '/wp-filebase.css')) {
update_option('wpfb_css', $wp_upload['baseurl'] . '/wp-filebase.css?t=' . time());
}
}
flush_rewrite_rules();
//delete_option('wpfilebase_dismiss_support_ending');
}
示例3: define
// ############# THIS FILE IS DEPRECATED!! ############
// ##########################################################
// ##########################################################
// ob_start();
define('WPFB_NO_CORE_INIT', true);
define('WP_INSTALLING', true);
// make wp load faster
if (empty($_GET['rp'])) {
// if rel path not set, need to load whole WP stuff to get to path to custom CSS!
require_once dirname(__FILE__) . '/../../../cms/wp-load.php';
}
require_once dirname(__FILE__) . '/wp-filebase.php';
// this only loads some wp-filebase stuff, NOT WP!
wpfb_loadclass('Core');
WPFB_Core::InitDirectScriptAccess();
$file = WPFB_Core::GetOldCustomCssPath(stripslashes(@$_GET['rp']));
//echo $file;
//@ob_end_clean();
if (empty($file) || !@file_exists($file) || !@is_writable($file)) {
// TODO: remove writable check? this is for security!
$file = WPFB_PLUGIN_ROOT . 'wp-filebase.css';
}
$ftime = filemtime($file);
header("Content-Type: text/css");
header("Cache-Control: max-age=3600");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $ftime) . " GMT");
header("Content-Length: " . filesize($file));
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ftime) {
header("HTTP/1.x 304 Not Modified");
exit;
}
示例4: Display
static function Display()
{
global $wpdb, $user_ID;
wpfb_loadclass('Admin', 'Output');
$_POST = stripslashes_deep($_POST);
$_GET = stripslashes_deep($_GET);
$action = !empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
$clean_uri = remove_query_arg(array('message', 'action', 'file_id', 'cat_id', 'deltpl', 'hash_sync'));
// keep search keyword
?>
<div class="wrap">
<?php
$upload_path = WPFB_Core::$settings->upload_path;
if (path_is_absolute($upload_path)) {
echo '<div class="updated fade"><p>';
printf(__('Custom CSS does only work if upload path is relative to WordPress path. It is currently set to <code>%s</code>, so <b>custom CSS will not work!</b>', WPFB), $upload_path);
echo "</p></div>";
}
switch ($action) {
default:
if (!current_user_can('edit_themes')) {
wp_die(__('Cheatin’ uh?'));
}
// try to use default wp upload path
$wp_upload = wp_upload_dir();
$wp_upload_ok = empty($wp_upload['error']) && is_writable($wp_upload['basedir']);
// if no file at wp upload, fallback to Old custom css path
$css_path_edit = $wp_upload_ok && (is_file($wp_upload['basedir'] . '/wp-filebase.css') || !empty($_POST['newcontent'])) ? $wp_upload['basedir'] . '/wp-filebase.css' : WPFB_Core::GetOldCustomCssPath();
$css_path_default = WPFB_PLUGIN_ROOT . 'wp-filebase.css';
$exists = file_exists($css_path_edit) && is_file($css_path_edit);
if ($exists && !is_writable($css_path_edit) || !$exists && !is_writable(dirname($css_path_edit))) {
?>
<div class="error default-password-nag"><p><?php
printf(__('%s is not writable!', WPFB), $css_path_edit);
?>
</p></div><?php
break;
}
if (!empty($_POST['restore_default'])) {
update_option('wpfb_css', WPFB_PLUGIN_URI . 'wp-filebase.css?t=' . time());
@unlink($css_path_edit);
$exists = false;
} elseif (!empty($_POST['submit']) && !empty($_POST['newcontent'])) {
// write
$newcontent = stripslashes($_POST['newcontent']);
$newcontent = self::MakeCssUrlsAbsolute($newcontent);
$exists = file_put_contents($css_path_edit, $newcontent) !== false;
update_option('wpfb_css', $wp_upload_ok ? $wp_upload['baseurl'] . '/wp-filebase.css?t=' . time() : false);
}
$fpath = $exists ? $css_path_edit : $css_path_default;
$content = esc_html(file_get_contents($fpath));
?>
<form name="csseditor" id="csseditor" action="<?php
echo $clean_uri;
?>
&action=edit_css" method="post">
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress css" style="width: 98%;"><?php
echo $content;
?>
</textarea>
<input type="hidden" name="action" value="edit_css" />
<p class="submit">
<?php
echo "<input type='submit' name='submit' class='button-primary' value='" . esc_attr__('Update File', WPFB) . "' tabindex='2' />";
?>
<?php
if ($exists) {
echo "<input type='submit' name='restore_default' class='button' onclick=\"return confirm('Sure?')\" value='" . esc_attr__('Restore Default', WPFB) . "' tabindex='3' />";
}
?>
</p>
</div>
</form>
<?php
break;
// edit_css
}
?>
</div> <!-- wrap -->
<?php
}