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 &amp; 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 
    }
    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 &amp; 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 
    }
Esempio n. 3
0
    ?>
<div class="wpfilebase-date-edit"><?php 
    touch_time($update, 0);
    ?>
</div></td>
	</tr>
	<tr class="form-field">
		<?php 
}
?>
		<th scope="row" valign="top"><label for="file_category"><?php 
_e('Category');
?>
</label></th>
		<td><select name="file_category" id="file_category" class="postform wpfb-cat-select" onchange="WPFB_formCategoryChanged();"><?php 
echo WPFB_Output::CatSelTree(array('selected' => $file_category, 'add_cats' => true));
?>
</select></td>
		<?php 
if ($exform && !empty(WPFB_Core::$settings->licenses)) {
    ?>
		<th scope="row" valign="top"><label for="file_license"><?php 
    _e('License', WPFB);
    ?>
</label></th>
		<td><select name="file_license" id="file_license" class="postform"><?php 
    echo WPFB_Admin::MakeFormOptsList('licenses', $file ? $file->file_license : null, true);
    ?>
</select></td>
		<?php 
}
Esempio n. 4
0
 function GetTitle()
 {
     return __(__(esc_html(WPFB_Output::Filename2Title($this->tag))), WPFB);
 }
Esempio n. 5
0
 static function GetSortSql($sort = null, $attach_order = false, $for_cat = false)
 {
     global $wpdb;
     wpfb_loadclass('Output');
     list($sort, $sortdir) = WPFB_Output::ParseSorting($sort, $for_cat);
     $sort = esc_sql($sort);
     $of = $for_cat ? 'cat_order' : 'file_attach_order';
     return $attach_order ? "`{$of}` ASC, `{$sort}` {$sortdir}" : "`{$sort}` {$sortdir}";
 }
Esempio n. 6
0
 static function PrintDebugTrace($tag = "")
 {
     if (!empty($_GET['debug'])) {
         wpfb_loadclass('Output');
         $ms = self::GetMemStats();
         echo "<!-- [{$tag}] (MEM: " . WPFB_Output::FormatFilesize($ms['used']) . " / {$ms['limit']}) BACKTRACE:\n";
         echo esc_html(print_r(wp_debug_backtrace_summary(), true));
         echo "\nEND -->";
         self::UpdateMemBar();
     }
 }
Esempio n. 7
0
    static function DisplayUploadPresets($prefix, $cat_select = true)
    {
        $defaults = array('display_name' => '', 'category' => 0, 'tags' => '', 'description' => '', 'version' => '', 'author' => '', 'license' => '', 'post_id' => 0, 'languages' => '', 'offline' => 0, 'user_roles' => '', 'direct_linking' => 1, 'platforms' => '', 'requirements' => '');
        ?>
	
<table class="form-table">
	
<?php 
        if ($cat_select) {
            ?>
<tr class="form-field">
	<th scope="row"><label for="batch_category"><?php 
            _e('Category');
            ?>
</label></th>
	<td><select name="file_category" id="<?php 
            echo $prefix;
            ?>
_category" class="wpfb-cat-select">
		<?php 
            echo WPFB_Output::CatSelTree(array('selected' => $defaults['category'], 'add_cats' => true));
            ?>
	</select>
	</td>
</tr>
<?php 
        }
        ?>

<tr class="form-field">
	<th scope="row"><label for="batch_tags"><?php 
        _e('Tags');
        ?>
</label></th>
	<td><input name="file_tags" id="<?php 
        echo $prefix;
        ?>
_tags" type="text" value="<?php 
        echo esc_attr(trim($defaults['tags'], ','));
        ?>
" maxlength="250" autocomplete="off" /></td>
</tr>

<tr class="form-field">
	<th scope="row"><label for="batch_description"><?php 
        _e('Description');
        ?>
</label></th>
	<td><textarea name="file_description" id="<?php 
        echo $prefix;
        ?>
_description" rows="2"><?php 
        echo esc_html($defaults['description']);
        ?>
</textarea></td>
</tr>

<tr class="form-field">
	<th scope="row"><label for="batch_author"><?php 
        _e('Author');
        ?>
</label></th>
	<td><input name="file_author" id="<?php 
        echo $prefix;
        ?>
_author" type="text" value="<?php 
        echo esc_attr($defaults['author']);
        ?>
" /></td>
</tr>
	
<?php 
        if (WPFB_Core::$settings->licenses) {
            ?>
<tr class="form-field">
	<th scope="row"><label for="batch_license"><?php 
            _e('License', 'wp-filebase');
            ?>
</label></th>
	<td><select id="<?php 
            echo $prefix;
            ?>
_license" name="file_license"><?php 
            echo WPFB_Admin::MakeFormOptsList('licenses', $defaults['license'], true);
            ?>
</select></td>
</tr>
<?php 
        }
        ?>

<tr class="form-field">
	<th scope="row"><label for="<?php 
        echo $prefix;
        ?>
_post_id"><?php 
        _e('Attach to Post', 'wp-filebase');
        ?>
</label></th>
	<td>ID: <input type="text" name="file_post_id" class="num" style="width:60px; text-align:right;" id="<?php 
        echo $prefix;
        ?>
_post_id" value="<?php 
        echo esc_attr($defaults['post_id']);
        ?>
" />
	<span id="<?php 
        echo $prefix;
        ?>
_post_title" style="font-style:italic;"><?php 
        if ($defaults['post_id'] > 0) {
            echo get_the_title($defaults['post_id']);
        }
        ?>
</span>
	<a href="javascript:;" class="button" onclick="WPFB_PostBrowser('<?php 
        echo $prefix;
        ?>
_post_id', '<?php 
        echo $prefix;
        ?>
_post_title');"><?php 
        _e('Select');
        ?>
</a></td>
</tr>

<tr>
	<td></td>
	<td><input type="checkbox" name="file_offline" id="<?php 
        echo $prefix;
        ?>
_offline" value="1" <?php 
        checked('1', $defaults['offline']);
        ?>
 />
	<label for="<?php 
        echo $prefix;
        ?>
_offline" style="display: inline;"><?php 
        _e('Don\'t publish uploaded files (set offline)', 'wp-filebase');
        ?>
</label></td>
</tr>

<?php 
        /*ADV_BATCH_UPLOADER*/
        ?>

</table>
	<?php 
    }
Esempio n. 8
0
    static function CatRow($cat, $sub_level = 0)
    {
        $cat_id = $cat->cat_id;
        $parent_cat = $cat->GetParent();
        $user_roles = $cat->GetReadPermissions();
        $title = esc_attr($cat->cat_name);
        if ($sub_level > 0) {
            $title = str_repeat('-', $sub_level) . " {$title}";
        }
        ?>
			<tr id="cat-<?php 
        echo $cat_id;
        ?>
">
				<th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php 
        echo $cat_id;
        ?>
" /><div style="font-size:11px; text-align:center;"><?php 
        echo $cat_id;
        ?>
</div></th>
				<td class="wpfilebase-admin-list-row-title"><a class="row-title" href="<?php 
        echo esc_attr($cat->GetEditUrl());
        ?>
" title="&quot;<?php 
        echo $title;
        ?>
&quot; bearbeiten">
				<?php 
        if (!empty($cat->cat_icon)) {
            ?>
<img src="<?php 
            echo $cat->GetIconUrl();
            ?>
" height="32" /><?php 
        }
        ?>
				<span><?php 
        echo $title;
        ?>
</span>
				</a></td>
				<td><?php 
        echo esc_html($cat->cat_description);
        ?>
</td>
				<td class="num"><?php 
        echo "<a href='" . admin_url("admin.php?page=wpfilebase_files&file_category=" . $cat->GetId()) . "'>{$cat->cat_num_files}</a> / {$cat->cat_num_files_total}";
        ?>
</td>
				<td><?php 
        echo $parent_cat ? '<a href="' . $parent_cat->GetEditUrl() . '">' . esc_html($parent_cat->cat_name) . '</a>' : '-';
        ?>
</td>
				<td><code><?php 
        echo esc_html($cat->cat_path);
        ?>
</code></td>
				<td><?php 
        echo WPFB_Output::RoleNames($user_roles, true);
        ?>
</td>

				<td><?php 
        echo $cat->GetOwnerId() <= 0 || !($usr = get_userdata($cat->GetOwnerId())) ? '-' : esc_html($usr->user_login);
        ?>
</td>
				<td class="num"><?php 
        echo $cat->cat_order;
        ?>
</td>
			</tr>
	<?php 
    }
Esempio n. 9
0
    static function WidgetStats()
    {
        global $wpdb;
        ?>
		<div id="col-container">
			<div id="col-right">
				<div class="col-wrap">
					<h3><?php 
        _e('Traffic', 'wp-filebase');
        ?>
</h3>
					<table class="wpfb-stats-table">
		<?php 
        $traffic_stats = wpfb_call('Misc', 'GetTraffic');
        $limit_day = WPFB_Core::$settings->traffic_day * 1048576;
        $limit_month = WPFB_Core::$settings->traffic_month * 1073741824;
        ?>
						<tr>
							<td><?php 
        if ($limit_day > 0) {
            WPFB_AdminGuiManage::ProgressBar($traffic_stats['today'] / $limit_day, WPFB_Output::FormatFilesize($traffic_stats['today']) . '/' . WPFB_Output::FormatFilesize($limit_day));
        } else {
            echo WPFB_Output::FormatFilesize($traffic_stats['today']);
        }
        ?>
</td>
							<th scope="row"><?php 
        _e('Today', 'wp-filebase');
        ?>
</th>
						</tr>
						<tr>
							<td><?php 
        if ($limit_month > 0) {
            WPFB_AdminGuiManage::ProgressBar($traffic_stats['month'] / $limit_month, WPFB_Output::FormatFilesize($traffic_stats['month']) . '/' . WPFB_Output::FormatFilesize($limit_month));
        } else {
            echo WPFB_Output::FormatFilesize($traffic_stats['month']);
        }
        ?>
</td>
							<th scope="row"><?php 
        _e('This Month', 'wp-filebase');
        ?>
</th>
						</tr>
						<tr>
							<td><?php 
        echo WPFB_Output::FormatFilesize($wpdb->get_var("SELECT SUM(file_size) FROM {$wpdb->wpfilebase_files}"));
        ?>
</td>
							<th scope="row"><?php 
        _e('Total File Size', 'wp-filebase');
        ?>
</th>
						</tr>	
					</table>
				</div>
			</div><!-- /col-right -->


			<div id="col-left">
				<div class="col-wrap">

					<h3><?php 
        _e('Statistics', 'wp-filebase');
        ?>
</h3>
					<table class="wpfb-stats-table">
						<tr>
							<td><?php 
        echo WPFB_File::GetNumFiles();
        ?>
</td>
							<th scope="row"><?php 
        _e('Files', 'wp-filebase');
        ?>
</th>				
						</tr>
						<tr>
							<td><?php 
        echo WPFB_Category::GetNumCats();
        ?>
</td>
							<th scope="row"><?php 
        _e('Categories');
        ?>
</th>
						</tr>
						<tr>
							<td><?php 
        echo "" . (int) $wpdb->get_var("SELECT SUM(file_hits) FROM {$wpdb->wpfilebase_files}");
        ?>
</td>
							<th scope="row"><?php 
        _e('Downloads', 'wp-filebase');
        ?>
</th>
						</tr>
					</table>
				</div>
			</div><!-- /col-left -->

		</div><!-- /col-container -->

		<?php 
    }
