Exemple #1
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:');
    ?>
Exemple #2
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 
    }
    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 
    }
    function widget($args, $instance)
    {
        if (!current_user_can('upload_files')) {
            return;
        }
        wpfb_loadclass('File', 'Category', 'Output');
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        echo $before_title . (empty($title) ? __('Add File Category', WPFB) : $title) . $after_title;
        $prefix = "wpfb-add-cat-widget-" . $this->id_base;
        $form_url = add_query_arg('wpfb_add_cat', 1);
        $nonce_action = $prefix;
        ?>
		
		<form enctype="multipart/form-data" name="<?php 
        echo $prefix;
        ?>
form" method="post" action="<?php 
        echo $form_url;
        ?>
">
		<?php 
        wp_nonce_field($nonce_action, 'wpfb-cat-nonce');
        ?>
		<input type="hidden" name="prefix" value="<?php 
        echo $prefix;
        ?>
" />
			<p>
				<label for="<?php 
        echo $prefix;
        ?>
cat_name"><?php 
        _e('New category name');
        ?>
</label>
				<input name="cat_name" id="<?php 
        echo $prefix;
        ?>
cat_name" type="text" value="" />
			</p>
			<p>
				<label for="<?php 
        echo $prefix;
        ?>
cat_parent"><?php 
        _e('Parent Category');
        ?>
</label>
	  			<select name="cat_parent" id="<?php 
        echo $prefix;
        ?>
cat_parent"><?php 
        echo WPFB_Output::CatSelTree(array('check_add_perm' => true));
        ?>
</select>
	  		</p>
			<p style="text-align:right;"><input type="submit" class="button-primary" name="submit-btn" value="<?php 
        _e('Add New Category');
        ?>
" /></p>
		</form>
	<?php 
        echo $after_widget;
    }
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);
?>
Exemple #6
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 
}
Exemple #7
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()
    {
        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 
    }
    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 
    }
Exemple #10
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 
}