本文整理汇总了PHP中WPFB_Core类的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core类的具体用法?PHP WPFB_Core怎么用?PHP WPFB_Core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WPFB_Core类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
}
示例2: AddTraffic
static function AddTraffic($bytes)
{
$traffic = wpfb_call('Misc', 'GetTraffic');
$traffic['month'] = $traffic['month'] + $bytes;
$traffic['today'] = $traffic['today'] + $bytes;
$traffic['time'] = time();
WPFB_Core::UpdateOption('traffic_stats', $traffic);
}
示例3: _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);
}
示例4: AdminBar
static function AdminBar()
{
global $wp_admin_bar;
WPFB_Core::PrintJS();
$wp_admin_bar->add_menu(array('id' => WPFB, 'title' => WPFB_PLUGIN_NAME, 'href' => admin_url('admin.php?page=wpfilebase_manage')));
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-add-file', 'title' => __('Add File', WPFB), 'href' => admin_url('admin.php?page=wpfilebase_files#addfile')));
$current_object = get_queried_object();
if (!empty($current_object) && !empty($current_object->post_type) && $current_object->ID > 0) {
$link = WPFB_PLUGIN_URI . 'editor_plugin.php?manage_attachments=1&post_id=' . $current_object->ID;
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-attachments', 'title' => __('Manage attachments', WPFB), 'href' => $link, 'meta' => array('onclick' => 'window.open("' . $link . '", "wpfb-manage-attachments", "width=680,height=400,menubar=no,location=no,resizable=no,status=no,toolbar=no,scrollbars=yes");return false;')));
}
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-add-file', 'title' => __('Sync Filebase', WPFB), 'href' => admin_url('admin.php?page=wpfilebase_manage&action=sync')));
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-toggle-context-menu', 'title' => __(!empty(WPFB_Core::$settings->file_context_menu) ? 'Disable file context menu' : 'Enable file context menu', WPFB), 'href' => 'javascript:;', 'meta' => array('onclick' => 'return wpfb_toggleContextMenu();')));
}
示例5: GetEngine
static function GetEngine()
{
if (!self::$engine) {
if (!class_exists('getID3')) {
$tmp_dir = WPFB_Core::UploadDir() . '/.tmp';
if (!is_dir($tmp_dir)) {
@mkdir($tmp_dir);
}
define('GETID3_TEMP_DIR', $tmp_dir . '/');
unset($tmp_dir);
require_once WPFB_PLUGIN_ROOT . 'extras/getid3/getid3.php';
}
self::$engine = new getID3();
}
return self::$engine;
}
示例6: __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);
}
}
示例7: AdminBar
static function AdminBar()
{
global $wp_admin_bar;
WPFB_Core::PrintJS();
$wp_admin_bar->add_menu(array('id' => WPFB, 'title' => WPFB_PLUGIN_NAME, 'href' => admin_url('admin.php?page=wpfilebase_manage')));
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-add-file', 'title' => __('Add File', 'wp-filebase'), 'href' => admin_url('admin.php?page=wpfilebase_files#addfile')));
$current_object = get_queried_object();
$is_filebrowser = false;
if (!empty($current_object) && !empty($current_object->post_type) && $current_object->ID > 0) {
$is_filebrowser = $current_object->ID == WPFB_Core::$settings->file_browser_post_id;
$link = esc_attr(admin_url('?wpfilebase-screen=editor-plugin&manage_attachments=1&post_id=' . $current_object->ID));
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-attachments', 'title' => __('Manage attachments', 'wp-filebase'), 'href' => $link, 'meta' => array('onclick' => 'window.open("' . $link . '", "wpfb-manage-attachments", "width=680,height=400,menubar=no,location=no,resizable=no,status=no,toolbar=no,scrollbars=yes");return false;')));
}
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-add-file', 'title' => __('Sync Filebase', 'wp-filebase'), 'href' => admin_url('admin.php?page=wpfilebase_manage&action=sync')));
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-toggle-context-menu', 'title' => !empty(WPFB_Core::$settings->file_context_menu) ? __('Disable file context menu', 'wp-filebase') : __('Enable file context menu', 'wp-filebase'), 'href' => 'javascript:;', 'meta' => array('onclick' => 'return wpfb_toggleContextMenu();')));
if ($is_filebrowser) {
$wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-toggle-drag-drop', 'title' => get_user_option('wpfb_set_fbdd') ? __('Disable file browser Drag & Drop', 'wp-filebase') : __('Enable file browser Drag & Drop', 'wp-filebase'), 'href' => 'javascript:;', 'meta' => array('onclick' => 'jQuery.ajax({url:wpfbConf.ajurl,type:"POST",data:{wpfb_action:"set-user-setting",name:"fbdd",value:' . (get_user_option('wpfb_set_fbdd') ? 0 : 1) . '},async:false});location.reload();return false;')));
}
}
示例8: 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
}
示例9: GetIconUrl
function GetIconUrl($size = null)
{
// todo: remove file operations!
if ($this->is_category) {
// add mtime for cache updates
return empty($this->cat_icon) ? WP_CONTENT_URL . WPFB_Core::$settings->folder_icon : WPFB_Core::PluginUrl("wp-filebase_thumb.php?cid={$this->cat_id}&t=" . @filemtime($this->GetThumbPath()));
}
if (!empty($this->file_thumbnail)) {
return WPFB_Core::PluginUrl('wp-filebase_thumb.php?fid=' . $this->file_id . '&name=' . $this->file_thumbnail);
// name var only for correct caching!
}
$type = $this->GetType();
$ext = substr($this->GetExtension(), 1);
$img_path = ABSPATH . WPINC . '/images/';
$img_url = get_option('siteurl') . '/' . WPINC . '/images/';
$custom_folder = '/images/fileicons/';
// check for custom icons
if (file_exists(WP_CONTENT_DIR . $custom_folder . $ext . '.png')) {
return WP_CONTENT_URL . $custom_folder . $ext . '.png';
}
if (file_exists(WP_CONTENT_DIR . $custom_folder . $type . '.png')) {
return WP_CONTENT_URL . $custom_folder . $type . '.png';
}
// todo: cache file_exists
if (file_exists($img_path . 'crystal/' . $ext . '.png')) {
return $img_url . 'crystal/' . $ext . '.png';
}
if (file_exists($img_path . 'crystal/' . $type . '.png')) {
return $img_url . 'crystal/' . $type . '.png';
}
if (file_exists($img_path . $ext . '.png')) {
return $img_url . $ext . '.png';
}
if (file_exists($img_path . $type . '.png')) {
return $img_url . $type . '.png';
}
// fallback to default
if (file_exists($img_path . 'crystal/default.png')) {
return $img_url . 'crystal/default.png';
}
if (file_exists($img_path . 'default.png')) {
return $img_url . 'default.png';
}
// fallback to blank :(
return $img_url . 'blank.gif';
}
示例10: array_keys
if (($n = count($tags)) > 0) {
$ks = array_keys($tags);
for ($i = 0; $i < $n; $i++) {
if (stripos($ks[$i], $tag) === 0) {
while ($i < $n && stripos($ks[$i], $tag) === 0) {
$props[] = array('t' => $ks[$i], 'n' => $tags[$ks[$i]]);
$i++;
}
//break;
}
}
}
wpfb_print_json($props);
exit;
case 'new-cat':
if (!WPFB_Core::CurUserCanCreateCat()) {
die('-1');
}
wpfb_loadclass('Admin');
$result = WPFB_Admin::InsertCategory($_POST);
if (isset($result['error']) && $result['error']) {
wpfb_print_json(array('error' => $result['error']));
exit;
}
$cat = $result['cat'];
$args = WPFB_Output::fileBrowserArgs($_POST['args']);
$filesel = $args['type'] === 'fileselect';
$catsel = $args['type'] === 'catselect';
wpfb_print_json(array('error' => 0, 'id' => $cat->GetId(), 'name' => $cat->GetTitle(), 'id_str' => $args['idp'] . 'cat-' . $cat->cat_id, 'url' => $cat->GetUrl(), 'text' => WPFB_Output::fileBrowserCatItemText($catsel, $filesel, $cat, $args['onselect'], empty($_REQUEST['is_admin']) ? 'filebrowser' : 'filebrowser_admin'), 'classes' => $filesel || $catsel ? 'folder' : null));
exit;
case 'change-category':
示例11: do_shortcode
<body class="single single-post">
<div id="page" class="site">
<div id="main" class="wrapper">
<div id="primary" class="site-content">
<div id="content" role="main">
<div class="entry-content">
<?php
if ($list) {
$tpl = WPFB_ListTpl::Get($tag);
if (is_null($tpl)) {
exit;
}
echo do_shortcode($tpl->Sample(WPFB_AdminGuiTpls::$sample_cat, WPFB_AdminGuiTpls::$sample_file));
} else {
$tpl_src = WPFB_Core::GetTpls($type, $tag);
if (!is_string($tpl_src) || empty($tpl_src)) {
exit;
}
$table_found = strpos($tpl_src, '<table') !== false;
if (!$list && !$table_found && strpos($tpl_src, '<tr') !== false) {
$tpl_src = "<table>{$tpl_src}</table>";
}
$item = $type == 'cat' ? WPFB_AdminGuiTpls::$sample_cat : WPFB_AdminGuiTpls::$sample_file;
echo do_shortcode($item->GenTpl(WPFB_TplLib::Parse($tpl_src), 'sample'));
}
?>
</div>
</div>
</div>
</div>
示例12: Chmod
static function Chmod($base_dir, $files)
{
$result = array();
$upload_dir = self::cleanPath(WPFB_Core::UploadDir());
$upload_dir_len = strlen($upload_dir);
// chmod
if (is_writable($upload_dir)) {
@chmod($upload_dir, octdec(WPFB_PERM_DIR));
}
for ($i = 0; $i < count($files); $i++) {
$f = "{$base_dir}/" . $files[$i];
if (file_exists($f)) {
@chmod($f, octdec(WPFB_PERM_FILE));
if (!is_writable($f) && !is_writable(dirname($f))) {
$result[] = sprintf(__('File <b>%s</b> is not writable!', WPFB), substr($f, $upload_dir_len));
}
}
}
return $result;
}
示例13: PrintScripts
function PrintScripts($prefix = '', $auto_submit = false)
{
$this->Scripts($prefix);
$minify = true;
if ($minify) {
ob_start();
}
?>
<script type="text/javascript">
/* <![CDATA[ */
function fileQueued(fileObj) {
jQuery('#file-upload-progress').show().html('<div class="progress"><div class="percent">0%</div><div class="bar" style="width: 30px"></div></div><div class="filename original"> ' + fileObj.name + '</div>');
jQuery('.progress', '#file-upload-progress').show();
jQuery('.filename', '#file-upload-progress').show();
jQuery("#media-upload-error").empty();
jQuery('.upload-flash-bypass').hide();
jQuery('#file-submit').prop('disabled', true);
jQuery('#cancel-upload').show().prop('disabled', false);
/* delete already uploaded temp file */
if(jQuery('#file_flash_upload').val() != '0') {
jQuery.ajax({type: 'POST', async: true, url:"<?php
echo esc_attr(WPFB_Core::PluginUrl('wpfb-async-upload.php'));
?>
",
data: {<?php
echo $this->GetAjaxAuthData(true);
?>
, "delupload": jQuery('#file_flash_upload').val()},
success: (function(data){})
});
jQuery('#file_flash_upload').val(0);
}
}
function wpFileError(fileObj, message) {
jQuery('#media-upload-error').show().html(message);
jQuery('.upload-flash-bypass').show();
jQuery("#file-upload-progress").hide().empty();
jQuery('#cancel-upload').hide().prop('disabled', true);
}
function uploadError(fileObj, errorCode, message, uploader) {
wpFileError(fileObj, "Error "+errorCode+": "+message);
}
function uploadSuccess(fileObj, serverData) {
/* if async-upload returned an error message, place it in the media item div and return */
if ( serverData.match('media-upload-error') || serverData.match('error-div') ) {
wpFileError(fileObj, serverData);
return;
}
var file_obj = jQuery.parseJSON(serverData);
if(file_obj && 'undefined' != typeof(file_obj.file_id)) {
jQuery('#file_form_action').val("updatefile");
jQuery('#file_id').val(file_obj.file_id);
if(file_obj.file_thumbnail) {
jQuery('#file_thumbnail_wrap').show();
jQuery('#file_thumbnail_wrap').children('img').attr('src', file_obj.file_thumbnail_url);
jQuery('#file_thumbnail_name').html(file_obj.file_thumbnail);
} else {
jQuery('#file_thumbnail_wrap').hide();
}
jQuery('#file_display_name').val(file_obj.file_display_name);
jQuery('#file_version').val(file_obj.file_version);
jQuery('#wpfb-file-nonce').val(file_obj.nonce);
} else {
jQuery('#file_flash_upload').val(serverData);
}
jQuery('#file-submit').prop('disabled', false);
<?php
if ($auto_submit) {
?>
jQuery('#file_flash_upload').closest("form").submit();
<?php
}
?>
}
function uploadComplete(fileObj) {
jQuery('#cancel-upload').hide().prop('disabled', true);
}
/* ]]> */
</script>
<?php
//.........这里部分代码省略.........
示例14: 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;
}
示例15: OnDeactivate
static function OnDeactivate()
{
wp_clear_scheduled_hook(WPFB . '_cron');
self::UnProtectUploadPath();
$sync_data_file = WPFB_Core::UploadDir() . '/._sync.data';
is_file($sync_data_file) && unlink($sync_data_file);
//delete_option('wpfilebase_dismiss_support_ending');
delete_option('wpfb_license_nag');
if (get_option('wpfb_uninstall')) {
self::RemoveOptions();
self::DropDBTables();
self::RemoveTpls();
delete_option('wpfilebase_cron_sync_time');
delete_option('wpfilebase_cron_sync_stats');
delete_option('wpfb_license_key');
delete_option('wpfilebase_last_check');
delete_option('wpfilebase_forms');
delete_option('wpfilebase_ftags');
delete_option('wpfilebase_rsyncs');
delete_option('wpfb_uninstall');
delete_option('wpfilebase_dismiss_support_ending');
}
}