本文整理汇总了PHP中WPFB_Core::PrintJS方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::PrintJS方法的具体用法?PHP WPFB_Core::PrintJS怎么用?PHP WPFB_Core::PrintJS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::PrintJS方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();')));
}
示例3: 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;')));
}
}
示例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 -->';
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
}
示例5: AdminPrintScripts
static function AdminPrintScripts()
{
if (!empty($_GET['page']) && strpos($_GET['page'], 'wpfilebase_') !== false) {
WPFB_Core::PrintJS();
}
if (has_filter('ckeditor_external_plugins')) {
?>
<script type="text/javascript">
//<![CDATA[
/* CKEditor Plugin */
if(typeof(ckeditorSettings) == 'object') {
ckeditorSettings.externalPlugins.wpfilebase = ajaxurl+'/../../wp-content/plugins/wp-filebase/extras/ckeditor/';
ckeditorSettings.additionalButtons.push(["WPFilebase"]);
}
//]]>
</script>
<?php
}
}
示例6: Display
static function Display()
{
global $wpdb;
wpfb_loadclass('Admin', 'Output');
WPFB_Core::PrintJS();
// prints wpfbConf.ajurl
wp_register_script('jquery-imagepicker', WPFB_PLUGIN_URI . 'extras/jquery/image-picker/image-picker.min.js', array('jquery'), WPFB_VERSION);
wp_register_style('jquery-imagepicker', WPFB_PLUGIN_URI . 'extras/jquery/image-picker/image-picker.css', array(), WPFB_VERSION);
if (!current_user_can('manage_options')) {
wp_die(__('Cheatin’ uh?') . '<!-- manage_options -->');
}
// nonce and referer check (security)
if ((!empty($_POST['reset']) || !empty($_POST['submit'])) && !check_admin_referer('wpfb-update-settings', 'wpfb-nonce')) {
wp_die(__('Cheatin’ uh?'));
}
$post = stripslashes_deep($_POST);
$action = !empty($post['action']) ? $post['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
$messages = array();
$errors = array();
$options = get_option(WPFB_OPT_NAME);
$option_fields = WPFB_Admin::SettingsSchema();
if (isset($post['reset'])) {
// keep templates
$file_tpl = WPFB_Core::$settings->template_file;
$cat_tpl = WPFB_Core::$settings->template_cat;
wpfb_loadclass('Setup');
WPFB_Setup::ResetOptions();
WPFB_Core::UpdateOption('template_file', $file_tpl);
WPFB_Core::UpdateOption('template_cat', $cat_tpl);
$new_options = get_option(WPFB_OPT_NAME);
$messages = array_merge($messages, WPFB_Admin::SettingsUpdated($options, $new_options));
unset($new_options);
$messages[] = __('Settings reseted.', WPFB);
$options = get_option(WPFB_OPT_NAME);
} elseif (isset($post['submit'])) {
// cleanup
foreach ($option_fields as $opt_tag => $opt_data) {
if (isset($post[$opt_tag])) {
if (!is_array($post[$opt_tag])) {
$post[$opt_tag] = trim($post[$opt_tag]);
}
switch ($opt_data['type']) {
case 'number':
$post[$opt_tag] = intval($post[$opt_tag]);
break;
case 'select':
// check if value is in options array, if not set to default
if (!in_array($post[$opt_tag], array_keys($opt_data['options']))) {
$post[$opt_tag] = $opt_data['default'];
}
break;
case 'roles':
$post[$opt_tag] = array_values(array_filter($post[$opt_tag]));
// the following must not be removed! if the roles array is empty, permissions are assumed to be set for everyone!
// so make sure that the admin is explicitly set!
if (!empty($opt_data['not_everyone']) && !in_array('administrator', $post[$opt_tag])) {
if (!is_array($post[$opt_tag])) {
$post[$opt_tag] = array();
}
array_unshift($post[$opt_tag], 'administrator');
}
break;
case 'cat':
$post[$opt_tag] = empty($post[$opt_tag]) || is_null($cat = WPFB_Category::GetCat($post[$opt_tag])) ? 0 : intval($post[$opt_tag]);
break;
}
}
}
$post['upload_path'] = str_replace(ABSPATH, '', $post['upload_path']);
$options['upload_path'] = str_replace(ABSPATH, '', $options['upload_path']);
$post['download_base'] = trim($post['download_base'], '/');
if (WPFB_Admin::WPCacheRejectUri($post['download_base'] . '/', $options['download_base'] . '/')) {
$messages[] = sprintf(__('/%s/ added to rejected URIs list of WP Super Cache.', WPFB), $post['download_base']);
}
$tpl_file = $post['template_file'];
$tpl_cat = $post['template_cat'];
if (!empty($tpl_file) && (empty($options['template_file_parsed']) || $tpl_file != $options['template_file'])) {
wpfb_loadclass('TplLib');
$tpl_file = WPFB_TplLib::Parse($tpl_file);
$result = WPFB_TplLib::Check($tpl_file);
if (!$result['error']) {
$options['template_file_parsed'] = $tpl_file;
$messages[] = __('File template successfully parsed.', WPFB);
} else {
$errors[] = sprintf(__('Could not parse template: error (%s) in line %s.', WPFB), $result['msg'], $result['line']);
}
}
if (!empty($tpl_cat) && (empty($options['template_cat_parsed']) || $tpl_cat != $options['template_cat'])) {
wpfb_loadclass('TplLib');
$tpl_cat = WPFB_TplLib::Parse($tpl_cat);
$result = WPFB_TplLib::Check($tpl_cat);
if (!$result['error']) {
$options['template_cat_parsed'] = $tpl_cat;
$messages[] = __('Category template successfully parsed.', WPFB);
} else {
$errors[] = sprintf(__('Could not parse template: error (%s) in line %s.', WPFB), $result['msg'], $result['line']);
}
}
$fb_sub_pages = get_pages(array('child_of' => $options['file_browser_post_id']));
if ($options['file_browser_post_id'] > 0 && count($fb_sub_pages)) {
//.........这里部分代码省略.........
示例7: Display
public function Display()
{
WPFB_Core::PrintJS();
wp_print_scripts('utils');
// setUserSetting
?>
<style type="text/css" media="screen">@import url(<?php
echo WPFB_PLUGIN_URI . 'css/batch-uploader.css';
?>
);</style>
<div id="<?php
echo $this->prefix;
?>
-uploader-wrap">
<div id="<?php
echo $this->prefix;
?>
-uploader-interface" class="wpfb-batch-uploader-interface">
<div class="form-wrap uploader-presets" id="<?php
echo $this->prefix;
?>
-uploader-presets">
<form method="POST" action="" class="validate" name="batch_presets">
<h2><?php
_e('Upload Presets', 'wp-filebase');
?>
</h2>
<?php
self::DisplayUploadPresets($this->prefix);
//wp_nonce_field('batch-presets'); // TODO validate this!
?>
</form>
</div>
<div id="<?php
echo $this->prefix;
?>
-drag-drop-uploader" class="drag-drop-uploader">
<h2>Drag & Drop</h2>
<div id="<?php
echo $this->prefix;
?>
-drag-drop-area" class="drag-drop-area">
<div style="margin: 70px auto 0;">
<p class="drag-drop-info"><?php
_e('Drop files here');
?>
</p>
<p><?php
_ex('or', 'Uploader: Drop files here - or - Select Files');
?>
</p>
<p class="drag-drop-buttons"><input id="<?php
echo $this->prefix;
?>
-browse-button" type="button" value="<?php
esc_attr_e('Select Files');
?>
" class="button" /></p>
</div>
</div>
<div id="<?php
echo $this->prefix;
?>
-uploader-errors"></div>
</div>
<div style="clear: both;"></div>
</div>
<div id="<?php
echo $this->prefix;
?>
-uploader-files" style="position:relative;"></div>
</div>
<?php
wp_print_scripts('jquery-color');
wp_print_scripts('jquery-deserialize');
?>
<script type="text/javascript">
var mouseDragPos = [];
var presetData = '';
var morePresets = 0;
jQuery(document).ready( function() {
var form = jQuery('#<?php
echo $this->prefix;
?>
-uploader-presets').find('form');
jQuery('#<?php
echo $this->prefix;
?>
-drag-drop-area').bind('dragover', function(e){
mouseDragPos = [e.originalEvent.pageX, e.originalEvent.pageY];
});
//.........这里部分代码省略.........
示例8: PrintForm
static function PrintForm($name, $item = null, $vars = array())
{
wpfb_loadclass('Output');
WPFB_Core::PrintJS();
/* only required for wpfbConf */
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
WPFB_formCategoryChanged();
});
function WPFB_formCategoryChanged()
{
var catId = jQuery('#file_category,#cat_parent').val();
if(!catId || catId <= 0) {
jQuery('#<?php
echo $name;
?>
_inherited_permissions_label').html('<?php
echo WPFB_Output::RoleNames(WPFB_Core::$settings->default_roles, true);
?>
');
} else {
jQuery.ajax({
url: wpfbConf.ajurl,
data: {action:"catinfo","id":catId},
dataType: "json",
success: (function(data){jQuery('#<?php
echo $name;
?>
_inherited_permissions_label').html(data.roles_str);})
});
}
}
//]]>
</script>
<?php
extract($vars);
if (is_writable(WPFB_Core::UploadDir())) {
include WPFB_PLUGIN_ROOT . 'lib/wpfb_form_' . $name . '.php';
}
}
示例9: Display
static function Display()
{
global $wpdb, $user_ID, $user_identity;
wpfb_loadclass('Admin', 'Output', 'TplLib', 'ListTpl');
WPFB_Core::PrintJS();
$_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
// security nonce
if (!empty($action) && $action != 'edit' && !check_admin_referer($action . '-' . $_REQUEST['type'], 'wpfb-tpl-nonce')) {
wp_die(__('Cheatin’ uh?'));
}
if ($action == 'add' || $action == 'update') {
if (empty($_POST['type'])) {
wp_die(__('Type missing!', 'wp-filebase'));
}
if (empty($_POST['tpltag'])) {
wp_die(__('Please enter a template tag.', 'wp-filebase'));
}
$type = $_POST['type'];
$for_cat = $type == 'cat';
$tpl_tag = preg_replace('/[^a-z0-9_-]/', '', str_replace(' ', '_', strtolower($_POST['tpltag'])));
if (empty($tpl_tag)) {
wp_die('Tag is invalid!');
}
if ($type == 'list') {
$data = array('header' => $_POST['tpl-list-header'], 'footer' => $_POST['tpl-list-footer'], 'cat_tpl_tag' => $_POST['tpl-list-cat-tpl'], 'file_tpl_tag' => $_POST['tpl-list-file-tpl']);
$tpl = new WPFB_ListTpl($tpl_tag, $data);
$tpl->Save();
} else {
if (empty($_POST['tplcode'])) {
wp_die('Please enter some template code.');
}
if ($tpl_tag == 'default') {
// hanle default tpls a bit different
WPFB_Core::UpdateOption("template_{$type}", $_POST['tplcode']);
} else {
$tpls = WPFB_Core::GetTpls($type);
$tpls[$tpl_tag] = $_POST['tplcode'];
if ($for_cat) {
WPFB_Core::SetCatTpls($tpls);
} else {
WPFB_Core::SetFileTpls($tpls);
}
}
}
WPFB_Admin::ParseTpls();
unset($_POST['type'], $_POST['tpltag'], $_POST['tplcode']);
} elseif ($action == 'del') {
if (!empty($_GET['type']) && !empty($_GET['tpl']) && !in_array($_GET['tpl'], self::$protected_tags)) {
$type = $_GET['type'];
if ($type == 'list') {
$tpl = WPFB_ListTpl::Get($_GET['tpl']);
if ($tpl) {
$tpl->Delete();
}
}
$for_cat = $type == 'cat';
$tpls = WPFB_Core::GetTpls($type);
unset($tpls['default']);
if (!empty($tpls)) {
unset($tpls[$_GET['tpl']]);
if ($for_cat) {
WPFB_Core::SetCatTpls($tpls);
} else {
WPFB_Core::SetFileTpls($tpls);
}
}
unset($_POST['type'], $_POST['tpl']);
}
WPFB_Admin::ParseTpls();
}
if (!empty($_POST['reset-tpls'])) {
wpfb_call('Setup', 'ResetTpls');
// also reset default templates stored in settings
wpfb_loadclass('Admin');
$settings_schema = WPFB_Admin::SettingsSchema();
WPFB_Core::UpdateOption('template_file', $settings_schema['template_file']['default']);
WPFB_Core::UpdateOption('template_cat', $settings_schema['template_cat']['default']);
WPFB_Admin::ParseTpls();
}
?>
<script type="text/javascript">
function WPFB_GenSuccess(data, textStatus, request)
{
this.html(data);
}
function WPFB_PreviewTpl(ta, ty)
{
var tplc = (ty != 'list') ? jQuery(ta).val() : {
header: jQuery('#tpl-list-header').val(),
footer: jQuery('#tpl-list-footer').val(),
file_tpl_tag: jQuery('#tpl-list-file-tpl').val(),
cat_tpl_tag: jQuery('#tpl-list-cat-tpl').val()
};
//.........这里部分代码省略.........
示例10: _e
?>
</label>
<input type="radio" name="list-cat-sort-order" id="list-cat-sort-order-desc" value="desc" />
<label for="list-cat-sort-order-desc" class="radio"><?php
_e('Descending');
?>
</label>
</p>
</form>
<?php
do_action('wpfilebase_editor_plugin_tabs');
}
/*manage_attachments*/
?>
<?php
do_action('admin_print_footer_scripts');
?>
<script type="text/javascript">
initEditorPlugin();
if(typeof wpOnload=='function')wpOnload();
</script>
<?php
WPFB_Core::PrintJS();
/* only required for wpfbConf */
?>
</body>
</html>