Esempio n. 1
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. 2
0
 function column_size($file)
 {
     return WPFB_Output::FormatFilesize($file->file_size);
 }
Esempio n. 3
0
    static function FileForm($prefix, $form_url, $vars, $secret_key = null)
    {
        unset($vars['adv_uploader']);
        // dont use adv_uploader arg for noncing! TODO
        ?>
	<div class="form-wrap">
		<form enctype="multipart/form-data" name="<?php 
        echo $prefix;
        ?>
form" id="<?php 
        echo $prefix;
        ?>
form" method="post" action="<?php 
        echo $form_url;
        ?>
">
			<div>
				<?php 
        self::DisplayExtendedFormFields($prefix, $secret_key, $vars);
        ?>
				
				<?php 
        if (empty($adv_uploader)) {
            ?>
					<label for="<?php 
            echo $prefix;
            ?>
file_upload"><?php 
            _e('Choose File', WPFB);
            ?>
</label>
					<input type="file" name="file_upload" id="<?php 
            echo $prefix;
            ?>
file_upload" /><br /> <!--   style="width: 160px" size="10" -->
				<?php 
        } else {
            $adv_uploader->Display($prefix);
        }
        ?>
				<small><?php 
        printf(str_replace('%d%s', '%s', __('Maximum upload file size: %d%s.')), WPFB_Output::FormatFilesize(WPFB_Core::GetMaxUlSize()));
        ?>
</small>
				
				<?php 
        if (empty($auto_submit)) {
            ?>
<div style="float: right; text-align:right;"><input type="submit" class="button-primary" name="submit-btn" value="<?php 
            _e('Add New', WPFB);
            ?>
" /></div>
				<?php 
        }
        ?>
			</div>
		</form>	
	</div>
	<?php 
    }
Esempio n. 4
0
    ?>
" />
			</div>
			<div id="wpfilebase-upload-tabs">
				<div id="file-upload-wrap" <?php 
    echo $file->IsRemote() ? 'class="hidden"' : '';
    ?>
>
					<div id="html-upload-ui">
						<label for="file_upload"><?php 
    _e('Choose File', WPFB);
    ?>
</label>
						<input type="file" name="file_upload" id="file_upload" /><br />
						<?php 
    printf(str_replace('%d%s', '%s', __('Maximum upload file size: %d%s')), WPFB_Output::FormatFilesize(WPFB_Core::GetMaxUlSize()));
    ?>
 <b>&nbsp;&nbsp;<a href="#" onclick="alert(this.title); return false;" title="<?php 
    printf(__('Ask your webhoster to increase this limit, it is set in %s.', WPFB), 'php.ini');
    ?>
">?</a></b>
						<p class="upload-html-bypass hide-if-no-js"><?php 
    _e('You are using the Browser uploader.');
    printf(__('Try the <a href="%s">Flash uploader</a> instead.'), esc_url(add_query_arg('flash', 1)));
    ?>
					</div>
					<div id="flash-upload-ui"><?php 
    $adv_uploader->Display();
    ?>
</div> <!--  flash-upload-ui -->
					<?php 
Esempio n. 5
0
		</div>
		<div id="wpfilebase-upload-tabs">
			<div id="file-upload-wrap" <?php 
echo $file->IsRemote() ? 'class="hidden"' : '';
?>
>
				<div id="file_thumbnail_preview"></div>

				<div id="html-upload-ui">
					<label for="file_upload"><?php 
_e('Choose File', 'wp-filebase');
?>
</label>
					<input type="file" name="file_upload" id="file_upload" /><br />
					<?php 
printf(__('Maximum upload file size: %s.'), WPFB_Output::FormatFilesize(WPFB_Core::GetMaxUlSize()));
?>
 <b>&nbsp;&nbsp;<a href="#" onclick="return alert(this.title) && false;" title="<?php 
printf(__('Ask your webhoster to increase this limit, it is set in %s.', 'wp-filebase'), 'php.ini');
?>
">?</a></b>
					<p class="upload-html-bypass hide-if-no-js"><?php 
_e('You are using the Browser uploader.');
printf(__('Try the <a href="%s">Drag&amp;Drop uploader</a> instead.', 'wp-filebase'), esc_url(add_query_arg('flash', 1)));
?>
				</div>
				<div id="flash-upload-ui"><?php 
$adv_uploader->Display();
?>
					<script> jQuery('#file-upload-progress').appendTo('#wpfilebase-upload-menu').addClass('admin-scheme-color-3');</script>
				</div> <!--  flash-upload-ui -->
Esempio n. 6
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 
    }
    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. 8
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. 9
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'));
    }