Esempio n. 10
0
 function column_perms($file)
 {
     return WPFB_Output::RoleNames($file->GetReadPermissions(), true);
 }
    static function Display()
    {
        global $wpdb, $user_ID;
        //register_shutdown_function( create_function('','$error = error_get_last(); if( $error && $error[\'type\'] != E_STRICT ){print_r( $error );}else{return true;}') );
        wpfb_loadclass('File', 'Category', 'Admin', 'Output');
        $_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', 'doit', 'ids', 'files', 'cats', 'batch_sync'));
        // keep search keyword
        // switch simple/extended form
        if (isset($_GET['exform'])) {
            $exform = !empty($_GET['exform']) && $_GET['exform'] == 1;
            update_user_option($user_ID, WPFB_OPT_NAME . '_exform', $exform, true);
        } else {
            $exform = (bool) get_user_option(WPFB_OPT_NAME . '_exform');
        }
        if (!empty($_GET['wpfb-hide-how-start'])) {
            update_user_option($user_ID, WPFB_OPT_NAME . '_hide_how_start', 1);
        }
        $show_how_start = !(bool) get_user_option(WPFB_OPT_NAME . '_hide_how_start');
        WPFB_Admin::PrintFlattrHead();
        ?>
	<script type="text/javascript">	
	/* Liking/Donate Bar */
	if(typeof(jQuery) != 'undefined') {
		jQuery(document).ready(function(){
			if(getUserSetting("wpfilebase_hidesuprow",false) == 1) {
				jQuery('#wpfb-liking').hide();
				jQuery('#wpfb-liking-toggle').addClass('closed');	
			}	
			jQuery('#wpfb-liking-toggle').click(function(){
				jQuery('#wpfb-liking').slideToggle();
				jQuery(this).toggleClass('closed');
				setUserSetting("wpfilebase_hidesuprow", 1-getUserSetting("wpfilebase_hidesuprow",false), 0);
			});	
		});
	}
	</script>
	

	<div class="wrap">
	<div id="icon-wpfilebase" class="icon32"><br /></div>
	<h2><?php 
        echo WPFB_PLUGIN_NAME;
        ?>
</h2>
	
	<?php 
        if ($show_how_start) {
            wpfb_call('AdminHowToStart', 'Display');
        }
        if (!empty($_GET['action'])) {
            echo '<p><a href="' . $clean_uri . '" class="button">' . __('Go back') . '</a></p>';
        }
        switch ($action) {
            default:
                $clean_uri = remove_query_arg('pagenum', $clean_uri);
                $upload_dir = WPFB_Core::UploadDir();
                $upload_dir_rel = str_replace(ABSPATH, '', $upload_dir);
                $chmod_cmd = "CHMOD " . WPFB_PERM_DIR . " " . $upload_dir_rel;
                if (!is_dir($upload_dir)) {
                    $result = WPFB_Admin::Mkdir($upload_dir);
                    if ($result['error']) {
                        $error_msg = sprintf(__('The upload directory <code>%s</code> does not exists. It could not be created automatically because the directory <code>%s</code> is not writable. Please create <code>%s</code> and make it writable for the webserver by executing the following FTP command: <code>%s</code>', WPFB), $upload_dir_rel, str_replace(ABSPATH, '', $result['parent']), $upload_dir_rel, $chmod_cmd);
                    } else {
                        wpfb_call('Setup', 'ProtectUploadPath');
                    }
                } elseif (!is_writable($upload_dir)) {
                    $error_msg = sprintf(__('The upload directory <code>%s</code> is not writable. Please make it writable for PHP by executing the follwing FTP command: <code>%s</code>', WPFB), $upload_dir_rel, $chmod_cmd);
                }
                if (!empty($error_msg)) {
                    echo '<div class="error default-password-nag"><p>' . $error_msg . '</p></div>';
                }
                if (!empty(WPFB_Core::$settings->tag_conv_req)) {
                    echo '<div class="updated"><p><a href="' . add_query_arg('action', 'convert-tags') . '">';
                    _e('WP-Filebase content tags must be converted', WPFB);
                    echo '</a></p></div><div style="clear:both;"></div>';
                }
                if (!get_post(WPFB_Core::$settings->file_browser_post_id)) {
                    echo '<div class="updated"><p>';
                    printf(__('File Browser post or page not set! Some features like search will not work. <a href="%s">Click here to set the File Browser Post ID.</a>', WPFB), esc_attr(admin_url('admin.php?page=wpfilebase_sets#' . sanitize_title(__('File Browser', WPFB)))));
                    echo '</p></div><div style="clear:both;"></div>';
                }
                /*
                wpfb_loadclass('Config');
                if(!WPFB_Config::IsWritable()) {
                	echo '<div class="updated"><p>';
                	printf(__('The config file %s is not writable or could not be created. Please create the file and make it writable for the webserver.',WPFB), WPFB_Config::$file);
                	echo '</p></div><div style="clear:both;"></div>';
                }
                */
                ?>
	<?php 
                if (self::PluginHasBeenUsedAWhile(true)) {
                    self::ProUpgradeNag();
                }
                if (self::PluginHasBeenUsedAWhile()) {
                    ?>
	
<div id="wpfb-support-col">
<div id="wpfb-liking-toggle"></div>
<h3><?php 
                    _e('Like WP-Filebase?', WPFB);
                    ?>
</h3>
<div id="wpfb-liking">
	<!-- <div style="text-align: center;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fwp-filebase%2F&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:140px; height:21px; display:inline-block; text-align:center;" <?php 
                    echo ' allowTransparency="true"';
                    ?>
></iframe></div> -->
	
	<div style="text-align: center;" ><a href="https://twitter.com/wpfilebase" class="twitter-follow-button" data-show-count="false">Follow @wpfilebase</a>
			<script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div>
	
	<p>Please <a href="http://wordpress.org/support/view/plugin-reviews/wp-filebase">give it a good rating</a>.</p>
	<p>For Cloud support and lots of other advanced features consider an</p>
	<p style="text-align: center;"><a href="https://wpfilebase.com/?ref=dblike" class="button-primary">Upgrade to Pro</a></p>
	<p style="text-align:right;float:right;font-style:italic;">Thanks, Fabian</p> 
	<!-- <div style="text-align: center;">
	<?php 
                    //WPFB_Admin::PrintPayPalButton()
                    ?>
	<?php 
                    //WPFB_Admin::PrintFlattrButton()
                    ?>
	</div> -->
</div>
</div>
<?php 
                }
                ?>

<div id="wpfb-stats-wrap" style="float:right; border-left: 1px solid #eee; margin-left: 5px;">
<div id="col-container">
	<div id="col-right">
		<div class="col-wrap">
			<h3><?php 
                _e('Traffic', WPFB);
                ?>
</h3>
			<table class="wpfb-stats-table">
			<?php 
                $traffic_stats = wpfb_call('Misc', 'GetTraffic');
                $limit_day = WPFB_Core::$settings->traffic_day * 1048576;
                $limit_month = WPFB_Core::$settings->traffic_month * 1073741824;
                ?>
			<tr>
				<td><?php 
                if ($limit_day > 0) {
                    self::ProgressBar($traffic_stats['today'] / $limit_day, WPFB_Output::FormatFilesize($traffic_stats['today']) . '/' . WPFB_Output::FormatFilesize($limit_day));
                } else {
                    echo WPFB_Output::FormatFilesize($traffic_stats['today']);
                }
                ?>
</td>
				<th scope="row"><?php 
                _e('Today', WPFB);
                ?>
</th>
			</tr>
			<tr>
				<td><?php 
                if ($limit_month > 0) {
                    self::ProgressBar($traffic_stats['month'] / $limit_month, WPFB_Output::FormatFilesize($traffic_stats['month']) . '/' . WPFB_Output::FormatFilesize($limit_month));
                } else {
                    echo WPFB_Output::FormatFilesize($traffic_stats['month']);
                }
                ?>
</td>
				<th scope="row"><?php 
                _e('This Month', WPFB);
                ?>
</th>
			</tr>
			<tr>
				<td><?php 
                echo WPFB_Output::FormatFilesize($wpdb->get_var("SELECT SUM(file_size) FROM {$wpdb->wpfilebase_files}"));
                ?>
</td>
				<th scope="row"><?php 
                _e('Total File Size', WPFB);
                ?>
</th>
			</tr>	
			</table>
</div>
</div><!-- /col-right -->
			
<div id="col-left">
<div class="col-wrap">

			<h3><?php 
                _e('Statistics', WPFB);
                ?>
</h3>
			<table class="wpfb-stats-table">
			<tr>
				<td><?php 
                echo WPFB_File::GetNumFiles();
                ?>
</td>
				<th scope="row"><?php 
                _e('Files', WPFB);
                ?>
</th>				
			</tr>
			<tr>
				<td><?php 
                echo WPFB_Category::GetNumCats();
                ?>
</td>
				<th scope="row"><?php 
                _e('Categories', WPFB);
                ?>
</th>
			</tr>
			<tr>
				<td><?php 
                echo "" . (int) $wpdb->get_var("SELECT SUM(file_hits) FROM {$wpdb->wpfilebase_files}");
                ?>
</td>
				<th scope="row"><?php 
                _e('Downloads', WPFB);
                ?>
</th>
			</tr>
			</table>
</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
</div>


<div>
<!-- <h2><?php 
                _e('Tools');
                ?>
</h2> -->
<?php 
                $cron_sync_desc = '';
                if (WPFB_Core::$settings->cron_sync) {
                    $cron_sync_desc .= __('Automatic sync is enabled. Cronjob scheduled hourly.');
                    $last_sync_time = intval(get_option(WPFB_OPT_NAME . '_cron_sync_time'));
                    $cron_sync_desc .= $last_sync_time > 0 ? " (" . sprintf(__('Last cron sync on %1$s at %2$s.', WPFB), date_i18n(get_option('date_format'), $last_sync_time), date_i18n(get_option('time_format'), $last_sync_time)) . ")" : '';
                } else {
                    $cron_sync_desc .= __('Cron sync is disabled.', WPFB);
                }
                $tools = array(array('url' => add_query_arg(array('action' => 'sync')), 'icon' => 'activity', 'label' => __('Sync Filebase', WPFB), 'desc' => __('Synchronises the database with the file system. Use this to add FTP-uploaded files.', WPFB) . '<br />' . $cron_sync_desc));
                if (current_user_can('install_plugins')) {
                    // is admin?
                    $new_tag = self::NewExtensionsAvailable() ? '<span class="wp-ui-notification new-exts">new</span>' : '';
                    $tools[] = array('url' => add_query_arg(array('action' => 'install-extensions')), 'icon' => 'plug', 'label' => __('Extensions', WPFB) . $new_tag, 'desc' => __('Install Extensions to extend functionality of WP-Filebase', WPFB));
                }
                ?>
<div id="wpfb-tools">
	<h2><?php 
                _e('Tools');
                ?>
</h2>
<ul>
<?php 
                foreach ($tools as $id => $tool) {
                    ?>
	<li id="wpfb-tool-<?php 
                    echo $id;
                    ?>
"><a href="<?php 
                    echo $tool['url'];
                    ?>
" <?php 
                    if (!empty($tool['confirm'])) {
                        ?>
 onclick="return confirm('<?php 
                        echo $tool['confirm'];
                        ?>
')" <?php 
                    }
                    ?>
 class="button"><span style="background-image:url(<?php 
                    echo esc_attr(WPFB_PLUGIN_URI);
                    ?>
images/<?php 
                    echo $tool['icon'];
                    ?>
.png)"></span><?php 
                    echo $tool['label'];
                    ?>
</a></li>
<?php 
                }
                ?>
</ul>
<?php 
                foreach ($tools as $id => $tool) {
                    ?>
	
<div id="wpfb-tool-desc-<?php 
                    echo $id;
                    ?>
" class="tool-desc">
	<?php 
                    echo $tool['desc'];
                    ?>
</div>
<?php 
                }
                ?>
<script>
if(!jQuery(document.body).hasClass('mobile')) {
	jQuery('#wpfb-tools li').mouseenter(function(e) {
		jQuery('#wpfb-tools .tool-desc').hide();
		jQuery('#wpfb-tool-desc-'+this.id.substr(10)).show();
	});
}
</script>
		
<?php 
                if (!empty(WPFB_Core::$settings->tag_conv_req)) {
                    ?>
<p><a href="<?php 
                    echo add_query_arg('action', 'convert-tags');
                    ?>
" class="button"><?php 
                    _e('Convert old Tags', WPFB);
                    ?>
</a> &nbsp; <?php 
                    printf(__('Convert tags from versions earlier than %s.', WPFB), '0.2.0');
                    ?>
</p> <?php 
                }
                ?>
<!--  <p><a href="<?php 
                echo add_query_arg('action', 'add-urls');
                ?>
" class="button"><?php 
                _e('Add multiple URLs', WPFB);
                ?>
</a> &nbsp; <?php 
                _e('Add multiple remote files at once.', WPFB);
                ?>
</p>
-->
</div>
	
	<div style="clear: both;"></div>

<?php 
                if (WPFB_Core::CurUserCanUpload()) {
                    WPFB_Admin::PrintForm('file', null, array('exform' => $exform));
                }
                ?>
			
		<?php 
                if (!$show_how_start) {
                    // display how start here if its hidden
                    wpfb_call('AdminHowToStart', 'Display');
                }
                ?>
			
			<h2><?php 
                _e('About');
                ?>
</h2>
			<p>
			<?php 
                echo WPFB_PLUGIN_NAME . ' ' . WPFB_VERSION;
                ?>
 by Fabian Schlieper <a href="http://fabi.me/">
			<?php 
                if (strpos($_SERVER['SERVER_PROTOCOL'], 'HTTPS') === false) {
                    ?>
<img src="http://fabi.me/misc/wpfb_icon.gif?lang=<?php 
                    if (defined('WPLANG')) {
                        echo WPLANG;
                    }
                    ?>
" alt="" /><?php 
                }
                ?>
 fabi.me</a><br/>
			Includes the great file analyzer <a href="http://www.getid3.org/">getID3()</a> by James Heinrich.<br />
			Tools Icons by <a href="http://www.icondeposit.com/">Matt Gentile</a>.
			</p>
			<?php 
                if (current_user_can('edit_files')) {
                    ?>
			<p><a href="<?php 
                    echo admin_url('plugins.php?wpfb-uninstall=1');
                    ?>
" class="button"><?php 
                    _e('Completely Uninstall WP-Filebase');
                    ?>
</a></p>
				<?php 
                }
                break;
            case 'convert-tags':
                ?>
<h2><?php 
                _e('Tag Conversion');
                ?>
</h2><?php 
                if (empty($_REQUEST['doit'])) {
                    echo '<div class="updated"><p>';
                    _e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">backup your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
                    echo '</p></div>';
                    echo '<p><a href="' . add_query_arg('doit', 1) . '" class="button">' . __('Continue') . '</a></p>';
                    break;
                }
                $result = wpfb_call('Setup', 'ConvertOldTags');
                ?>
		<p><?php 
                printf(__('%d Tags in %d Posts has been converted.'), $result['n_tags'], count($result['tags']));
                ?>
</p>
		<ul>
		<?php 
                if (!empty($result['tags'])) {
                    foreach ($result['tags'] as $post_title => $tags) {
                        echo "<li><strong>" . esc_html($post_title) . "</strong><ul>";
                        foreach ($tags as $old => $new) {
                            echo "<li>{$old} =&gt; {$new}</li>";
                        }
                        echo "</ul></li>";
                    }
                }
                ?>
		</ul>
		<?php 
                if (!empty($result['errors'])) {
                    ?>
	
		<h2><?php 
                    _e('Errors');
                    ?>
</h2>
		<ul><?php 
                    foreach ($result['errors'] as $post_title => $err) {
                        echo "<li><strong>" . esc_html($post_title) . ": </strong> " . esc_html($err) . "<ul>";
                    }
                    ?>
</ul>		
		<?php 
                }
                $opts = WPFB_Core::GetOpt();
                unset($opts['tag_conv_req']);
                update_option(WPFB_OPT_NAME, $opts);
                WPFB_Core::$settings = (object) $opts;
                break;
                // convert-tags
            // convert-tags
            case 'del':
                if (!empty($_REQUEST['files']) && WPFB_Core::CurUserCanUpload()) {
                    $ids = explode(',', $_REQUEST['files']);
                    $nd = 0;
                    foreach ($ids as $id) {
                        $id = intval($id);
                        if (($file = WPFB_File::GetFile($id)) != null && $file->CurUserCanEdit()) {
                            $file->Remove(true);
                            $nd++;
                        }
                    }
                    WPFB_File::UpdateTags();
                    echo '<div id="message" class="updated fade"><p>' . sprintf(__('%d Files removed'), $nd) . '</p></div>';
                }
                if (!empty($_REQUEST['cats']) && WPFB_Core::CurUserCanCreateCat()) {
                    $ids = explode(',', $_REQUEST['cats']);
                    $nd = 0;
                    foreach ($ids as $id) {
                        $id = intval($id);
                        if (($cat = WPFB_Category::GetCat($id)) != null) {
                            $cat->Delete();
                            $nd++;
                        }
                    }
                    echo '<div id="message" class="updated fade"><p>' . sprintf(__('%d Categories removed'), $nd) . '</p></div>';
                }
            case 'sync':
                echo '<h2>' . __('Synchronisation') . '</h2>';
                wpfb_loadclass('Sync');
                $result = WPFB_Sync::Sync(!empty($_GET['hash_sync']), true);
                if (!is_null($result)) {
                    WPFB_Sync::PrintResult($result);
                }
                if (empty($_GET['hash_sync'])) {
                    echo '<p><a href="' . add_query_arg('hash_sync', 1) . '" class="button">' . __('Complete file sync', WPFB) . '</a> ' . __('Checks files for changes, so more reliable but might take much longer. Do this if you uploaded/changed files with FTP.', WPFB) . '</p>';
                }
                break;
                // sync
            // sync
            case 'batch-upload':
                wpfb_loadclass('BatchUploader');
                $batch_uploader = new WPFB_BatchUploader();
                $batch_uploader->Display();
                break;
            case 'reset-hits':
                global $wpdb;
                $n = 0;
                if (current_user_can('manage_options')) {
                    $n = $wpdb->query("UPDATE `{$wpdb->wpfilebase_files}` SET file_hits = 0 WHERE 1=1");
                }
                echo "<p>";
                printf(__('Done. %d Files affected.'), $n);
                echo "</p>";
                break;
            case 'install-extensions':
                wpfb_call('AdmInstallExt', 'Display');
                break;
        }
        // switch
        ?>
