예제 #1
0
	
	</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 />';
        }
    }
    ?>
	<i><a href="<?php 
    echo admin_url('admin.php?page=wpfilebase_tpls#list');
    ?>
" target="_parent"><?php 
    _e('Add Template', 'wp-filebase');
    ?>
</a></i>
</form>
예제 #2
0
파일: Search.php 프로젝트: parsonsc/dofe
 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();
         }
     }
 }
예제 #3
0
파일: wpfb-ajax.php 프로젝트: parsonsc/dofe
     if (!current_user_can('edit_posts')) {
         die('-1');
     }
     wpfb_loadclass('File', 'Category', 'TplLib', 'Output');
     if (isset($_POST['tpl']) && empty($_POST['tpl'])) {
         exit;
     }
     $cat = new WPFB_Category(array('cat_id' => 0, 'cat_name' => 'Example Category', 'cat_description' => 'This is a sample description.', 'cat_folder' => 'example', 'cat_num_files' => 0, 'cat_num_files_total' => 0));
     $cat->Lock();
     $file = new WPFB_File(array('file_name' => 'example.pdf', 'file_display_name' => 'Example Document', 'file_size' => 1024 * 1024 * 1.5, 'file_date' => gmdate('Y-m-d H:i:s', time()), 'file_hash' => md5(''), 'file_thumbnail' => 'thumb.png', 'file_description' => 'This is a sample description.', 'file_version' => WPFB_VERSION, 'file_author' => $user_identity, 'file_hits' => 3, 'file_added_by' => $current_user->ID));
     $file->Lock();
     if (!empty($_POST['type']) && $_POST['type'] == 'cat') {
         $item = $cat;
     } elseif (!empty($_POST['type']) && $_POST['type'] == 'list') {
         wpfb_loadclass('ListTpl');
         $tpl = new WPFB_ListTpl('sample', $_REQUEST['tpl']);
         echo $tpl->Sample($cat, $file);
         exit;
     } elseif (empty($_POST['file_id']) || ($item = WPFB_File::GetFile($_POST['file_id'])) == null || !$file->CurUserCanAccess(true)) {
         $item = $file;
     } else {
         die('-1');
     }
     $tpl = empty($_POST['tpl']) ? null : WPFB_TplLib::Parse($_POST['tpl']);
     echo do_shortcode($item->GenTpl($tpl, 'ajax'));
     exit;
 case 'fileinfo':
     wpfb_loadclass('File', 'Category');
     if (empty($_REQUEST['url']) && (empty($_REQUEST['id']) || !is_numeric($_REQUEST['id']))) {
         die('-1');
     }
예제 #4
0
?>
" />
<?php 
wp_head();
?>
</head>
<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'));
예제 #5
0
    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);
            ?>
</select>
		</td>
	</tr>
	<tr class="form-field">
		<th scope="row" valign="top"><label for="tpl-list-file-tpl"><?php 
            _e('File Template', 'wp-filebase');
            ?>
</label></th>
		<td>
			<select id="tpl-list-file-tpl" name="tpl-list-file-tpl" onchange="WPFB_PreviewTpl(this, '<?php 
            echo $type;
            ?>
')"><?php 
            echo WPFB_Admin::TplDropDown('file', $tpl->file_tpl_tag);
            ?>
</select>
		</td>
	</tr>
	<tr class="form-field">
		<th scope="row" valign="top"><label for="tpl-list-footer"><?php 
            _e('Footer', 'wp-filebase');
            ?>
</label></th>
		<td>
			<textarea id="tpl-list-footer" name="tpl-list-footer" cols="70" rows="<?php 
            echo max(2, count(explode("\n", $tpl->footer))) + 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->footer);
            ?>
</textarea><br />
		</td>
	</tr>

