Plugin Directory

Changeset 769552


Ignore:
Timestamp:
09/10/2013 05:45:48 AM (12 years ago)
Author:
wpkuf
Message:

html structure in the admin panel has been modified

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-js-detect/trunk/wp-js-detect.php

    r769541 r769552  
    11<?php
    22
    3 if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
     3if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
     4    die('You are not allowed to call this page directly.');
     5}
    46
    57/*
     
    3436 *
    3537 */
    36 interface JsDetectInterface{
    37     public function __construct();
    38     public function install();
    39     public function uninstall();
    40     public function plugin_settings();
    41     public function wp_non_js_notification();
     38interface JsDetectInterface
     39{
     40    public function __construct();
     41    public function install();
     42    public function uninstall();
     43    public function plugin_settings();
     44    public function wp_non_js_notification();
    4245}
    4346
     
    4548 * Class JsDetect
    4649 *
    47 */
     50 */
    4851class JsDetect implements JsDetectInterface
    4952{
     
    5558    public function __construct()
    5659    {
    57         add_action('wp_head', array($this,'wp_non_js_notification'));
    58         add_action('admin_menu', array($this,'admin_menu_customization'));
    59 
    60         register_activation_hook( __FILE__, array( $this, 'install' ) );
    61         register_deactivation_hook( __FILE__, array( $this, 'uninstall' ) );
     60        add_action('wp_head', array($this, 'wp_non_js_notification'));
     61        add_action('admin_menu', array($this, 'admin_menu_customization'));
     62
     63        register_activation_hook(__FILE__, array($this, 'install'));
     64        register_deactivation_hook(__FILE__, array($this, 'uninstall'));
    6265    }
    6366
     
    6669     * This public function is used to add plugin option.
    6770     *
    68      * @param   -
    69      * @return  -
     71     * @param     -
     72     * @return    -
    7073     *
    7174     */
    7275    public function install()
    7376    {
    74         $wp_non_js_notification_text = __('For full functionality of this site it is necessary to enable JavaScript. Here are the <a href="http://www.enable-javascript.com/" target="_blank"> instructions how to enable JavaScript in your web browser</a>.');
    75         add_option( 'wp_non_js_notification_text', $wp_non_js_notification_text, '', 'yes' );
    76     }
     77        $wp_non_js_notification_text = __('For full functionality of this site it is necessary to enable JavaScript. Here are the <a href="http://www.enable-javascript.com/" target="_blank"> instructions how to enable JavaScript in your web browser</a>.');
     78        add_option('wp_non_js_notification_text', $wp_non_js_notification_text, '', 'yes');
     79    }
    7780
    7881    /**
     
    8083     * This public function is used to remove plugin options.
    8184     *
    82      * @param   -
    83      * @return  -
     85     * @param    -
     86     * @return    -
    8487     *
    8588     */
    8689    public function uninstall()
    8790    {
    88         delete_option( 'wp_non_js_notification_text' );
    89     }
     91        delete_option('wp_non_js_notification_text');
     92    }
    9093
    9194    /**
     
    99102    public function admin_menu_customization()
    100103    {
    101         add_menu_page('Js Detect', 'Js Detect', 'administrator', 'js-detect-settings',  array($this,'plugin_settings'),'', 99999999 );
     104        add_menu_page('Js Detect', 'Js Detect', 'administrator', 'js-detect-settings', array($this, 'plugin_settings'), '', 99999999);
    102105    }
    103106
     
    106109     * This public function is used to update plugin settings.
    107110     *
    108      * @param   -
    109      * @return  -
    110      *
    111      */
    112     public function plugin_settings(){
    113 
    114         if(isset($_POST['wp_non_js_notification_text'])){
    115             update_option('wp_non_js_notification_text',$_POST['wp_non_js_notification_text']);
    116         }
    117         ?>
    118         <div class="wrap">
    119             <div id="icon-tools" class="icon32"><br /></div><h2>Js Detect Settings</h2>
    120                 <form action="#" method="post">
    121                     <label for="wp_non_js_notification_text">No Js Notification:</label>
    122                     <textarea rows="10" class="large-text code" id="wp_non_js_notification_text" name="wp_non_js_notification_text"><?php echo get_option('wp_non_js_notification_text'); ?></textarea>
    123                     <input type="submit" value="<?php _e('Update'); ?>" class="button button-primary button-large">
    124                 </form>
    125                
    126                 <br />
    127                 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=Donation+for+Wp+Js+Detect" target="_blank" title="Make a Donation for Wp Js Detect Plugin">
    128                   <img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="" />
    129                 </a>               
    130             </div>
    131         </div>
    132         <?php
    133     }
     111     * @param    -
     112     * @return    -
     113     *
     114     */
     115    public function plugin_settings()
     116    {
     117
     118        if (isset($_POST['wp_non_js_notification_text'])) {
     119            update_option('wp_non_js_notification_text', $_POST['wp_non_js_notification_text']);
     120        }
     121        ?>
     122        <div class="wrap">
     123            <div id="icon-tools" class="icon32"><br/></div>
     124            <h2>Js Detect Settings</h2>
     125            <table cellspacing="0" class="widefat post fixed" style="width: 100%">
     126                <thead>
     127                <tr>
     128                    <th style="width:200px;" class="manage-column">
     129                    </th>
     130                    <th></th>
     131                </tr>
     132                </thead>
     133                <tfoot>
     134                <tr>
     135                    <th class="manage-column"></th>
     136                    <th></th>
     137                </tr>
     138                </tfoot>
     139                <tbody>
     140                <tr>
     141                    <td class="column">
     142                        <label for="wp_non_js_notification_text">No Js Notification:</label>
     143                    </td>
     144                    <td align="right" class="column">
     145                        <form action="#" method="post">
     146                            <textarea rows="10" class="large-text code" id="wp_non_js_notification_text"
     147                                      name="wp_non_js_notification_text"><?php echo get_option('wp_non_js_notification_text'); ?></textarea>
     148                            <input type="submit" value="<?php _e('Update'); ?>"
     149                                   class="button button-primary button-large">
     150                        </form>
     151                    </td>
     152                </tr>
     153                <tr>
     154                    <td colspan="2" class="column">
     155                        <p>Donate to support further development.</p>
     156
     157                        <p>I’m glad that you like my wordpress plugin and that you want to show your appreciation by
     158                            donating. With your help I can make these plugins even better!</p>
     159
     160                        <p>You can donate money using the PayPal-button below (any amount makes me happy!)</p>
     161
     162                        <p>
     163                            <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=Donation+for+Wp+Js+Detect"
     164                               target="_blank" title="Make a Donation for Wp Js Detect Plugin">
     165                                <img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt=""/>
     166                            </a>
     167                        </p>
     168                    </td>
     169                </tr>
     170                </tbody>
     171            </table>
     172        </div>
     173    <?php
     174    }
    134175
    135176    /**
     
    140181    public function wp_non_js_notification()
    141182    {
    142         $plugin_path=get_bloginfo('url').'/wp-content/plugins/wp-js-detect/';
    143         ?>
    144         <div id="jsDisabled"><p><?php echo get_option('wp_non_js_notification_text'); ?></p></div>
    145         <script language="javascript">
    146             var item = document.getElementById('jsDisabled');
    147             if (item.style.display === "block" || !item.style.display )
    148             {
    149                 item.style.display = 'none';
    150             }
    151         </script>
    152         <style>
    153         /*no JS message*/
    154             #jsDisabled{
     183        $plugin_path = get_bloginfo('url') . '/wp-content/plugins/wp-js-detect/';
     184        ?>
     185        <div id="jsDisabled"><p><?php echo get_option('wp_non_js_notification_text'); ?></p></div>
     186        <script language="javascript">
     187            var item = document.getElementById('jsDisabled');
     188            if (item.style.display === "block" || !item.style.display) {
     189                item.style.display = 'none';
     190            }
     191        </script>
     192        <style>
     193            /*no JS message*/
     194            #jsDisabled {
    155195                position: fixed;
    156196                width: 100%;
     
    159199                z-index: 2000;
    160200            }
    161             #jsDisabled p{
     201            #jsDisabled p {
    162202                position: absolute;
    163                 top:50%;
     203                top: 50%;
    164204                left: 50%;
    165205                width: 100%;
     
    176216                line-height: 26px;
    177217            }
    178             #jsDisabled p a{
     218            #jsDisabled p a {
    179219                color: #d13131;
    180220            }
    181         </style>
    182         <?php
     221        </style>
     222    <?php
    183223    }
    184224}
     225
    185226new JsDetect();
Note: See TracChangeset for help on using the changeset viewer.