</div> <!-- wrap -->
<?php 
    }
Esempio n. 12
0
 private static function actionNewCat($args)
 {
     wpfb_loadclass('Category');
     $parent_cat = empty($args['cat_parent']) ? null : WPFB_Category::GetCat($args['cat_parent']);
     if (!WPFB_Core::CurUserCanCreateCat() && !$parent_cat && !$parent_cat->CurUserCanAddFiles()) {
         die('-1');
     }
     wpfb_loadclass('Admin');
     $result = WPFB_Admin::InsertCategory($args);
     if (isset($result['error']) && $result['error']) {
         wp_send_json(array('error' => $result['error']));
         exit;
     }
     $cat = $result['cat'];
     $fb_args = WPFB_Output::fileBrowserArgs(empty($args['args']) ? array() : $args['args']);
     $filesel = $fb_args['type'] === 'fileselect';
     $catsel = $fb_args['type'] === 'catselect';
     $tpl = empty($args['tpl']) ? empty($args['is_admin']) ? 'filebrowser' : 'filebrowser_admin' : $args['tpl'];
     wp_send_json(array('error' => 0, 'id' => $cat->GetId(), 'name' => $cat->GetTitle(), 'id_str' => $fb_args['idp'] . 'cat-' . $cat->cat_id, 'url' => $cat->GetUrl(), 'text' => WPFB_Output::fileBrowserCatItemText($catsel, $filesel, $cat, $fb_args['onselect'], $tpl), 'classes' => $filesel || $catsel ? 'folder' : null));
 }
Esempio n. 13
0
    ?>
<div class="wpfilebase-date-edit"><?php 
    touch_time($update, 0);
    ?>
</div></td>
	</tr>
	<tr class="form-field">
		<?php 
}
?>
		<th scope="row" valign="top"><label for="file_category"><?php 
_e('Category');
?>
</label></th>
		<td><select name="file_category" id="file_category" class="postform" onchange="WPFB_formCategoryChanged();"><?php 
echo WPFB_Output::CatSelTree(array('selected' => $file_category));
?>
</select></td>
		<?php 
if ($exform && !empty(WPFB_Core::$settings->licenses)) {
    ?>
		<th scope="row" valign="top"><label for="file_license"><?php 
    _e('License', WPFB);
    ?>
</label></th>
		<td><select name="file_license" id="file_license" class="postform"><?php 
    echo WPFB_Admin::MakeFormOptsList('licenses', $file ? $file->file_license : null, true);
    ?>
</select></td>
		<?php 
}
Esempio n. 14
0
 function InitMemBar()
 {
     if (!$this->mem_bar && !$this->quiet) {
         if (!class_exists('progressbar')) {
             include_once WPFB_PLUGIN_ROOT . 'extras/progressbar.class.php';
         }
         $ms = self::GetMemStats();
         $this->mem_bar = new progressbar($ms['usage'], $ms['limit'], 200, 20, '#d90', 'white', 'wpfb-progress-bar-mem');
         echo "<div><br /></div>";
         echo "<div>Memory Usage (limit = " . WPFB_Output::FormatFilesize($ms['limit']) . "):</div>";
         $this->mem_bar->print_code();
         echo "<div><br /></div>";
     }
     return $this->mem_bar;
 }
