コード例 #1
0
ファイル: admin.php プロジェクト: howardlei82/IGSM-Website
/**
 * The configuration page
 *
 * TODO this is messy...
 */
function nktagcloud_options_page()
{
    nktagcloud_load_translation_file();
    #echo '<pre>'; var_dump( $_POST ); echo '</pre>'; echo '<hr>';
    if (current_user_can('manage_options')) {
        if ($_POST['config']) {
            #function_exists( 'check_admin_referer ') ? check_admin_referer( 'nktagcloud' ) : null;
            $nonce = $_POST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'nktagcloud-config')) {
                die('Security check');
            }
            $option = get_option('nktagcloud');
            $option['config'] = $_POST['config'];
            update_option('nktagcloud', $option);
            $config = $option['config'];
        } elseif ($_POST['reset']) {
            function_exists('check_admin_referer ') ? check_admin_referer('nktagcloud') : null;
            $nonce = $_POST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'nktagcloud-reset')) {
                die('Security check');
            }
            nktagcloud_reset();
        }
        $option = get_option('nktagcloud');
        $config = $option['config'];
        ?>

		<div id="nkuttler" class="wrap" >
			<h2><?php 
        _e('Better Tag Cloud', 'nktagcloud');
        ?>
</h2>
			<?php 
        require_once 'nkuttler.php';
        ?>
			<?php 
        nkuttler0_2_4_links('nktagcloud', 'http://www.nkuttler.de/wordpress-plugin/a-better-tag-cloud-widget/');
        ?>
			<p>
				<?php 
        _e('The default tag cloud widget that comes with wordpress is very simple. This plugin makes the options for wp_tag_cloud() available to this new tag cloud widget and a shortcode. It has new features as well.', 'nktagcloud');
        ?>
			</p>
			<p>
				<?php 
        _e('<strong>New</strong> It is now possible to insert a tag cloud into any post or page. Just put the <tt>[nktagcloud]</tt> shortcode into any post or page.', 'nktagcloud');
        ?>
			</p>

			<h2><?php 
        _e('Tag cloud Configuration', 'nktagcloud');
        ?>
</h2>
			<p>
				<?php 
        _e('Please see <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud" target="_blank">the wp_tag_cloud() page</a> for a detailed description of the options.', 'nktagcloud');
        ?>
			</p>
			<form action="" method="post">
				<?php 
        function_exists('wp_nonce_field') ? wp_nonce_field('nktagcloud-config') : null;
        ?>

				<h2><?php 
        _e('Deprecated settings, please use the new widget', 'nktagcloud');
        ?>
</h2>
				<h3><?php 
        _e('CSS settings', 'nktagcloud');
        ?>