</table>
	<?php 
        } else {
            ?>
	<p>
		<?php 
            _e('Template Code:', 'wp-filebase');
            ?>
<br />
		<textarea id="<?php 
            echo $code_id;
            ?>
" cols="70" rows="<?php 
            echo max(2, count(explode("\n", $tpl_code))) + 3;
            ?>
" wrap="off" name="tplcode" class="codepress html wpfilebase-tpledit" onkeyup="WPFB_PreviewTpl(this, '<?php 
            echo $type;
            ?>
')" onchange="WPFB_PreviewTpl(this, '<?php 
            echo $type;
            ?>
')"><?php 
            echo htmlspecialchars($tpl_code);
            ?>
</textarea><br />
		<?php 
            wpfb_loadclass('Models');
            echo WPFB_Models::TplFieldsSelect($code_id, false, $cat);
            ?>
	</p>
	<?php 
        }
        ?>
			
	<p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php 
        echo esc_attr__($new ? 'Add Template' : 'Submit Template Changes', 'wp-filebase');
        ?>
" /></p>
</form>

<div class="entry-content wpfilebase-tpl-preview">
	<div id="<?php 
        echo $code_id;
        ?>
_preview"><?php 
        if ($list) {
            echo $tpl->Sample(self::$sample_cat, self::$sample_file);
        } else {
            echo empty($tpl_code) ? '<i>' . __('Preview') . '</i>' : $item->GenTpl(WPFB_TplLib::Parse($tpl_code), 'sample');
        }
        ?>
</div>
	<div style="height: 50px; float: left;"></div>
	<div class="clear"></div>
</div>
<?php 
    }
예제 #6
0
파일: Output.php 프로젝트: parsonsc/dofe
 static function FileList($args)
 {
     global $wpdb;
     wpfb_loadclass('File', 'Category', 'ListTpl');
     $tpl_tag = empty($args['tpl']) ? 'default' : $args['tpl'];
     $tpl = WPFB_ListTpl::Get($tpl_tag);
     if (empty($tpl)) {
         if (current_user_can('edit_posts')) {
             return "<p>[" . WPFB_PLUGIN_NAME . "]: <b>WARNING</b>: List template {$tpl_tag} does not exist!</p>";
         } elseif (is_null($tpl = WPFB_ListTpl::Get('default'))) {
             return '';
         }
     }
     $cats = empty($args['id']) || $args['id'] == -1 ? $args['showcats'] ? WPFB_Category::GetCats() : null : array_filter(array_map(array('WPFB_Category', 'GetCat'), explode(',', $args['id'])));
     return $tpl->Generate($cats, array('cat_grouping' => $args['showcats'], 'cat_order' => $args['sortcats'], 'file_order' => $args['sort'], 'page_limit' => $args['num'], 'hide_pagenav' => isset($args['pagenav']) && !(int) $args['pagenav']));
 }
예제 #7
0
파일: Ajax.php 프로젝트: noxian/WP-Filebase
 private static function tplSample($args)
 {
     global $current_user;
     if (!current_user_can('edit_posts')) {
         die('-1');
     }
     wpfb_loadclass('File', 'Category', 'TplLib', 'Output');
     if (isset($args['tpl']) && empty($args['tpl'])) {
         exit;
     }
     $cat = new WPFB_Category(array('cat_id' => 0, 'cat_name' => 'Example Category', 'cat_description' => 'This is a sample description.', 'cat_folder' => 'example', 'cat_num_files' => 0, 'cat_num_files_total' => 0));
     $cat->Lock();
     $file = new WPFB_File(array('file_name' => 'example.pdf', 'file_display_name' => 'Example Document', 'file_size' => 1024 * 1024 * 1.5, 'file_date' => gmdate('Y-m-d H:i:s', time()), 'file_hash' => md5(''), 'file_thumbnail' => 'thumb.png', 'file_description' => 'This is a sample description.', 'file_version' => WPFB_VERSION, 'file_author' => $current_user->display_name, 'file_hits' => 3, 'file_added_by' => $current_user->ID));
     $file->Lock();
     if (!empty($args['type']) && $args['type'] == 'cat') {
         $item = $cat;
     } elseif (!empty($args['type']) && $args['type'] == 'list') {
         wpfb_loadclass('ListTpl');
         $tpl = new WPFB_ListTpl('sample', $args['tpl']);
         echo $tpl->Sample($cat, $file);
         exit;
     } elseif (empty($args['file_id']) || ($item = WPFB_File::GetFile($args['file_id'])) == null || !$file->CurUserCanAccess(true)) {
         $item = $file;
     } else {
         die('-1');
     }
     $tpl = empty($args['tpl']) ? null : WPFB_TplLib::Parse($args['tpl']);
     echo do_shortcode($item->GenTpl($tpl, 'ajax'));
 }