Esempio n. 15
0
 function widget($args, $instance)
 {
     wpfb_loadclass('File', 'Category', 'Output');
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget, $before_title . (empty($title) ? __('Search Files', WPFB) : $title) . $after_title;
     $prefix = "wpfb-search-widget-" . $this->id_base;
     $fbp_id = WPFB_Core::$settings->file_browser_post_id;
     $action = WPFB_Core::GetPostUrl($fbp_id);
     $p_in_query = strpos($action, '?') !== false;
     // no permalinks?
     $action = $p_in_query ? remove_query_arg(array('p', 'post_id', 'page_id', 'wpfb_s')) : $action;
     echo WPFB_Output::GetSearchForm($action, $p_in_query ? array('p' => $fbp_id) : null, "");
     echo $after_widget;
 }
    public static function FileListWidget($obj, $instance)
    {
        $defaults = array('title' => 'Top Downloads', 'sort-by' => 'file_hits', 'sort-asc' => false, 'limit' => 10, 'tpl' => '<a href="%file_post_url%">%file_display_name%</a> (%file_hits%)');
        foreach ($defaults as $prop => $val) {
            if (!isset($instance[$prop])) {
                $instance[$prop] = $val;
            }
        }
        wpfb_loadclass('Admin', 'Models', 'Output');
        ?>
	<div>
		<p><label for="<?php 
        echo $obj->get_field_id('title');
        ?>
"><?php 
        _e('Title:');
        ?>
			<input type="text" id="<?php 
        echo $obj->get_field_id('title');
        ?>
" name="<?php 
        echo $obj->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" /></label>
		</p>
		
		<p><label for="<?php 
        echo $obj->get_field_id('cat');
        ?>
"><?php 
        _e('Category:', WPFB);
        ?>
			<select name="<?php 
        echo $obj->get_field_name('cat');
        ?>
" id="<?php 
        echo $obj->get_field_id('cat');
        ?>
">
			<?php 
        echo WPFB_Output::CatSelTree(array('selected' => empty($instance['cat']) ? 0 : $instance['cat'], 'none_label' => __('All')));
        ?>
			</select></label>
		</p>
		<!-- 
		<p><input type="checkbox" id="<?php 
        echo $obj->get_field_id('hierarchical');
        ?>
" name="<?php 
        echo $obj->get_field_name('hierarchical');
        ?>
" value="1" <?php 
        checked($instance['hierarchical']);
        ?>
 />
		<label for="<?php 
        echo $obj->get_field_id('hierarchical');
        ?>
"><?php 
        _e('Show hierarchy');
        ?>
</label>
		</p>
		 -->
		
		<p>
			<label for="<?php 
        echo $obj->get_field_id('sort-by');
        ?>
"><?php 
        _e('Sort by:');
        ?>
</label>
			<select id="<?php 
        echo $obj->get_field_id('sort-by');
        ?>
" name="<?php 
        echo $obj->get_field_name('sort-by');
        ?>
">
			<?php 
        $sort_vars = WPFB_Models::FileSortFields();
        foreach ($sort_vars as $tag => $name) {
            echo '<option value="' . esc_attr($tag) . '" title="' . esc_attr($name) . '"' . ($instance['sort-by'] == $tag ? ' selected="selected"' : '') . '>' . $tag . '</option>';
        }
        ?>
			</select><br />
			<label for="<?php 
        echo $obj->get_field_id('sort-asc0');
        ?>
"><input type="radio" name="<?php 
        echo $obj->get_field_name('sort-asc');
        ?>
" id="<?php 
        echo $obj->get_field_id('sort-asc0');
        ?>
" value="0"<?php 
        checked($instance['sort-asc'], false);
        ?>
/><?php 
        _e('Descending');
        ?>
</label>
			<label for="<?php 
        echo $obj->get_field_id('sort-asc1');
        ?>
"><input type="radio" name="<?php 
        echo $obj->get_field_name('sort-asc');
        ?>
" id="<?php 
        echo $obj->get_field_id('sort-asc1');
        ?>
" value="1"<?php 
        checked($instance['sort-asc'], true);
        ?>
/><?php 
        _e('Ascending');
        ?>
</label>
		</p>
		
		<p><label for="<?php 
        echo $obj->get_field_id('limit');
        ?>
"><?php 
        _e('Limit:', WPFB);
        ?>
			<input type="text" id="<?php 
        echo $obj->get_field_id('limit');
        ?>
" name="<?php 
        echo $obj->get_field_name('limit');
        ?>
" value="<?php 
        echo intval($instance['limit']);
        ?>
" size="4" maxlength="3" /></label>
		</p>
		
		<p><label for="<?php 
        echo $obj->get_field_id('tpl');
        ?>
"><?php 
        _e('Template:', WPFB);
        ?>
			<input class="widefat" type="text" id="<?php 
        echo $obj->get_field_id('id');
        ?>
" name="<?php 
        echo $obj->get_field_name('tpl');
        ?>
" value="<?php 
        echo esc_attr($instance['tpl']);
        ?>
" /></label>
			<br /><?php 
        echo WPFB_Models::TplFieldsSelect($obj->get_field_id('id'), true);
        ?>
		</p>
	</div>
	<?php 
    }
Esempio n. 17
0
 static function GetSortSql($sort = null, $attach_order = false, $for_cat = false)
 {
     wpfb_loadclass('Output');
     $sql = $attach_order ? "`" . ($for_cat ? 'cat_order' : 'file_attach_order') . "` ASC, " : "";
     foreach (explode(',', $sort) as $s) {
         list($sf, $sd) = WPFB_Output::ParseSorting($s, $for_cat);
         $sql .= "`" . esc_sql($sf) . "` {$sd}, ";
     }
     return substr($sql, 0, -2);
 }
Esempio n. 18
0
    static function Display()
    {
        list($file_ids, $cat_ids, $sql_where) = self::getFileAndCatIds();
        $num_files = WPFB_File::GetNumFiles2($sql_where, 'edit');
        $prefix = "bulk";
        ?>
<div class="form-wrap">
	<h3><?php 
        printf(__('Batch edit %d files', 'wp-filebase'), $num_files);
        ?>
</h3>
<form action="<?php 
        echo remove_query_arg(array('action'));
        ?>
" method="post">
	<input type="hidden" name="action" value="edit" />	
	<input type="hidden" name="action2" value="apply" />	
	<input type="hidden" name="files" value="<?php 
        echo esc_attr(json_encode($file_ids));
        ?>
" />
	<input type="hidden" name="cats" value="<?php 
        echo esc_attr(json_encode($cat_ids));
        ?>
" />
		
	<div>
		<label for="<?php 
        echo $prefix;
        ?>
file_category"><?php 
        _e('Category', 'wp-filebase');
        ?>
</label>
		<select name="file_category" id="<?php 
        echo $prefix;
        ?>
file_category" class="wpfb-cat-select"><?php 
        wpfb_loadclass('Category');
        echo WPFB_Output::CatSelTree(array('none_label' => __('&mdash; No Change &mdash;'), 'check_add_perm' => true, 'add_cats' => true));
        ?>
</select>
	</div>
	<div class="form-field">		
		<label for="<?php 
        echo $prefix;
        ?>
file_tags"><?php 
        _e('Add Tags');
        ?>
</label>
		<input id="<?php 
        echo $prefix;
        ?>
file_tags" name="file_tags" type="text" />
	</div>

	<div class="form-field">		
		<label for="<?php 
        echo $prefix;
        ?>
file_author"><?php 
        _e('Author');
        ?>
</label>
		<input id="<?php 
        echo $prefix;
        ?>
file_author" name="file_author" type="text" placeholder="<?php 
        _e('&mdash; No Change &mdash;');
        ?>
" />
	</div>

<!--
	<div class="form-field">		
		<label for="<?php 
        echo $prefix;
        ?>
file_author"><?php 
        _e('Author');
        ?>
</label>
		<input id="<?php 
        echo $prefix;
        ?>
file_author" name="file_author" type="text" placeholder="<?php 
        _e('&mdash; No Change &mdash;');
        ?>
" />
	</div>


	<div class="form-field">		
		<label for="<?php 
        echo $prefix;
        ?>
file_description"><?php 
        _e('Description');
        ?>
</label>
		<textarea id="<?php 
        echo $prefix;
        ?>
file_description" name="file_description"></textarea>
	</div>
-->
	<div class="" style="float: left;">	
		<fieldset><legend class=""><?php 
        _e('Direct Linking', 'wp-filebase');
        ?>
</legend>
		<label title="<?php 
        _e('&mdash; No Change &mdash;');
        ?>
"><input type="radio" name="file_direct_linking" value="" <?php 
        checked(1);
        ?>
/> <?php 
        _e('&mdash; No Change &mdash;');
        ?>
</label>
		<label title="<?php 
        _e('Yes');
        ?>
"><input type="radio" name="file_direct_linking" value="1" /> <?php 
        _e('Allow direct linking', 'wp-filebase');
        ?>
</label>
		<label title="<?php 
        _e('No');
        ?>
"><input type="radio" name="file_direct_linking" value="0" /> <?php 
        _e('Redirect to post', 'wp-filebase');
        ?>
</label>

		</fieldset>
	</div>

	<div class="">	
		<fieldset><legend class=""><?php 
        _e('Offline', 'wp-filebase');
        ?>
</legend>
		<label title="<?php 
        _e('&mdash; No Change &mdash;');
        ?>
"><input type="radio" name="file_offline" value="" <?php 
        checked(1);
        ?>
/> <?php 
        _e('&mdash; No Change &mdash;');
        ?>
</label>
		<label title="<?php 
        _e('Yes');
        ?>
"><input type="radio" name="file_offline" value="1" /> <?php 
        _e('Set offline', 'wp-filebase');
        ?>
</label>
		<label title="<?php 
        _e('No');
        ?>
"><input type="radio" name="file_offline" value="0" /> <?php 
        _e('Set online', 'wp-filebase');
        ?>
</label>
		</fieldset>
	</div>

<div style="clear:both;"></div>

<!--

-->



<p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php 
        _e("Submit");
        ?>
" /></p>
</form>
</div>
<!--
post,
access permission,
version,
custom vars,
lang,
platforms,
requirements,
date
secondary cats,
download counter, 
-->
<?php 
    }
echo esc_attr($file_category->cat_folder);
?>
" size="40" /><br />
            <?php 
_e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.');
?>
</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="cat_parent"><?php 
_e('Parent Category');
?>
</label></th>
			<td>
	  			<select name="cat_parent" id="cat_parent" class="postform wpfb-cat-select" onchange="WPFB_formCategoryChanged();"><?php 