</h3>
				<p>
					<?php 
        _e("By default this plugin includes CSS to make the list look like a normal cloud.  The CSS settings may or may not work on your template, depending on it's CSS.", 'nktagcloud');
        ?>
				</p>
				<?php 
        nktagcloud_select(__('Remove CSS for list format that displays the tags inline?', 'nktagcloud'), 'rmcss', array('No', 'Yes'), false);
        ?>
				<?php 
        nktagcloud_select(__('Tag link decoration', 'nktagcloud'), 'decor', array('underline', 'none', 'don\'t touch'), false);
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Use automatic colors for the tag cloud?', 'nktagcloud'), 'colorize', array('No', 'Yes'), false);
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Hide the widget header markup if the widget title is empty?', 'nktagcloud'), 'hideemptywidgetheader', array('No', 'Yes'), false);
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Remove link to plugin website?', 'nktagcloud'), 'homelink', array('No', 'Yes'), false);
        ?>
				<br />
				<?php 
        nktagcloud_submit(__('Save changes', 'nktagcloud'), 'button-primary', false);
        ?>


				<?php 
        nktagcloud_input(__('Title', 'nktagcloud'), 'title', 15, $config['title']);
        ?>
				<br />
				<?php 
        nktagcloud_input(__('Taxonomy', 'nktagcloud'), 'taxonomy', 15, $config['taxonomy']);
        ?>
				<br />
				<?php 
        nktagcloud_input(__('Smallest font size', 'nktagcloud'), 'smallest', 4, $config['smallest']);
        ?>
				<?php 
        nktagcloud_input(__('Largest font size', 'nktagcloud'), 'largest', 4, $config['largest']);
        ?>
				<?php 
        nktagcloud_select(__('Unit', 'nktagcloud'), 'unit', array('pt', 'px', '%', 'em', 'ex', 'mm'));
        ?>
				<br />
				<?php 
        nktagcloud_input(__('Numbers of tags to show', 'nktagcloud'), 'number', 4, $config['number']);
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Format', 'nktagcloud'), 'format', array('flat', 'list'));
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Order', 'nktagcloud'), 'order', array('ASC', 'DESC', 'RAND'));
        ?>
				<?php 
        nktagcloud_select(__('Orderby', 'nktagcloud'), 'orderby', array('name', 'count', 'both'));
        ?>
				<p>
					<?php 
        _e("The 'both' option of <tt>Orderby</tt> will sort by post count first and then by name. It doesn't exist in the default tag cloud and will ignore the <tt>Order</tt> option.", 'nktagcloud');
        ?>
				</p>

				<?php 
        nktagcloud_select(__('Add post count to tags?', 'nktagcloud'), 'inject_count', array('No', 'Yes'));
        ?>
				<?php 
        nktagcloud_select(__('Put the post count outside of the hyperlink?', 'nktagcloud'), 'inject_count_outside', array('No', 'Yes'));
        ?>
				<br />
				<?php 
        nktagcloud_input(__('Show only tags that have been used at least so many times:', 'nktagcloud'), 'mincount', 4, $config['mincount']);
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Add categories to tag cloud?', 'nktagcloud'), 'categories', array('No', 'Yes'));
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Force tags with multiple words on one line?', 'nktagcloud'), 'replace', array('No', 'Yes'));
        ?>
				<br />
				<?php 
        nktagcloud_input(__('Tag separator', 'nktagcloud'), 'separator', 4, $config['separator']);
        ?>
				<?php 
        nktagcloud_select(__('Hide the last separator?', 'nktagcloud'), 'hidelastseparator', array('No', 'Yes'));
        ?>
				<br />
				<?php 
        nktagcloud_select(__('Add the nofollow attribute?', 'nktagcloud'), 'nofollow', array('No', 'Yes'));
        ?>
				<br />
				<?php 
        nktagcloud_submit(__('Save changes', 'nktagcloud'));
        ?>

				<h3><?php 
        _e('Exclude/Include tags', 'nktagcloud');
        ?>
</h3>
				<p>
					<?php 
        _e('Comma separated list of tags (term_id) to exclude or include. For example, <tt>exclude=5,27</tt> means that tags that have the <tt>term_id</tt> 5 or 27 will NOT be displayed. See <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud">Template Tags/wp tag cloud</a>.', 'nktagcloud');
        ?>
				</p>
				<?php 
        nktagcloud_input(__('Exclude Tags', 'nktagcloud'), 'exclude', 40, $config['exclude']);
        ?>
				<br />
				<?php 
        nktagcloud_input(__('Include Tags', 'nktagcloud'), 'include', 40, $config['include']);
        ?>
				<br />
				<?php 
        nktagcloud_submit(__('Save changes', 'nktagcloud'));
        ?>
			</form>

			<h3><?php 
        _e('Reset the tag cloud', 'nktagcloud');
        ?>
