本文整理汇总了PHP中wpfb_loadclass函数的典型用法代码示例。如果您正苦于以下问题:PHP wpfb_loadclass函数的具体用法?PHP wpfb_loadclass怎么用?PHP wpfb_loadclass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpfb_loadclass函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
WPFB_Admin::PrintFlattrHead();
?>
<div class="wrap"><?php
switch ($action) {
default:
?>
<div id="wpfilebase-donate">
<p><?php
_e('If you like WP-Filebase I would appreciate a small donation to support my work. You can additionally add an idea to make WP-Filebase even better. Just click the button below. Thank you!', WPFB);
?>
</p>
<?php
WPFB_Admin::PrintPayPalButton();
WPFB_Admin::PrintFlattrButton();
?>
</div>
<?php
break;
}
?>
</div> <!-- wrap -->
<?php
}
开发者ID:parsonsc,项目名称:dofe,代码行数:32,代码来源:AdminGuiSupport.php
示例2: testCreateTree
function testCreateTree()
{
$this->testSetUser();
wpfb_loadclass('Admin');
/** @var WPFB_Category $parent */
$parent = null;
/** @var WPFB_Category[] $cats */
$cats = array();
for ($d = 0; $d < 4; $d++) {
$res = WPFB_Admin::InsertCategory(array('cat_name' => "layer {$d}", 'cat_parent' => $parent ? $parent->GetId() : 0));
$this->assertEmpty($res['error']);
/** @var WPFB_Category $cat */
$cat = $res['cat'];
$this->assertTrue($parent ? $cat->GetParent()->Equals($parent) : is_null($cat->GetParent()));
$this->assertTrue(is_dir($cat->GetLocalPath()));
$cats[] = $cat;
$parent = $cat;
}
// print_r(array_map( function($c) { return strval($c);}, $cats));
$files = new TestFileSet();
$res = WPFB_Admin::InsertFile(array('file_remote_uri' => 'file://' . $files->getImageBanner(), 'file_category' => $parent));
$this->assertEmpty($res['error'], $res['error']);
/** @var WPFB_File $file01 */
$file01 = $res['file'];
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:25,代码来源:test-posttype.php
示例3: Create
public static function Create($form_url, $is_edit = false)
{
$uploader_class = version_compare(get_bloginfo('version'), '3.2.1') <= 0 ? 'SWFUpload' : 'PLUpload';
wpfb_loadclass($uploader_class);
$uploader_class = "WPFB_" . $uploader_class;
return new $uploader_class($form_url, $is_edit);
}
开发者ID:TishoTM,项目名称:WP-Filebase,代码行数:7,代码来源:AdvUploader.php
示例4: Display
static function Display()
{
wpfb_loadclass('Output', 'File', 'Category', 'TplLib');
$content = '';
$file_tpls = WPFB_Core::GetTpls('file');
$cat_tpls = WPFB_Core::GetTpls('cat');
if (true || !isset($file_tpls['filebrowser_admin'])) {
$file_tpls['filebrowser_admin'] = '%file_small_icon% ' . '%file_display_name% (%file_size%) ' . '<!-- IF %file_user_can_edit% --><a href="%file_edit_url%" class="edit" onclick="wpfbFBEditFile(event)">%\'Edit\'%</a><!-- ENDIF -->' . '<!-- IF %file_user_can_edit% --><a href="#" class="delete" onclick="return confirm(\'Sure?\') && wpfbFBDelete(event) && false;">%\'Delete\'%</a><!-- ENDIF -->';
WPFB_Core::SetFileTpls($file_tpls);
//WPFB_Admin::ParseTpls();
}
if (true || !isset($cat_tpls['filebrowser_admin'])) {
$cat_tpls['filebrowser_admin'] = '<span class="cat-icon" style="background-image:url(\'%cat_icon_url%\');"><span class="cat-icon-overlay"></span></span>' . '%cat_name% ' . '<!-- IF %cat_user_can_edit% --><a href="%cat_edit_url%" class="edit" onclick="wpfbFBEditCat(event)">%\'Edit\'%</a><!-- ENDIF -->' . '<!-- IF %cat_user_can_edit% --><a href="#" class="delete" onclick="return confirm(\'Sure?\') && wpfbFBDelete(event) && false;">%\'Delete\'%</a><!-- ENDIF -->';
WPFB_Core::SetCatTpls($cat_tpls);
WPFB_Admin::ParseTpls();
}
WPFB_Output::FileBrowser($content, 0, empty($_GET['wpfb_cat']) ? 0 : intval($_GET['wpfb_cat']));
WPFB_Core::PrintJS();
?>
<div class="wrap filebrowser-admin">
<h2><?php
_e('File Browser', 'wp-filebase');
?>
</h2>
<?php
echo '<div>' . __('You can Drag & Drop (multiple) files directly on Categories to upload them. Dragging a category or an existing file to another category is also possible.', 'wp-filebase') . '</div>';
echo $content;
?>
</div>
<script>
function wpfbFBEditCat(e) {
e.stopPropagation();
}
function wpfbFBEditFile(e) {
e.stopPropagation();
}
function wpfbFBDelete(e) {
e.stopPropagation();
var t = jQuery(e.currentTarget).parents('li').first();
var d = {wpfb_action: 'delete'};
var tid = t.attr('id').split('-');
d[tid[tid.length-2]+'_id'] = +tid[tid.length-1];
jQuery.ajax({type: 'POST', url: wpfbConf.ajurl, data: d,
//async: false,
success: (function (data) {
if (data == '1') {
t.fadeOut(300, function() { t.remove(); });
}
})
});
return false;
}
</script>
<?php
}
开发者ID:TishoTM,项目名称:WP-Filebase,代码行数:59,代码来源:AdminGuiFileBrowser.php
示例5: _manually_load_plugin
function _manually_load_plugin()
{
require dirname(dirname(__FILE__)) . '/wp-filebase.php';
add_action('init', function () {
require_once dirname(dirname(__FILE__)) . '/classes/Core.php';
wpfb_loadclass('Setup');
WPFB_Setup::OnActivateOrVerChange(null);
WPFB_Core::$settings = (object) get_option(WPFB_OPT_NAME);
WPFB_Core::InitClass();
}, 1);
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:11,代码来源:bootstrap.php
示例6: AnalyzeFile
static function AnalyzeFile($file)
{
@ini_set('max_execution_time', '0');
@set_time_limit(0);
$filename = is_string($file) ? $file : $file->GetLocalPath();
$info = WPFB_Core::$settings->disable_id3 ? array() : self::GetEngine()->analyze($filename);
if (!empty($_GET['debug'])) {
wpfb_loadclass('Sync');
WPFB_Sync::PrintDebugTrace("file_analyzed_" . $file->GetLocalPathRel());
}
return $info;
}
开发者ID:Seravo,项目名称:WP-Filebase,代码行数:12,代码来源:GetID3.php
示例7: Check
static function Check($tpl)
{
$result = array('error' => false, 'msg' => '', 'line' => '');
wpfb_loadclass('File');
$f = new WPFB_File();
$tpl = 'return (' . $tpl . ');';
if (!@eval($tpl)) {
$result['error'] = true;
$err = error_get_last();
if (!empty($err)) {
$result['msg'] = $err['message'];
$result['line'] = $err['line'];
}
}
return $result;
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:16,代码来源:TplLib.php
示例8: test_new_file_remote
function test_new_file_remote()
{
$usr = wp_create_user('test_admin', 'test_admin');
$this->assertNotWPError($usr);
wp_set_current_user($usr);
wpfb_loadclass('Admin');
$res = WPFB_Admin::InsertFile(array('file_remote_uri' => 'https://wpfilebase.com/wp-content/blogs.dir/2/files/2015/03/banner_023.png'));
$this->assertEmpty($res['error'], $res['error']);
/** @var WPFB_File $file */
$file = $res['file'];
$this->assertTrue($file->IsLocal(), 'IsLocal false');
$this->assertFileExists($file->GetLocalPath());
$this->assertNotEmpty($file->file_thumbnail);
$this->assertFileExists($file->GetThumbPath());
$this->assertTrue($file->Remove());
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:16,代码来源:test-create-file.php
示例9: __construct
function __construct()
{
wpfb_loadclass('Download', 'Admin');
$dir = WPFB_Core::UploadDir() . '/.tmp/';
WPFB_Admin::Mkdir($dir);
$test_files = array('banner.png' => 'https://wpfilebase.com/wp-content/blogs.dir/2/files/2015/03/banner_023.png', 'small.txt' => 'https://wpfilebase.com/robots.txt');
$this->local_files = array();
foreach ($test_files as $f => $u) {
$fn = $dir . $f;
$this->local_files[$f] = $fn;
if (file_exists($fn)) {
continue;
}
echo "Downloading test file {$u}\n";
WPFB_Download::SideloadFile($u, $fn);
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:17,代码来源:create-test-files.php
示例10: test_cat_tree
/**
* @depends test_new_cat
*/
function test_cat_tree()
{
wpfb_loadclass('Admin');
$depth = 4;
/** @var WPFB_Category $parent */
$parent = null;
$cats = array();
for ($d = 0; $d < $depth; $d++) {
$res = WPFB_Admin::InsertCategory(array('cat_name' => "layer {$d}", 'cat_parent' => $parent ? $parent->GetId() : 0));
$this->assertEmpty($res['error']);
/** @var WPFB_Category $cat */
$cat = $res['cat'];
$this->assertTrue($parent ? $cat->GetParent()->Equals($parent) : is_null($cat->GetParent()));
$cats[] = $cat;
}
foreach (array_reverse($cats) as $cat) {
$res = $cat->Delete();
$this->assertEmpty($res['error'], $res['error']);
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:23,代码来源:test-create-category.php
示例11: Display
static function Display()
{
wpfb_loadclass('Output', 'File', 'Category', 'TplLib');
$content = '';
$file_tpls = WPFB_Core::GetTpls('file');
$cat_tpls = WPFB_Core::GetTpls('cat');
if (true || !isset($file_tpls['filebrowser_admin'])) {
$file_tpls['filebrowser_admin'] = '%file_small_icon% ' . '%file_display_name% (%file_size%) ' . '<!-- IF %file_user_can_edit% --><a href="%file_edit_url%" class="edit" onclick="wpfbFBEditFile(event)">%\'Edit\'%</a><!-- ENDIF -->';
WPFB_Core::SetFileTpls($file_tpls);
//WPFB_Admin::ParseTpls();
}
if (true || !isset($cat_tpls['filebrowser_admin'])) {
$cat_tpls['filebrowser_admin'] = '<span class="cat-icon" style="background-image:url(\'%cat_icon_url%\');"><span class="cat-icon-overlay"></span></span>' . '%cat_name% ' . '<!-- IF %cat_user_can_edit% --><a href="%cat_edit_url%" class="edit" onclick="wpfbFBEditCat(event)">%\'Edit\'%</a><!-- ENDIF -->';
WPFB_Core::SetCatTpls($cat_tpls);
WPFB_Admin::ParseTpls();
}
WPFB_Output::FileBrowser($content, 0, empty($_GET['wpfb_cat']) ? 0 : intval($_GET['wpfb_cat']));
WPFB_Core::PrintJS();
?>
<div class="wrap filebrowser-admin">
<h2><?php
_e('File Browser', WPFB);
?>
</h2>
<?php
echo '<div>' . __('You can Drag & Drop (multiple) files directly on Categories to upload them. Dragging a category or an existing file to another category is also possible.', WPFB) . '</div>';
echo $content;
?>
</div>
<script>
function wpfbFBEditCat(e) {
e.stopPropagation();
}
function wpfbFBEditFile(e) {
e.stopPropagation();
}
</script>
<?php
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:41,代码来源:AdminGuiFileBrowser.php
示例12: analyzeFile
/**
* Intesive analysis of file contents. Does _not_ make changes to the file or store anything in the DB!
*
* @param type $file
* @return type
*/
private static function analyzeFile($file)
{
@ini_set('max_execution_time', '0');
@set_time_limit(0);
$filename = is_string($file) ? $file : $file->GetLocalPath();
$times = array();
$times['analyze'] = microtime(true);
$info = WPFB_Core::$settings->disable_id3 ? array() : self::GetEngine()->analyze($filename);
if (!WPFB_Core::$settings->disable_id3 && class_exists('getid3_lib')) {
getid3_lib::CopyTagsToComments($info);
}
if (!empty($_GET['debug'])) {
wpfb_loadclass('Sync');
WPFB_Sync::PrintDebugTrace("file_analyzed_" . $file->GetLocalPathRel());
}
$times['end'] = microtime(true);
$t_keys = array_keys($times);
$into['debug'] = array('timestamp' => $times[$t_keys[0]], 'timings' => array());
for ($i = 1; $i < count($t_keys); $i++) {
$info['debug']['timings'][$t_keys[$i - 1]] = round(($times[$t_keys[$i]] - $times[$t_keys[$i - 1]]) * 1000);
}
return $info;
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:29,代码来源:GetID3.php
示例13: 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());
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:60,代码来源:Setup.php
示例14: GetSortSql
static function GetSortSql($sort = null, $attach_order = false, $for_cat = false)
{
global $wpdb;
wpfb_loadclass('Output');
list($sort, $sortdir) = WPFB_Output::ParseSorting($sort, $for_cat);
$sort = esc_sql($sort);
$of = $for_cat ? 'cat_order' : 'file_attach_order';
return $attach_order ? "`{$of}` ASC, `{$sort}` {$sortdir}" : "`{$sort}` {$sortdir}";
}
开发者ID:Seravo,项目名称:WP-Filebase,代码行数:9,代码来源:Core.php
示例15: ChangeCategoryOrName
function ChangeCategoryOrName($new_cat_id, $new_name = null, $add_existing = false, $overwrite = false)
{
// 1. apply new values (inherit permissions if nothing (Everyone) set!)
// 2. check for name collision and rename
// 3. move stuff
// 4. notify parents
// 5. update child paths
if (empty($new_name)) {
$new_name = $this->GetName();
}
$this->Lock(true);
$new_cat_id = intval($new_cat_id);
$old_cat_id = $this->GetParentId();
$old_path_rel = $this->GetLocalPathRel(true);
$old_path = $this->GetLocalPath();
$old_name = $this->GetName();
if ($this->is_file) {
$old_thumb_path = $this->GetThumbPath();
}
$old_cat = $this->GetParent();
$new_cat = WPFB_Category::GetCat($new_cat_id);
if (!$new_cat) {
$new_cat_id = 0;
}
$cat_changed = $new_cat_id != $old_cat_id;
if ($cat_changed && $new_cat_id > 0 && $this->IsAncestorOf($new_cat)) {
return array('error' => __('Cannot move category into a sub-category of itself.', WPFB));
}
if ($this->is_file) {
$this->file_category = $new_cat_id;
$this->file_name = $new_name;
$this->file_category_name = $new_cat_id == 0 ? '' : $new_cat->GetTitle();
} else {
$this->cat_parent = $new_cat_id;
$this->cat_folder = $new_name;
}
// inherit user roles
if (count($this->GetReadPermissions()) == 0) {
$this->SetReadPermissions($new_cat_id != 0 ? $new_cat->GetReadPermissions() : WPFB_Core::$settings->default_roles);
}
// flush cache
$this->last_parent_id = -1;
$new_path_rel = $this->GetLocalPathRel(true);
$new_path = $this->GetLocalPath();
if ($new_path_rel != $old_path_rel) {
$i = 1;
if (!$add_existing) {
$name = $this->GetName();
if ($overwrite) {
if (@file_exists($new_path)) {
$ex_file = WPFB_File::GetByPath($new_path_rel);
if (!is_null($ex_file)) {
$ex_file->Remove();
} else {
@unlink($new_path);
}
}
} else {
// rename item if filename collision (ignore if coliding with $this)
while (@file_exists($new_path) || !is_null($ex_file = WPFB_File::GetByPath($new_path_rel)) && !$this->Equals($ex_file)) {
$i++;
if ($this->is_file) {
$p = strrpos($name, '.');
$this->file_name = $p <= 0 ? "{$name}({$i})" : substr($name, 0, $p) . "({$i})" . substr($name, $p);
} else {
$this->cat_folder = "{$name}({$i})";
}
$new_path_rel = $this->GetLocalPathRel(true);
$new_path = $this->GetLocalPath();
}
}
}
// finally move it!
if (!empty($old_name) && @file_exists($old_path)) {
if ($this->is_file && $this->IsLocal()) {
if (!@rename($old_path, $new_path)) {
return array('error' => sprintf('Unable to move file %s!', $old_path));
}
@chmod($new_path, octdec(WPFB_PERM_FILE));
} else {
if (!@is_dir($new_path)) {
wp_mkdir_p($new_path);
}
wpfb_loadclass('FileUtils');
if (!@WPFB_FileUtils::MoveDir($old_path, $new_path)) {
return array('error' => sprintf('Could not move folder %s to %s', $old_path, $new_path));
}
}
} else {
if ($this->is_category) {
if (!@is_dir($new_path) && !wp_mkdir_p($new_path)) {
return array('error' => sprintf(__('Unable to create directory %s. Is it\'s parent directory writable?'), $new_path));
}
}
}
// move thumb
if ($this->is_file && !empty($old_thumb_path) && @is_file($old_thumb_path)) {
$thumb_path = $this->GetThumbPath();
if ($i > 1) {
$p = strrpos($thumb_path, '-');
//.........这里部分代码省略.........
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:101,代码来源:Item.php
示例16: FileSearchContent
static function FileSearchContent(&$ref_content)
{
wpfb_loadclass('ListTpl');
$tpl = WPFB_ListTpl::Get(WPFB_Core::$settings->search_result_tpl);
if ($tpl !== null) {
$ref_content .= $tpl->Generate(null, array('page_limit' => WPFB_Core::$settings->filelist_num));
} else {
$files = WPFB_File::GetFiles2(self::SearchWhereSql(WPFB_Core::$settings->search_id3, stripslashes($_GET['wpfb_s'])), WPFB_Core::$settings->hide_inaccessible);
foreach ($files as $file) {
$ref_content .= $file->GenTpl2();
}
}
}
开发者ID:parsonsc,项目名称:dofe,代码行数:13,代码来源:Search.php
示例17: _e
</h2>
<div id="catselect-filter">
<p><?php
_e('Select the categories containing the files you would like to list.', 'wp-filebase');
?>
</p>
<p><input type="checkbox" id="list-all-files" name="list-all-files" value="1" onchange="incAllCatsChanged(this.checked)"/> <label for="list-all-files"><?php
_e('Include all Categories', 'wp-filebase');
?>
</label></p>
</div>
<ul id="catbrowser" class="filetree"></ul>
<?php
wpfb_loadclass('TreeviewAdmin');
WPFB_TreeviewAdmin::RenderHTML("catbrowser");
?>
</div>
<form id="listtplselect" class="insert">
<h2><?php
_e('Select Template', 'wp-filebase');
?>
</h2>
<?php
$tpls = WPFB_ListTpl::GetAll();
if (!empty($tpls)) {
foreach ($tpls as $tpl) {
echo '<label><input type="radio" name="listtpl" value="' . $tpl->tag . '" />' . $tpl->GetTitle() . '</label><br />';
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:31,代码来源:editor-plugin.php
示例18: wpfb_loadclass
<?php
wpfb_loadclass('Item');
class WPFB_Category extends WPFB_Item
{
var $cat_id;
var $cat_name;
var $cat_description;
var $cat_folder;
var $cat_path;
var $cat_parent = 0;
var $cat_num_files = 0;
var $cat_num_files_total = 0;
var $cat_user_roles;
var $cat_owner = 0;
var $cat_icon;
var $cat_exclude_browser = 0;
var $cat_order;
static $cache = array();
static $cache_complete = false;
/**
* Get category objects
*
* @access public
*
* @param $extra_sql Optional
* @return WPFB_Category[] Categories
*/
static function GetCats($extra_sql = null)
{
global $wpdb;
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:31,代码来源:Category.php
示例19: 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");
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:31,代码来源:wp-filebase_css.php
示例20: SendFile
static function SendFile($file_path, $args = array())
{
global $wpdb;
$defaults = array('bandwidth' => 0, 'etag' => null, 'force_download' => WPFB_Core::$settings->force_download, 'cache_max_age' => 0, 'md5_hash' => null, 'filename' => null);
extract(wp_parse_args($args, $defaults), EXTR_SKIP);
@ini_set('max_execution_time', '0');
@set_time_limit(0);
@error_reporting(0);
while (@ob_end_clean()) {
}
$no_cache = WPFB_Core::$settings->http_nocache && $cache_max_age != 0;
@ini_set("zlib.output_compression", "Off");
// remove some headers
if (function_exists('header_remove')) {
header_remove();
} else {
header("Expires: ");
header("X-Pingback: ");
}
if (!@file_exists($file_path) || !is_file($file_path)) {
header('HTTP/1.x 404 Not Found');
wp_die('File ' . basename($file_path) . ' not found!');
}
wpfb_loadclass('FileUtils');
$size = WPFB_FileUtils::GetFileSize($file_path);
$time = filemtime($file_path);
$file_type = WPFB_Download::GetFileType($file_path);
if (empty($etag)) {
$etag = md5("{$size}|{$time}|{$file_type}");
} else {
$etag = trim($etag, '"');
}
// set basic headers
if ($no_cache) {
header("Cache-Control: no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
} elseif ($cache_max_age > 0) {
header("Cache-Control: must-revalidate, max-age={$cache_max_age}");
} elseif ($cache_max_age == -1) {
header("Cache-Control: public");
}
//header("Connection: close");
//header("Keep-Alive: timeout=5, max=100");
//header("Connection: Keep-Alive");
header("Content-Type: " . $file_type . (strpos($file_type, 'text/') !== false ? '; charset=' : ''));
// charset fix
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $no_cache ? time() : $time) . " GMT");
if (!empty($md5_hash) && $md5_hash[0] != '#') {
// check if fake md5
$pmd5 = @pack('H32', $md5_hash);
if (!empty($pmd5)) {
header("Content-MD5: " . @base64_encode($pmd5));
}
}
if (!$no_cache) {
header("ETag: \"{$etag}\"");
$if_mod_since = !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false;
$if_none_match = !empty($_SERVER['HTTP_IF_NONE_MATCH']) ? $etag == trim($_SERVER['HTTP_IF_NONE_MATCH'], '"') : false;
if ($if_mod_since || $if_none_match) {
$not_modified = true;
if ($not_modified && $if_mod_since) {
$not_modified = @strtotime($if_mod_since) >= $time;
}
if ($not_modified && $if_none_match) {
$not_modified = $if_none_match == $etag;
}
if ($not_modified) {
header("Content-Length: " . $size);
header("HTTP/1.x 304 Not Modified");
exit;
}
}
}
if (!($fh = @fopen($file_path, 'rb'))) {
wp_die(__('Could not read file!', 'wp-filebase'));
}
list($begin, $end) = self::ParseRangeHeader($size);
if ($begin > 0 || $end < $size - 1) {
header('HTTP/1.0 206 Partial Content');
header("Content-Range: bytes {$begin}-{$end}/{$size}");
} else {
header('HTTP/1.0 200 OK');
}
$length = $end - $begin + 1;
WPFB_Download::AddTraffic($length);
if (self::ShouldSendRangeHeader($file_path, $file_type)) {
header("Accept-Ranges: bytes");
}
$request_file_name = basename(urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
$filename_set = !empty($filename);
if (!$filename_set) {
$filename = basename($file_path);
}
// content headers
if ($force_download) {
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Description: File Transfer");
} elseif ($filename != $request_file_name) {
header("Content-Disposition: inline; filename=\"{$filename}\"");
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:Download.php
注:本文中的wpfb_loadclass函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论