echo WPFB_Output::CatSelTree(array('selected' => $update ? $file_category->cat_parent : 0, 'exclude' => $update ? $file_category->cat_id : 0, 'add_cats' => true));
?>
</select><br />
                <?php 
_e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.');
?>
	  		</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="cat_description"><?php 
_e('Description');
?>
</label></th>
			<td><textarea name="cat_description" id="cat_description" rows="5" cols="50" style="width: 97%;"><?php 
echo esc_html($file_category->cat_description);
?>
Esempio n. 20
0
    static function DisplayExtendedFormFields($prefix, $secret_key, $hidden_vars = array())
    {
        $category = $hidden_vars['cat'];
        $nonce_action = "{$prefix}=";
        if (!empty($secret_key)) {
            $nonce_action .= $secret_key;
        }
        $hidden_vars = array_filter($hidden_vars, create_function('$v', 'return !(is_object($v) || is_array($v));'));
        foreach ($hidden_vars as $n => $v) {
            echo '<input type="hidden" name="' . esc_attr($n) . '" value="' . esc_attr($v) . '" id="' . $prefix . esc_attr($n) . '" />';
            if (!in_array($n, array('adv_uploader', 'frontend_upload', 'prefix'))) {
                $nonce_action .= "&{$n}={$v}";
            }
        }
        wp_nonce_field($nonce_action, 'wpfb-file-nonce');
        ?>
		<input type="hidden" name="prefix" value="<?php 
        echo $prefix;
        ?>
" />
		
	<?php 
        if ($category == -1) {
            ?>
	<div>
	<label for="<?php 
            echo $prefix;
            ?>
file_category"><?php 
            _e('Category', WPFB);
            ?>
</label>
	<select name="file_category" id="<?php 
            echo $prefix;
            ?>
file_category"><?php 
            wpfb_loadclass('Category');
            echo WPFB_Output::CatSelTree(array('none_label' => __('Select'), 'check_add_perm' => true));
            ?>
</select>
	</div>
	<?php 
        } else {
            ?>
	<input type="hidden" name="file_category" value="<?php 
            echo $category;
            ?>
" id="<?php 
            echo $prefix;
            ?>
file_category" />
	<?php 
        }
        ?>
	<?php 
    }
    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&#8217; 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&#8217; 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)) {
                $messages[] = sprintf(__('Warning: The Filebrowser page <b>%s</b> has at least one subpage <b>%s</b>. This will cause unexpected behavior, since all requests to the subpages are redirected to the File Browser Page. Please choose a Page that does not have any subpages for File Browser.', WPFB), get_the_title($post['file_browser_post_id']), get_the_title($fb_sub_pages[0]->ID));
            }
            // save options
            foreach ($option_fields as $opt_tag => $opt_data) {
                $val = isset($post[$opt_tag]) ? $post[$opt_tag] : '';
                $options[$opt_tag] = $val;
            }
            // make sure a short tag exists, if not append one
            $select_opts = array('languages', 'platforms', 'licenses', 'requirements', 'custom_fields');
            foreach ($select_opts as $opt_tag) {
                if (empty($options[$opt_tag])) {
                    $options[$opt_tag] = '';
                    continue;
                }
                $lines = explode("\n", $options[$opt_tag]);
                $lines2 = array();
                for ($i = 0; $i < count($lines); $i++) {
                    $lines[$i] = str_replace('||', '|', trim($lines[$i], "|\r"));
                    if (empty($lines[$i]) || $lines[$i] == '|') {
                        continue;
                    }
                    $pos = strpos($lines[$i], '|');
                    if ($pos <= 0) {
                        $lines[$i] .= '|' . sanitize_key(substr($lines[$i], 0, min(8, strlen($lines[$i]))));
                    }
                    $lines2[] = $lines[$i];
                }
                $options[$opt_tag] = implode("\n", $lines2);
            }
            $old_options = get_option(WPFB_OPT_NAME);
            update_option(WPFB_OPT_NAME, $options);
            WPFB_Core::$settings = (object) $options;
            $messages = array_merge($messages, WPFB_Admin::SettingsUpdated($old_options, $options));
            if (count($errors) == 0) {
                $messages[] = __('Settings updated.', WPFB);
            }
            //refresh any description which can contain opt values
            $option_fields = WPFB_Admin::SettingsSchema();
        }
        if (WPFB_Core::$settings->allow_srv_script_upload) {
            $messages[] = __('WARNING: Script upload enabled!', WPFB);
        }
        $upload_path = WPFB_Core::$settings->upload_path;
        if (!empty($old_options) && path_is_absolute($upload_path) && !path_is_absolute($old_options['upload_path'])) {
            $rel_path = str_replace('\\', '/', $upload_path);
            $rel_path = substr($rel_path, strpos($rel_path, '/') + 1);
            $messages[] = __(sprintf('NOTICE: The upload path <code>%s</code> is rooted to the filesystem. You should remove the leading slash if you want to use a folder inside your Wordpress directory (i.e: <code>%s</code>)', $upload_path, $rel_path), WPFB);
        }
        $action_uri = admin_url('admin.php') . '?page=' . $_GET['page'] . '&amp;updated=true';
        if (!empty($messages)) {
            $message = '';
            foreach ($messages as $msg) {
                $message .= '<p>' . $msg . '</p>';
            }
            ?>
<div id="message" class="updated fade"><?php 
            echo $message;
            ?>
</div>
<?php 
        }
        if (!empty($errors)) {
            $error = '';
            foreach ($errors as $err) {
                $error .= '<p>' . $err . '</p>';
            }
            ?>
<div id="message" class="error fade"><?php 
            echo $error;
            ?>
</div>
<?php 
        }
        ?>
<script type="text/javascript">
/* Option tabs */
jQuery(document).ready( function() {
	try { jQuery('#wpfb-tabs').tabs(); }
	catch(ex) {}
	/*if(typeof(CKEDITOR) != 'undefined') {
		CKEDITOR.plugins.addExternal('wpfilebase', ajaxurl+'/../../wp-content/plugins/wp-filebase/extras/ckeditor/');
		alert( ajaxurl+'/../../wp-content/plugins/wp-filebase/extras/ckeditor/');
	}*/
});
</script>

<div class="wrap">
<div id="icon-options-general" class="icon32"><br /></div>
<h2><?php 
        echo WPFB_PLUGIN_NAME;
        echo ' ';
        _e("Settings");
        ?>
</h2>

<form method="post" action="<?php 
        echo $action_uri;
        ?>
" name="wpfilebase-options">
	<?php 
        wp_nonce_field('wpfb-update-settings', 'wpfb-nonce');
        ?>
	<p class="submit">
	<input type="submit" name="submit" value="<?php 
        _e('Save Changes');
        ?>
