Plugin Directory

Changeset 410814


Ignore:
Timestamp:
07/16/2011 09:15:08 PM (14 years ago)
Author:
sebat
Message:

add options page and fix some typo

Location:
wp1/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp1/trunk/wp1-menue.php

    r410801 r410814  
    44{
    55    ?>
    6     <div class="wrap">
    7         <h1><?php _e('WP Google +1 option page', 'wpg1'); ?></h1>
    8         <div id="poststuff">
    9             <div id="wpg1-option-intheme" class="postbox">
    10                 <h3><input type="checkbox" name="ch_add_to_theme" value="checked" /> Add google +1 button in your theme</h3>
    11                 <div class="inside">
    12                     <p>
    13                         To add the google +1 button, please use the following code in your template file.
    14                     </p>
    15                     <p style="font-famuly:Consolas, Monaco, 'Courier New', Courier, monospace; font-weight: bold;">
    16                         &lt;?php if (function_exists('wpg1_g1button')){ print wpg1_g1button('size'); } ?&gt;
    17                     </p>
    18                     <p>
    19                         Please use in stead of <b>size</b> one of the following values.<br />
    20                         small (15px), medium (20px), standart (24px) and large (60px)
    21                     </p>
     6   
     7    <?php
     8        if($_POST[wpg1submit]){
     9            $wpg1Options = array(
     10                "wpg1-addtheme"      =>  $_POST['wpg1-addtheme']
     11            );
     12            update_option('wpg1', $wpg1Options);
     13        }
     14        $wpg1Options = get_option('wpg1');
     15    ?>
     16           
     17   
     18   
     19    <form method="post" action="">
     20    <?php wp_nonce_field('update-options'); ?>
     21        <div class="wrap">
     22            <h1><?php _e('WP Google +1 options page', 'wpg1'); ?></h1>
     23            <div id="poststuff">
     24                <div id="wpg1-option-intheme" class="postbox">
     25                    <h3><input type="checkbox" name="wpg1-addtheme" value="checked" <?php print $wpg1Options['wpg1-addtheme']; ?> /> Add Google +1 button in your theme</h3>
     26                    <?php if($wpg1Options['wpg1-addtheme']): ?>
     27                    <div class="inside">
     28                        <p>
     29                            To add the Google +1 button please use the following code in your template files.
     30                        </p>
     31                        <p style="font-famuly:Consolas, Monaco, 'Courier New', Courier, monospace; font-weight: bold;">
     32                            &lt;?php if (function_exists('wpg1_g1button')){ print wpg1_g1button('size'); } ?&gt;
     33                        </p>
     34                        <p>
     35                            Please use instead of <b>size</b> one of the following values.<br />
     36                            small (15px), medium (20px), standard (24px) and large (60px)
     37                        </p>
     38                    </div>
     39                    <?php endif; ?>
    2240                </div>
     41               
     42               
     43                <input type="hidden" name="wpg1submit" value="submit" />
     44                <input type="hidden" name="action" value="update" />
     45
     46                <p class="submit">
     47                    <input type="submit" class="button-primary" value="<?php _e('Save', 'wpg1');?>" />
     48                </p>
     49               
     50            </div>
     51            <div id="wpg1-footer">
     52                This plugin ist provided by <a href="http://www.goopl.de">GooPl.de</a> (<g:plusone size="small" href="http://www.goopl.de" count="false"></g:plusone>) and developed by <a href="http://www.sebastian-thiele.net">Sebastian Thiele</a> (<g:plusone size="small" href="http://www.sebastian-thiele.net" count="false"></g:plusone>).
    2353            </div>
    2454        </div>
    25         <div id="wpg1-footer">
    26             This Plugin ist provided by <a href="http://www.goopl.de">GooPl.de</a> (<g:plusone size="small" href="http://www.goopl.de" count="false"></g:plusone>) and developed by <a href="http://www.sebastian-thiele.net">Sebastian Thiele</a> (<g:plusone size="small" href="http://www.sebastian-thiele.net" count="false"></g:plusone>).
    27         </div>
    28     </div>
     55    </form>
    2956   
    3057   
  • wp1/trunk/wp1.php

    r410801 r410814  
    88Author URI: http://sebastian.thiele.me
    99*/
     10$wpg1Options = get_option('wpg1');
    1011$plugindir = basename(dirname(__FILE__));
    1112load_plugin_textdomain( 'wpg1', 'wp-content/plugins/' . $plugindir.'/lang', false );
     
    3839}
    3940
    40 function wpg1_admin_head($content)
     41function wpg1_head($content)
    4142{
    4243    print '<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
     
    5253add_filter('manage_posts_columns', 'wpg1_article_colum');
    5354add_filter('manage_posts_custom_column', 'wpg1_article_colum_content');
    54 add_filter('admin_head', 'wpg1_admin_head');
    55 add_action( 'admin_menu', 'wpg1_adminmenue');
     55add_filter('admin_head', 'wpg1_head');
     56add_action('admin_menu', 'wpg1_adminmenue');
     57if($wpg1Options['wpg1-addtheme']) add_filter('wp_head', 'wpg1_head');
    5658?>
Note: See TracChangeset for help on using the changeset viewer.