本文整理汇总了PHP中WPFB_Core::SetCatTpls方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::SetCatTpls方法的具体用法?PHP WPFB_Core::SetCatTpls怎么用?PHP WPFB_Core::SetCatTpls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::SetCatTpls方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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
}
示例3: 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()
};
//.........这里部分代码省略.........