" class="button-primary" />
	</p>
	<?php 
        $misc_tags = array('disable_id3', 'search_id3', 'thumbnail_path', 'use_path_tags', 'no_name_formatting');
        if (function_exists('wp_admin_bar_render')) {
            $misc_tags[] = 'admin_bar';
        }
        $limits = array('bitrate_unregistered', 'bitrate_registered', 'traffic_day', 'traffic_month', 'traffic_exceeded_msg', 'file_offline_msg', 'daily_user_limits', 'daily_limit_subscriber', 'daily_limit_contributor', 'daily_limit_author', 'daily_limit_editor', 'daily_limit_exceeded_msg');
        $option_categories = array(__('Common', WPFB) => array('upload_path', 'search_integration'), __('Display', WPFB) => array('file_date_format', 'thumbnail_size', 'auto_attach_files', 'attach_loop', 'attach_pos', 'filelist_sorting', 'filelist_sorting_dir', 'filelist_num', 'decimal_size_format', 'search_result_tpl', 'disable_css'), __('File Browser', WPFB) => array('file_browser_post_id', 'file_browser_cat_sort_by', 'file_browser_cat_sort_dir', 'file_browser_file_sort_by', 'file_browser_file_sort_dir', 'file_browser_fbc', 'late_script_loading', 'folder_icon', 'small_icon_size', 'disable_footer_credits', 'footer_credits_style'), __('Download', WPFB) => array('hide_links', 'disable_permalinks', 'download_base', 'force_download', 'range_download', 'http_nocache', 'ignore_admin_dls', 'accept_empty_referers', 'allowed_referers', 'use_fpassthru'), __('Form Presets', WPFB) => array('default_author', 'default_roles', 'default_cat', 'default_direct_linking', 'languages', 'platforms', 'licenses', 'requirements', 'custom_fields'), __('Limits', WPFB) => $limits, __('Security', WPFB) => array('allow_srv_script_upload', 'fext_blacklist', 'frontend_upload', 'hide_inaccessible', 'inaccessible_msg', 'inaccessible_redirect', 'cat_inaccessible_msg', 'login_redirect_src', 'protect_upload_path', 'private_files'), __('Templates and Scripts', WPFB) => array('template_file', 'template_cat', 'dlclick_js'), __('Sync', WPFB) => array('cron_sync', 'base_auto_thumb', 'remove_missing_files', 'fake_md5'), __('Misc') => $misc_tags);
        ?>
	<div id="wpfb-tabs">
		<ul class="wpfb-tab-menu">
			<?php 
        foreach ($option_categories as $key => $val) {
            echo '<li><a href="#' . sanitize_title($key) . '">' . esc_html($key) . '</a></li>';
        }
        ?>
		</ul>
	<?php 
        $page_option_list = '';
        $n = 0;
        foreach ($option_categories as $opt_cat => $opt_cat_fields) {
            //echo "\n".'<h3>'.$opt_cat.'</h3>';
            echo "\n\n" . '<div id="' . sanitize_title($opt_cat) . '" class="wpfilebase-opttab"><h3>' . $opt_cat . '</h3><table class="form-table">';
            foreach ($opt_cat_fields as $opt_tag) {
                $field_data = $option_fields[$opt_tag];
                $opt_val = $options[$opt_tag];
                echo "\n" . '<tr valign="top">' . "\n" . '<th scope="row">' . $field_data['title'] . '</th>' . "\n" . '<td>';
                $style_class = '';
                if (!empty($field_data['class'])) {
                    $style_class .= ' class="' . $field_data['class'] . '"';
                }
                if (!empty($field_data['style'])) {
                    $style_class .= ' style="' . $field_data['style'] . '"';
                }
                switch ($field_data['type']) {
                    case 'text':
                    case 'number':
                    case 'checkbox':
                        echo '<input name="' . $opt_tag . '" type="' . $field_data['type'] . '" id="' . $opt_tag . '"';
                        echo !empty($field_data['class']) ? ' class="' . $field_data['class'] . '"' : '';
                        if ($field_data['type'] == 'checkbox') {
                            echo ' value="1" ';
                            checked('1', $opt_val);
                        } elseif ($field_data['type'] == 'number') {
                            echo ' value="' . intval($opt_val) . '" size="5" style="text-align: right"';
                        } else {
                            echo ' value="' . esc_attr($opt_val) . '"';
                            if (isset($field_data['size'])) {
                                echo ' size="' . (int) $field_data['size'] . '"';
                            }
                        }
                        echo $style_class . ' />';
                        break;
                    case 'textarea':
                        $code_edit = strpos($opt_tag, 'template_') !== false || isset($field_data['class']) && strpos($field_data['class'], 'code') !== false;
                        $nowrap = !empty($field_data['nowrap']);
                        echo '<textarea name="' . $opt_tag . '" id="' . $opt_tag . '"';
                        if ($nowrap || $code_edit) {
                            echo ' cols="100" wrap="off" style="width: 100%;' . ($code_edit ? 'font-size: 9px;' : '') . '"';
                        } else {
                            echo ' cols="50"';
                        }
                        echo ' rows="' . ($code_edit ? 20 : 5) . '"';
                        echo $style_class;
                        echo '>';
                        echo esc_html($opt_val);
                        echo '</textarea>';
                        break;
                    case 'select':
                        echo '<select name="' . $opt_tag . '" id="' . $opt_tag . '">';
                        foreach ($field_data['options'] as $opt_v => $opt_n) {
                            echo '<option value="' . esc_attr($opt_v) . '"' . ($opt_v == $opt_val ? ' selected="selected" ' : '') . $style_class . '>' . (!is_numeric($opt_v) && $opt_v !== $opt_n ? esc_html($opt_v) . ': ' : '') . esc_html($opt_n) . '</option>';
                        }
                        echo '</select>';
                        break;
                    case 'roles':
                        WPFB_Admin::RolesCheckList($opt_tag, $opt_val, empty($field_data['not_everyone']));
                        break;
                    case 'icon':
                        wp_print_scripts('jquery-imagepicker');
                        wp_print_styles('jquery-imagepicker');
                        echo '<select class="image-picker show-html" name="' . $opt_tag . '" id="' . $opt_tag . '">';
                        ?>
						<?php 
                        foreach ($field_data['icons'] as $icon) {
                            echo '<option data-img-src="' . $icon['url'] . '" value="' . $icon['path'] . '" ' . ($icon['path'] === $opt_val ? ' selected="selected" ' : '') . '>' . basename($icon['path']) . '</option>';
                        }
                        ?>
					</select>
					<script type="text/javascript">
					jQuery(document).ready( function() { jQuery("#<?php 
                        echo $opt_tag;
                        ?>
").imagepicker(); });
					</script>
					<?php 
                        break;
                    case 'cat':
                        echo "<select name='{$opt_tag}' id='{$opt_tag}'>";
                        echo WPFB_Output::CatSelTree(array('selected' => $opt_val));
                        echo "</select>";
                        break;
                }
                if (!empty($field_data['unit'])) {
                    echo ' ' . $field_data['unit'];
                }
                if (!empty($field_data['desc'])) {
                    echo "\n" . '<br />' . str_replace('%value%', is_array($opt_val) ? join(', ', $opt_val) : $opt_val, $field_data['desc']);
                }
                echo "\n</td>\n</tr>";
                $page_option_list .= $opt_tag . ',';
            }
            echo '</table></div>' . "\n";
        }
        ?>
</div> <!--wpfilebase-opttabs-->
	<input type="hidden" name="action" value="update" />
	<input type="hidden" name="page_options" value="<?php 
        echo $page_option_list;
        ?>
" />
	<p class="submit">
	<input type="submit" name="submit" value="<?php 
        _e('Save Changes');
        ?>
" class="button-primary" />
	<input type="submit" name="reset" value="<?php 
        _e('Restore Default Settings', WPFB);
        ?>
" onclick="return confirm('<?php 
        _e('All settings (except default file and category template) will be set to default values. Continue?', WPFB);
        ?>
')" class="button delete" style="float: right;" />
	</p>
</form>
</div>	<!-- wrap -->	
<?php 
    }
Esempio n. 22
0
 static function TplTitle($tpl_tag)
 {
     return __(__(esc_html(WPFB_Output::Filename2Title($tpl_tag))), 'wp-filebase');
 }
Esempio n. 23
0
            }
        }
        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':
        wpfb_loadclass('File', 'Admin');
        $item = WPFB_Item::GetById($_POST['id'], $_POST['type']);
        if ($item && $item->CurUserCanEdit()) {
            $res = $item->ChangeCategoryOrName($_POST['new_cat_id']);
            wpfb_print_json($res);
        } else {
            die('-1');
        }
        exit;
}
Esempio n. 24
0
         $file = WPFB_File::GetFile((int) $_REQUEST['id']);
     }
     if ($file != null && $file->CurUserCanAccess(true)) {
         wpfb_print_json(array('id' => $file->GetId(), 'url' => $file->GetUrl(), 'path' => $file->GetLocalPathRel()));
     } else {
         echo '-1';
     }
     exit;
 case 'catinfo':
     wpfb_loadclass('Category', 'Output');
     if (empty($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
         die('-1');
     }
     $cat = WPFB_Category::GetCat((int) $_REQUEST['id']);
     if ($cat != null && $cat->CurUserCanAccess(true)) {
         wpfb_print_json(array('id' => $cat->GetId(), 'url' => $cat->GetUrl(), 'path' => $cat->GetLocalPathRel(), 'roles' => $cat->GetReadPermissions(), 'roles_str' => WPFB_Output::RoleNames($cat->GetReadPermissions(), true)));
     } else {
         echo '-1';
     }
     exit;
 case 'postbrowser':
     if (!current_user_can('edit_posts')) {
         wpfb_print_json(array(array('id' => '0', 'text' => __('Cheatin&#8217; uh?'), 'classes' => '', 'hasChildren' => false)));
         exit;
     }
     $id = empty($_REQUEST['root']) || $_REQUEST['root'] == 'source' ? 0 : intval($_REQUEST['root']);
     $onclick = empty($_REQUEST['onclick']) ? '' : $_REQUEST['onclick'];
     $args = array('hide_empty' => 0, 'hierarchical' => 1, 'orderby' => 'name', 'parent' => $id);
     $terms = get_terms('category', $args);
     $items = array();
     foreach ($terms as &$t) {
Esempio n. 25
0
 function column_perms($file)
 {
     return WPFB_Output::RoleNames($file->GetReadPermissions(), true) . ($file->file_offline ? ' <span class="offline">' . __('offline') . '</span>' : '');
 }
Esempio n. 26
0
 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;
 }
Esempio n. 27
0
	
	<p><a class="button-primary" style="position: fixed; right: 8px; bottom: 8px;" href="javascript:void(0)" onclick="return insListTag()"><?php 
    echo _e('Insert');
    ?>
</a><br />
	 </p>
</form>


<form id="browser" class="insert">
	<p><?php 
    _e('Select the root category of the tree view file browser:', 'wp-filebase');
    ?>
<br />	
	<select name="browser-root" id="browser-root"><?php 
    echo WPFB_Output::CatSelTree(array('none_label' => __('All')));
    ?>
</select>
	</p>
	
	
	<p><a class="button-primary" style="position: fixed; right: 8px; bottom: 8px;" href="javascript:void(0)" onclick="return insBrowserTag()"><?php 
    echo _e('Insert');
    ?>
</a></p>
</form>

<form id="filesort" class="insert">
	<h2><?php 
    _e('Sort Order:');
    ?>
Esempio n. 28
0
    static function Schema()
    {
        wpfb_loadclass('Models');
        $multiple_entries_desc = __('One entry per line. Seperate the title and a short tag (not longer than 8 characters) with \'|\'.<br />All lines beginning with \'*\' are selected by default.', 'wp-filebase');
        $multiple_line_desc = __('One entry per line.', 'wp-filebase');
        $bitrate_desc = __('Limits the maximum tranfer rate for downloads. 0 = unlimited', 'wp-filebase');
        $traffic_desc = __('Limits the maximum data traffic. 0 = unlimited', 'wp-filebase');
        $dls_per_day = __('downloads per day', 'wp-filebase');
        $daily_limit_for = __('Daily limit for %s', 'wp-filebase');
        $upload_path_base = str_replace(ABSPATH, '', get_option('upload_path'));
        if ($upload_path_base == '' || $upload_path_base == '/') {
            $upload_path_base = 'wp-content/uploads';
        }
        $sync_stats = get_option('wpfilebase_cron_sync_stats');
        wpfb_loadclass('Output');
        $last_sync_time = !empty($sync_stats) ? "<br> (" . sprintf(__('Last cron sync %s ago took %s and used %s of RAM.', 'wp-filebase'), human_time_diff($sync_stats['t_start']), human_time_diff($sync_stats['t_start'], $sync_stats['t_end']), WPFB_Output::FormatFilesize($sync_stats['mem_peak'])) . " " . (($next = wp_next_scheduled(WPFB . '_cron')) ? sprintf(__('Next cron sync scheduled in %s.', 'wp-filebase'), human_time_diff(time(), $next)) : "") . ")" : '';
        $list_tpls = array_keys(wpfb_call('ListTpl', 'GetAll'));
        $list_tpls = empty($list_tpls) ? array() : array_combine($list_tpls, $list_tpls);
        require_once ABSPATH . 'wp-admin/includes/file.php';
        $folder_icon_files = array_map(array(__CLASS__, 'cleanPath'), array_merge(list_files(WPFB_PLUGIN_ROOT . 'images/folder-icons'), list_files(WP_CONTENT_DIR . '/images/foldericons')));
        sort($folder_icon_files);
        $folder_icons = array();
        foreach ($folder_icon_files as $fif) {
            $folder_icons[] = array('path' => str_replace(self::cleanPath(WP_CONTENT_DIR), '', $fif), 'url' => str_replace(self::cleanPath(WP_CONTENT_DIR), WP_CONTENT_URL, $fif));
        }
        return array('upload_path' => array('default' => $upload_path_base . '/filebase', 'title' => __('Upload Path', 'wp-filebase'), 'desc' => __('Path where all files are stored. Relative to WordPress\' root directory.', 'wp-filebase'), 'type' => 'text', 'class' => 'code', 'size' => 65), 'thumbnail_size' => array('default' => 300, 'title' => __('Thumbnail size'), 'desc' => __('The maximum side of the image is scaled to this value.', 'wp-filebase'), 'type' => 'number', 'class' => 'num', 'size' => 8), 'thumbnail_path' => array('default' => '', 'title' => __('Thumbnail Path', 'wp-filebase'), 'desc' => __('Thumbnails can be stored at a different path than the actual files. Leave empty to use the default upload path. The directory specified here CANNOT be inside the upload path!', 'wp-filebase'), 'type' => 'text', 'class' => 'code', 'size' => 65), 'base_auto_thumb' => array('default' => true, 'title' => __('Auto-detect thumbnails', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Images are considered as thumbnails for files with the same name when syncing. (e.g `file.jpg` &lt;=&gt; `file.zip`)', 'wp-filebase')), 'fext_blacklist' => array('default' => 'db,tmp', 'title' => __('Extension Blacklist', 'wp-filebase'), 'desc' => __('Files with an extension in this list are skipped while synchronisation. (seperate with comma)', 'wp-filebase'), 'type' => 'text', 'class' => 'code', 'size' => 100), 'attach_pos' => array('default' => 1, 'title' => __('Attachment Position', 'wp-filebase'), 'desc' => __('', 'wp-filebase'), 'type' => 'select', 'options' => array(__('Before the Content', 'wp-filebase'), __('After the Content', 'wp-filebase'))), 'attach_loop' => array('default' => false, 'title' => __('Attachments in post lists', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Attach files to posts in archives, index and search result.', 'wp-filebase')), 'auto_attach_files' => array('default' => true, 'title' => __('Show attached files', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If enabled, all associated files are listed below an article', 'wp-filebase')), 'filelist_sorting' => array('default' => 'file_display_name', 'title' => __('Default sorting', 'wp-filebase'), 'type' => 'select', 'desc' => __('The file property lists are sorted by', 'wp-filebase'), 'options' => WPFB_Models::FileSortFields()), 'filelist_sorting_dir' => array('default' => 0, 'title' => __('Sort Order:'), 'type' => 'select', 'desc' => __('The sorting direction of file lists', 'wp-filebase'), 'options' => array(0 => __('Ascending'), 1 => __('Descending'))), 'filelist_num' => array('default' => 0, 'title' => __('Number of files per page', 'wp-filebase'), 'type' => 'number', 'desc' => __('Length of the file list per page. Set to 0 to disable the limit.', 'wp-filebase')), 'file_date_format' => array('default' => get_option('date_format'), 'title' => __('File Date Format', 'wp-filebase'), 'desc' => __('Date/Time formatting for files.', 'wp-filebase') . ' ' . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.'), 'type' => 'text', 'class' => 'small-text'), 'disable_css' => array('default' => false, 'title' => __('Disable wp-filebase.css', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If you don\'t need default WP-Filebase styling. Improves site performance.', 'wp-filebase')), 'bitrate_unregistered' => array('default' => 0, 'title' => __('Bit rate limit for guests', 'wp-filebase'), 'type' => 'number', 'unit' => 'KiB/Sec', 'desc' => &$bitrate_desc), 'bitrate_registered' => array('default' => 0, 'title' => __('Bit rate limit for registered users', 'wp-filebase'), 'type' => 'number', 'unit' => 'KiB/Sec', 'desc' => &$bitrate_desc), 'traffic_day' => array('default' => 0, 'title' => __('Daily traffic limit', 'wp-filebase'), 'type' => 'number', 'unit' => 'MiB', 'desc' => &$traffic_desc), 'traffic_month' => array('default' => 0, 'title' => __('Monthly traffic limit', 'wp-filebase'), 'type' => 'number', 'unit' => 'GiB', 'desc' => &$traffic_desc), 'traffic_exceeded_msg' => array('default' => __('Traffic limit exceeded! Please try again later.', 'wp-filebase'), 'title' => __('Traffic exceeded message', 'wp-filebase'), 'type' => 'text', 'size' => 65), 'file_offline_msg' => array('default' => __('This file is currently offline.', 'wp-filebase'), 'title' => __('File offline message', 'wp-filebase'), 'type' => 'text', 'size' => 65), 'daily_user_limits' => array('default' => false, 'title' => __('Daily user download limits', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If enabled, unregistered users cannot download any files. You can set different limits for each user role below.', 'wp-filebase')), 'daily_limit_subscriber' => array('default' => 5, 'title' => sprintf($daily_limit_for, _x('Subscriber', 'User role')), 'type' => 'number', 'unit' => &$dls_per_day), 'daily_limit_contributor' => array('default' => 10, 'title' => sprintf($daily_limit_for, _x('Contributor', 'User role')), 'type' => 'number', 'unit' => &$dls_per_day), 'daily_limit_author' => array('default' => 15, 'title' => sprintf($daily_limit_for, _x('Author', 'User role')), 'type' => 'number', 'unit' => &$dls_per_day), 'daily_limit_editor' => array('default' => 20, 'title' => sprintf($daily_limit_for, _x('Editor', 'User role')), 'type' => 'number', 'unit' => &$dls_per_day), 'daily_limit_exceeded_msg' => array('default' => __('You can only download %d files per day.', 'wp-filebase'), 'title' => __('Daily limit exceeded message', 'wp-filebase'), 'type' => 'text', 'size' => 65), 'disable_permalinks' => array('default' => false, 'title' => __('Disable download permalinks', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Enable this if you have problems with permalinks.', 'wp-filebase')), 'download_base' => array('default' => 'download', 'title' => __('Download URL base', 'wp-filebase'), 'type' => 'text', 'desc' => sprintf(__('The url prefix for file download links. Example: <code>%s</code> (Only used when Permalinks are enabled.)', 'wp-filebase'), get_option('home') . '/%value%/category/file.zip')), 'file_browser_post_id' => array('default' => '', 'title' => __('Post ID of the file browser', 'wp-filebase'), 'type' => 'number', 'unit' => '<span id="file_browser_post_title">' . (($fbid = @WPFB_Core::$settings->file_browser_post_id) ? '<a href="' . get_permalink($fbid) . '">' . get_the_title($fbid) . '</a>' : '') . '</span> <a href="javascript:;" class="button" onclick="WPFB_PostBrowser(\'file_browser_post_id\',\'file_browser_post_title\')">' . __('Select') . '</a>', 'desc' => __('Specify the ID of the post or page where the file browser should be placed. If you want to disable this feature leave the field blank.', 'wp-filebase') . ' ' . __('Note that the selected page should <b>not have any sub-pages</b>!')), 'file_browser_cat_sort_by' => array('default' => 'cat_name', 'title' => __('File browser category sorting', 'wp-filebase'), 'type' => 'select', 'desc' => __('The category property categories in the file browser are sorted by', 'wp-filebase'), 'options' => WPFB_Models::CatSortFields()), 'file_browser_cat_sort_dir' => array('default' => 0, 'title' => __('Sort Order:'), 'type' => 'select', 'desc' => '', 'options' => array(0 => __('Ascending'), 1 => __('Descending'))), 'file_browser_file_sort_by' => array('default' => 'file_display_name', 'title' => __('File browser file sorting', 'wp-filebase'), 'type' => 'select', 'desc' => __('The file property files in the file browser are sorted by', 'wp-filebase'), 'options' => WPFB_Models::FileSortFields()), 'file_browser_file_sort_dir' => array('default' => 0, 'title' => __('Sort Order:'), 'type' => 'select', 'desc' => '', 'options' => array(0 => __('Ascending'), 1 => __('Descending'))), 'file_browser_fbc' => array('default' => false, 'title' => __('Files before Categories', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Files will appear above categories in the file browser.', 'wp-filebase')), 'file_browser_inline_add' => array('default' => true, 'title' => __('Inline Add', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('In each category display actions to add a file or category.', 'wp-filebase')), 'folder_icon' => array('default' => '/plugins/wp-filebase/images/folder-icons/folder_orange48.png', 'title' => __('Folder Icon', 'wp-filebase'), 'type' => 'icon', 'icons' => $folder_icons, 'desc' => sprintf(__('Choose the default category icon and file browser icon. You can put custom icons in <code>%s</code>.', 'wp-filebase'), 'wp-content/images/foldericons')), 'small_icon_size' => array('default' => 32, 'title' => __('Small Icon Size'), 'desc' => __('Icon size (height) for categories and files. Set to 0 to show icons in full size.', 'wp-filebase'), 'type' => 'number', 'class' => 'num', 'size' => 8), 'cat_drop_down' => array('default' => false, 'title' => __('Category drop down list', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Use category drop down list in the file browser instead of listing like files.', 'wp-filebase')), 'force_download' => array('default' => false, 'title' => __('Always force download', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If enabled files that can be viewed in the browser (like images, PDF documents or videos) can only be downloaded (no streaming).', 'wp-filebase')), 'range_download' => array('default' => true, 'title' => __('Send HTTP-Range header', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Allows users to pause downloads and continue later. In addition download managers can use multiple connections at the same time.', 'wp-filebase')), 'hide_links' => array('default' => false, 'title' => __('Hide download links', 'wp-filebase'), 'type' => 'checkbox', 'desc' => sprintf(__('File download links wont be displayed in the browser\'s status bar. You should enable \'%s\' to make it even harder to find out the URL.', 'wp-filebase'), __('Always force download', 'wp-filebase'))), 'ignore_admin_dls' => array('default' => true, 'title' => __('Ignore downloads by admins', 'wp-filebase'), 'type' => 'checkbox', 'desc' => sprintf(__('Download by an admin user does not increase hit counter. <a href="%s" class="button" onclick="alert(\'Sure?\');" style="vertical-align: baseline;">Reset All Hit Counters to 0</a>'), esc_attr(admin_url('admin.php?page=wpfilebase_manage&action=reset-hits')))), 'hide_inaccessible' => array('default' => false, 'title' => __('Hide inaccessible files and categories', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If enabled files tagged <i>For members only</i> will not be listed for guests or users whith insufficient rights.', 'wp-filebase')), 'inaccessible_msg' => array('default' => __('You are not allowed to access this file!', 'wp-filebase'), 'title' => __('Inaccessible file message', 'wp-filebase'), 'type' => 'text', 'size' => 65, 'desc' => __('This message will be displayed if users try to download a file they cannot access', 'wp-filebase') . '. ' . __('You can enter a URL to redirect users.', 'wp-filebase')), 'inaccessible_redirect' => array('default' => false, 'title' => __('Redirect to login', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Guests trying to download inaccessible files are redirected to the login page if this option is enabled.', 'wp-filebase')), 'cat_inaccessible_msg' => array('default' => __('Access to category denied!', 'wp-filebase'), 'title' => __('Inaccessible category message', 'wp-filebase'), 'type' => 'text', 'size' => 65, 'desc' => __('This message will be displayed if users try to access a category without permission.', 'wp-filebase')), 'login_redirect_src' => array('default' => false, 'title' => __('Redirect to referring page after login', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Users are redirected to the page where they clicked on the download link after logging in.', 'wp-filebase')), 'http_nocache' => array('default' => false, 'title' => __('Disable HTTP Caching', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Enable this if you have problems with downloads while using Wordpress with a cache plugin.', 'wp-filebase')), 'parse_tags_rss' => array('default' => true, 'title' => __('Parse template tags in RSS feeds', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If enabled WP-Filebase content tags are parsed in RSS feeds.', 'wp-filebase')), 'allow_srv_script_upload' => array('default' => false, 'title' => __('Allow script upload', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If you enable this, scripts like PHP or CGI can be uploaded. <b>WARNING:</b> Enabling script uploads is a <b>security risk</b>!', 'wp-filebase')), 'protect_upload_path' => array('default' => true, 'title' => __('Protect upload path', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('This prevents direct access to files in the upload directory.', 'wp-filebase') . ' ' . __('Only applies on Apache webservers! For NGINX you have to edit its config file manually.', 'wp-filebase')), 'private_files' => array('default' => false, 'title' => __('Private Files', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Access to files is only permitted to owner and administrators.', 'wp-filebase') . ' ' . __('This completely overrides access permissions.', 'wp-filebase')), 'frontend_upload' => array('default' => false, 'title' => __('Enable front end uploads', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Global option to allow file uploads from widgets and embedded file forms', 'wp-filebase')), 'accept_empty_referers' => array('default' => false, 'title' => __('Accept empty referers', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('If enabled, direct-link-protected files can be downloaded when the referer is empty (i.e. user entered file url in address bar or browser does not send referers)', 'wp-filebase')), 'allowed_referers' => array('default' => '', 'title' => __('Allowed referers', 'wp-filebase'), 'type' => 'textarea', 'desc' => __('Sites with matching URLs can link to files directly.', 'wp-filebase') . '<br />' . $multiple_line_desc), 'use_fpassthru' => array('default' => false, 'title' => __('Use fpassthru', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Downloads will be serverd using the native PHP function fpassthru. Enable this when you are experiencing trouble with large files. Note that bandwidth throttle is not available for this method.', 'wp-filebase')), 'decimal_size_format' => array('default' => false, 'title' => __('Decimal file size prefixes', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Enable this if you want decimal prefixes (1 MB = 1000 KB = 1 000 000 B) instead of binary (1 MiB = 1024 KiB = 1 048 576 B)', 'wp-filebase')), 'admin_bar' => array('default' => true, 'title' => __('Add WP-Filebase to admin menu bar', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Display some quick actions for file management in the admin menu bar.', 'wp-filebase')), 'cron_sync' => array('default' => true, 'title' => __('Automatic Sync', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Schedules a cronjob to hourly synchronize the filesystem and the database.', 'wp-filebase') . $last_sync_time), 'remove_missing_files' => array('default' => false, 'title' => __('Remove Missing Files', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Missing files are removed from the database during sync', 'wp-filebase')), 'search_integration' => array('default' => true, 'title' => __('Search Integration', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Searches in attached files and lists the associated posts and pages when searching the site.', 'wp-filebase')), 'search_result_tpl' => array('default' => 'default', 'title' => __('Search Result File List Template', 'wp-filebase'), 'type' => 'select', 'options' => $list_tpls, 'desc' => __('Set the List Template used for Search Results when using the Search Widget', 'wp-filebase')), 'disable_id3' => array('default' => false, 'title' => __('Disable ID3 tag detection', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('This disables all meta file info reading. Use this option if you have issues adding large files.', 'wp-filebase')), 'search_id3' => array('default' => true, 'title' => __('Search ID3 Tags', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Search in file meta data, like ID3 for MP3 files, EXIF for JPEG... (this option does not increase significantly server load since all data is cached in a MySQL table)', 'wp-filebase')), 'use_path_tags' => array('default' => false, 'title' => __('Use path instead of ID in Shortcode', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Files and Categories are identified by paths and not by their IDs in the generated Shortcodes', 'wp-filebase')), 'no_name_formatting' => array('default' => false, 'title' => __('Disable Name Formatting', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('This will disable automatic formatting/uppercasing file names when they are used as title (e.g. when syncing)', 'wp-filebase')), 'fake_md5' => array('default' => false, 'title' => __('Fake MD5 Hashes', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('This dramatically speeds up sync, since no real MD5 checksum of the files is calculated but only a hash of modification time and file size.', 'wp-filebase')), 'disable_footer_credits' => array('default' => true, 'title' => __('Remove WP-Filebase Footer credits', 'wp-filebase'), 'type' => 'checkbox', 'desc' => sprintf(__('This disables the footer credits only displayed on <a href="%s">File Browser Page</a>. Why should you keep the credits? Every backlink helps WP-Filebase to get more popular, popularity motivates the developer to continue work on the plugin.', 'wp-filebase'), get_permalink(@WPFB_Core::$settings->file_browser_post_id) . '#wpfb-credits')), 'footer_credits_style' => array('default' => 'margin:0 auto 2px auto; text-align:center; font-size:11px;', 'title' => __('Footer credits Style', 'wp-filebase'), 'type' => 'text', 'class' => 'code', 'desc' => __('Set custom CSS style for WP-Filebase footer credits', 'wp-filebase'), 'size' => 80), 'late_script_loading' => array('default' => false, 'title' => __('Late script loading', 'wp-filebase'), 'type' => 'checkbox', 'desc' => __('Scripts will be included in content, not in header. Enable if your AJAX tree view does not work properly.', 'wp-filebase')), 'default_author' => array('default' => '', 'title' => __('Default Author', 'wp-filebase'), 'desc' => __('This author will be used as form default and when adding files with FTP', 'wp-filebase'), 'type' => 'text', 'size' => 65), 'default_roles' => array('default' => array(), 'title' => __('Default User Roles', 'wp-filebase'), 'desc' => __('These roles are selected by default and will be used for files added with FTP', 'wp-filebase'), 'type' => 'roles'), 'default_cat' => array('default' => 0, 'title' => __('Default Category', 'wp-filebase'), 'desc' => __('Preset Category in the file form', 'wp-filebase'), 'type' => 'cat'), 'languages' => array('default' => "English|en\nDeutsch|de", 'title' => __('Languages'), 'type' => 'textarea', 'desc' => &$multiple_entries_desc), 'platforms' => array('default' => "Windows 7|win7\n*Windows 8|win8\nLinux|linux\nMac OS X|mac", 'title' => __('Platforms', 'wp-filebase'), 'type' => 'textarea', 'desc' => &$multiple_entries_desc, 'nowrap' => true), 'licenses' => array('default' => "*Freeware|free\nShareware|share\nGNU General Public License|gpl|http://www.gnu.org/copyleft/gpl.html\nCC Attribution-NonCommercial-ShareAlike|ccbyncsa|http://creativecommons.org/licenses/by-nc-sa/3.0/", 'title' => __('Licenses', 'wp-filebase'), 'type' => 'textarea', 'desc' => &$multiple_entries_desc, 'nowrap' => true), 'requirements' => array('default' => "PDF Reader|pdfread|https://www.foxitsoftware.com/products/pdf-reader/\nJava|java|http://www.java.com/download/\nOpen Office|ooffice|http://www.openoffice.org/download/index.html\n", 'title' => __('Requirements', 'wp-filebase'), 'type' => 'textarea', 'desc' => $multiple_entries_desc . ' ' . __('You can optionally add |<i>URL</i> to each line to link to the required software/file.', 'wp-filebase'), 'nowrap' => true), 'default_direct_linking' => array('default' => 1, 'title' => __('Default File Direct Linking'), 'type' => 'select', 'desc' => __('', 'wp-filebase'), 'options' => array(1 => __('Allow direct linking', 'wp-filebase'), 0 => __('Redirect to post', 'wp-filebase'))), 'custom_fields' => array('default' => "Custom 1|cf1\nCustom 2|cf2", 'title' => __('Custom Fields'), 'type' => 'textarea', 'desc' => __('With custom fields you can add even more file properties.', 'wp-filebase') . ' ' . sprintf(__('Append another %s to set the default value.', 'wp-filebase'), '|<i>Default Value</i>' . ' ' . $multiple_entries_desc)), 'template_file' => array('default' => <<<TPLFILE
<div class="wpfilebase-file-default" onclick="if('undefined' == typeof event.target.href) document.getElementById('wpfb-file-link-%uid%').click();">
  <div class="icon"><a href="%file_url%" target="_blank" title="Download %file_display_name%"><img align="middle" src="%file_icon_url%" alt="%file_display_name%" /></a></div>
  <div class="filetitle">
    <a href="%file_url%" title="Download %file_display_name%" target="_blank" id="wpfb-file-link-%uid%">%file_display_name%</a>
    <!-- IF %file_post_id% AND %post_id% != %file_post_id% --><a href="%file_post_url%" class="postlink">&raquo; %'Post'%</a><!-- ENDIF -->
    <br />
    %file_name%<br />
    <!-- IF %file_version% -->%'Version:'% %file_version%<br /><!-- ENDIF -->
  </div>
  <div class="info">
    %file_size%<br />
    %file_hits% %'Downloads'%<br />
    <a href="#" onclick="return wpfilebase_filedetails(%uid%);">%'Details'%</a>
  </div>
  <div class="details" id="wpfilebase-filedetails%uid%" style="display: none;">
  <!-- IF %file_description% --><p>%file_description%</p><!-- ENDIF -->
  <table border="0">
   <!-- IF %file_languages% --><tr><td><strong>%'Languages'%:</strong></td><td>%file_languages%</td></tr><!-- ENDIF -->
   <!-- IF %file_author% --><tr><td><strong>%'Author'%:</strong></td><td>%file_author%</td></tr><!-- ENDIF -->
   <!-- IF %file_platforms% --><tr><td><strong>%'Platforms'%:</strong></td><td>%file_platforms%</td></tr><!-- ENDIF -->
   <!-- IF %file_requirements% --><tr><td><strong>%'Requirements'%:</strong></td><td>%file_requirements%</td></tr><!-- ENDIF -->
   <!-- IF %file_category% --><tr><td><strong>%'Category:'%</strong></td><td>%file_category%</td></tr><!-- ENDIF -->
   <!-- IF %file_license% --><tr><td><strong>%'License'%:</strong></td><td>%file_license%</td></tr><!-- ENDIF -->
   <tr><td><strong>%'Date'%:</strong></td><td>%file_date%</td></tr>
  </table>
  </div>
 <div style="clear: both;"></div>
</div>
TPLFILE
, 'title' => __('Default File Template', 'wp-filebase'), 'type' => 'textarea', 'desc' => WPFB_Models::TplFieldsSelect('template_file') . '<br />' . __('The template for attachments', 'wp-filebase'), 'class' => 'code'), 'template_cat' => array('default' => <<<TPLCAT
<div class="wpfilebase-cat-default">
  <h3>
    <!-- IF %cat_has_icon% || true -->%cat_small_icon%<!-- ENDIF -->
    <a href="%cat_url%" title="Go to category %cat_name%">%cat_name%</a>
    <span>%cat_num_files% <!-- IF %cat_num_files% == 1 -->file<!-- ELSE -->files<!-- ENDIF --></span>
  </h3>
</div>
TPLCAT
, 'title' => __('Category Template', 'wp-filebase'), 'type' => 'textarea', 'desc' => WPFB_Models::TplFieldsSelect('template_cat', false, true) . '<br />' . __('The template for category lists (used in the file browser)', 'wp-filebase'), 'class' => 'code'), 'dlclick_js' => array('default' => <<<JS
if(typeof pageTracker == 'object') {
\tpageTracker._trackPageview(file_url); // new google analytics tracker
} else if(typeof urchinTracker == 'function') {\t
\turchinTracker(file_url); // old google analytics tracker
} else if(typeof ga == 'function') {
\tga('send', 'pageview', file_url); // universal analytics
}
JS
, 'title' => __('Download JavaScript', 'wp-filebase'), 'type' => 'textarea', 'desc' => __('Here you can enter JavaScript Code which is executed when a user clicks on file download link. The following variables can be used: <i>file_id</i>: the ID of the file, <i>file_url</i>: the clicked download url', 'wp-filebase'), 'class' => 'code'));
    }