本文整理汇总了PHP中WPFB_Core::GetTpls方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::GetTpls方法的具体用法?PHP WPFB_Core::GetTpls怎么用?PHP WPFB_Core::GetTpls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::GetTpls方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ParseHeaderFooter
private function ParseHeaderFooter($str, $uid = null)
{
$str = preg_replace_callback('/%sort_?link:([a-z0-9_]+)%/i', array(__CLASS__, 'GenSortlink'), $str);
if (strpos($str, '%search_form%') !== false) {
wpfb_loadclass('Output');
$str = str_replace('%search_form%', WPFB_Output::GetSearchForm("", $_GET), $str);
}
$str = preg_replace_callback('/%print_?(script|style):([a-z0-9_-]+)%/i', array(__CLASS__, 'PrintScriptCallback'), $str);
if (empty($uid)) {
$uid = uniqid();
}
$str = str_replace('%uid%', $uid, $str);
$count = 0;
$str = preg_replace("/jQuery\\((.+?)\\)\\.dataTable\\s*\\((.*?)\\)(\\.?.*?)\\s*;/", 'jQuery($1).dataTable((function(options){/*%WPFB_DATA_TABLE_OPTIONS_FILTER%*/})($2))$3;', $str, -1, $count);
if ($count > 0) {
$dataTableOptions = array();
list($sort_field, $sort_dir) = wpfb_call('Output', 'ParseSorting', $this->current_list->file_order);
$file_tpl = WPFB_Core::GetTpls('file', $this->file_tpl_tag);
if (($p = strpos($file_tpl, "%{$sort_field}%")) > 0) {
// get the column index of field to sort
$col_index = substr_count($file_tpl, "</t", 0, $p);
$dataTableOptions["aaSorting"] = array(array($col_index, strtolower($sort_dir)));
}
if ($this->current_list->page_limit > 0) {
$dataTableOptions["iDisplayLength"] = $this->current_list->page_limit;
}
$str = str_replace('/*%WPFB_DATA_TABLE_OPTIONS_FILTER%*/', " var wpfbOptions = " . json_encode($dataTableOptions) . "; " . " if('object' == typeof(options)) { for (var v in options) { wpfbOptions[v] = options[v]; } }" . " return wpfbOptions; ", $str);
}
return $str;
}
示例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 -->' . '<!-- 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
}
示例3: 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
}
示例4: 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>
示例5: TplDropDown
static function TplDropDown($type, $selected = null)
{
$tpls = WPFB_Core::GetTpls($type);
$content = '<option value="default">' . __('Default') . '</option>';
foreach ($tpls as $tag => $tpl) {
if ($tag != 'default') {
$content .= '<option value="' . $tag . '"' . ($selected == $tag ? ' selected="selected"' : '') . '>' . __(__(esc_attr(WPFB_Output::Filename2Title($tag))), WPFB) . '</option>';
}
}
return $content;
}
示例6: TplForm
static function TplForm($type, $tpl_tag = null)
{
$new = empty($tpl_tag);
$cat = $type == 'cat';
$list = $type == 'list';
$code_id = 'tplinp_' . $type;
if (!$list) {
if ($new) {
$tpl_code = empty($_POST['tplcode']) ? '' : $_POST['tplcode'];
} else {
$tpl_code = WPFB_Core::GetTpls($type, $tpl_tag);
if (empty($tpl_code)) {
$tpl_code = '';
}
}
$item = $cat ? self::$sample_cat : self::$sample_file;
} else {
$tpl = $new ? new WPFB_ListTpl() : WPFB_ListTpl::Get($tpl_tag);
}
?>
<h2><?php
$new ? _e('Add Template', 'wp-filebase') : _e('Edit Template', 'wp-filebase');
if (!empty($tpl_tag)) {
echo ' ' . self::TplTitle($tpl_tag);
}
?>
</h2>
<form action="<?php
echo remove_query_arg(array('action', 'type', 'tpl')) . '#' . $type;
?>
" method="post">
<?php
wp_nonce_field(($new ? 'add' : 'update') . '-' . $type, 'wpfb-tpl-nonce');
?>
<input type="hidden" name="action" value="<?php
echo $new ? 'add' : 'update';
?>
" />
<input type="hidden" name="type" value="<?php
echo $type;
?>
" />
<?php
if ($new) {
?>
<p>
<label for="tpltag"><?php
_e('Template Tag (a single word to describe the template):', 'wp-filebase');
?>
</label>
<input type="text" name="tpltag" value="<?php
if (!empty($_POST['tpltag'])) {
echo esc_attr($_POST['tpltag']);
}
?>
" tabindex="1" maxlength="20" />
</p>
<?php
} else {
?>
<input type="hidden" name="tpltag" value="<?php
echo esc_attr($tpl_tag);
?>
" /><?php
}
if ($list) {
?>
<table class="form-table">
<tr class="form-field">
<th scope="row" valign="top"><label for="tpl-list-header"><?php
_e('Header', 'wp-filebase');
?>
</label></th>
<td width="100%">
<textarea id="tpl-list-header" name="tpl-list-header" cols="70" rows="<?php
echo max(2, count(explode("\n", $tpl->header))) + 3;
?>
" wrap="off" class="codepress html wpfilebase-tpledit" onkeyup="WPFB_PreviewTpl(this, '<?php
echo $type;
?>
')" onchange="WPFB_PreviewTpl(this, '<?php
echo $type;
?>
')"><?php
echo htmlspecialchars($tpl->header);
?>
</textarea><br />
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="tpl-list-cat-tpl"><?php
_e('Category Template', 'wp-filebase');
?>
</label></th>
<td width="">
<select id="tpl-list-cat-tpl" name="tpl-list-cat-tpl" onchange="WPFB_PreviewTpl(this, '<?php
echo $type;
?>
')"><?php
echo WPFB_Admin::TplDropDown('cat', $tpl->cat_tpl_tag);
//.........这里部分代码省略.........