</h3>
			<p>
				<?php 
        _e('Use this if you want to delete your configuration and restore the defaults.', 'nktagcloud');
        ?>
			</p>
			<form action="" method="post" >
				<?php 
        function_exists('wp_nonce_field') ? wp_nonce_field('nktagcloud-reset') : null;
        ?>
				<input type="hidden" name="reset" value="ihatephp" />
				<?php 
        nktagcloud_submit(__('Reset the tag cloud', 'nktagcloud'), 'button-secondary');
        ?>
			</form>
		</div> <?php 
    }
}
コード例 #2
0
ファイル: admin.php プロジェクト: JackBrit/Team-London-Bridge
    /**
     * Output the options page
     *
     * @return none
     * @since 0.0.2
     */
    function admin_page()
    {
        if ($this->get_option('reset') === '1') {
            $this->restore_defaults();
        }
        ?>
		<div id="nkuttler" class="wrap" >
			<h2><?php 
        _e('Custom Avatars For Comments', 'custom-avatars-for-comments');
        ?>
</h2> <?php 
        require_once 'nkuttler.php';
        nkuttler0_2_4_links('custom-avatars-for-comments', 'http://www.nkuttler.de/wordpress-plugin/custom-avatars-for-comments/');
        ?>

			<p> <?php 
        _e('With this plugin your visitors can select from a list of custom avatars when they leave a comment.', 'custom-avatars-for-comments');
        ?>
			</p>

			<?php 
        if (!is_dir(WP_CONTENT_DIR . '/commentavatars/')) {
            ?>
				<div class="error"> <?php 
            _e('No <code>wp-content/commentavatars/</code> directory exists. Please create it and upload some avatars.', 'custom-avatars-for-comments');
            ?>
				</div> <?php 
        } else {
            ?>
				<p> <?php 
            _e('You can upload additional avatars to <code>wp-content/commentavatars/</code> any time. Please don\'t delete existing ones, as that will lead to broken image links if they were already used.', 'custom-avatars-for-comments');
            ?>
				</p> <?php 
        }
        ?>

        	<form method="post" action="options.php"> <?php 
        settings_fields('commentavatars_options');
        ?>
				<input type="hidden" name="commentavatars[version]" value="<?php 
        echo $this->get_option('version');
        ?>
" />
				<table class="form-table form-table-clearnone" >

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Hide the select avatar field", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[removeselect]" type="checkbox" value="1" <?php 
        checked('1', $this->options['removeselect']);
        ?>
 /> <?php 
        _e("Use this option if you are placing the select field by hand in your theme.", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Label for the avatar select list", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input type="text" name="commentavatars[selectlabel]" value="<?php 
        echo $this->options['selectlabel'];
        ?>
" size="50" />
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Automatically select first custom avatar?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[selectfirst]" type="checkbox" value="1" <?php 
        checked('1', $this->options['selectfirst']);
        ?>
 /> <?php 
        _e("This will effectively disable gravatars.", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Automatically select a random avatar?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[selectrandom]" type="checkbox" value="1" <?php 
        checked('1', $this->options['selectrandom']);
        ?>
 /> <?php 
        _e("This will effectively disable gravatars and won't work with caching plugins. If you need that feature please do contact me for professional support.", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Select no avatar link text:", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[deselectlink]" type="text" value="<?php 
        echo $this->options['deselectlink'];
        ?>
" /> <?php 
        _e("Useful if you have automatic avatar selection enabled or if visitors change their mind.", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Use a default.png if no custom avatar is selected?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[usedefaultpng]" type="checkbox" value="1" <?php 
        checked('1', $this->options['usedefaultpng']);
        ?>
 /> <?php 
        _e("You'll need to have a default.png file in the avatars directory. This will disable gravatars.", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Hide default.png in the custom avatar select list?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[hidedefaultpng]" type="checkbox" value="1" <?php 
        checked('1', $this->options['hidedefaultpng']);
        ?>
 />
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Use the default CSS styles that come with this plugin?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[useplugincss]" type="checkbox" value="1" <?php 
        checked('1', $this->options['useplugincss']);
        ?>
 />
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Force custom avatars width and height:", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input type="text" name="commentavatars[size]" value="<?php 
        echo $this->options['size'];
        ?>
" /> <?php 
        _e("This field's value is added as width and height attributes to the avatar &lt;img&gt; tags, e.g. '44px'.", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Force Custom border color:", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input type="text" name="commentavatars[bordercolor]" value="<?php 
        echo $this->options['bordercolor'];
        ?>
" /> <?php 
        _e("(e.g. '#ff0000').", 'custom-avatars-for-comments');
        ?>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Show the link to the plugin page in the footer?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[showhomelink]" type="checkbox" value="1" <?php 
        checked('1', $this->options['showhomelink']);
        ?>
 />
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"> <?php 
        _e("Reset the form?", 'custom-avatars-for-comments');
        ?>
						</th>
						<td>
							<input name="commentavatars[reset]" type="checkbox" value="1" />
						</td>
					</tr>

				</table>

				<p class="submit">
					<input type="submit" class="button-primary" value="<?php 
        _e('Save Changes');
        ?>
" />
        	    </p>
        	</form>

		</div> <?php 
    }