Plugin Directory

Changeset 896114


Ignore:
Timestamp:
04/17/2014 12:23:42 PM (12 years ago)
Author:
wpkuf
Message:

tested up to 3.9

Location:
wp-js-detect/trunk
Files:
2 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • wp-js-detect/trunk/.travis.yml

    r891421 r896114  
     1# http://docs.travis-ci.com/user/build-configuration/
    12language: php
    23
    34php:
    4     - 5.2
    55    - 5.3
    66    - 5.4
     
    88env:
    99    - WP_VERSION=latest WP_MULTISITE=0
    10     - WP_VERSION=latest WP_MULTISITE=1
     10    # - WP_VERSION=latest WP_MULTISITE=1
     11
     12# whitelist
     13branches:
     14  only:
     15    - master
     16
     17before_install:
     18  # Use this to prepare the system to install prerequisites or dependencies
     19  # e.g. sudo apt-get update
     20
     21install:
     22  # Use this to install any prerequisites or dependencies necessary to run your build
     23 
     24  ## PHP Copy/Paste Detector
     25  # - curl -o phpcpd.phar https://phar.phpunit.de/phpcpd.phar
     26
     27  - wget https://phar.phpunit.de/phpcpd.phar
     28  - chmod +x phpcpd.phar
     29  - sudo mv phpcpd.phar /usr/local/bin/phpcpd
    1130
    1231before_script:
    13     - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
     32  # Use this to prepare your build for testing
     33  # e.g. copy database configurations, environment variables, etc.
    1434
    15 script: phpunit
     35  # FUCK COMPOSER/TRAVIS
     36  #  ## Composer
     37  #  - sudo apt-get -qq install dnsutils
     38  #  - curl -s http://getcomposer.org/installer | php
     39  #  - php composer.phar install
     40  #  - composer self-update
     41
     42  ## PHP_CodeSniffer
     43  - pear install pear/PHP_CodeSniffer
     44  - phpenv rehash
     45  - git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress
     46
     47  ## PHP Mess Detector
     48  - pear config-set preferred_state beta
     49  - printf "\n" | pecl install imagick
     50  - pear channel-discover pear.phpmd.org
     51  - pear channel-discover pear.pdepend.org
     52  - pear install --alldeps phpmd/PHP_PMD
     53  - phpenv rehash
     54  ## PHPLOC
     55  - curl -o phploc.phar https://phar.phpunit.de/phploc.phar
     56
     57script:
     58
     59  - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
     60  - phpunit
     61
     62notifications:
     63  email:
     64    [email protected]
     65
     66after_success:
     67after_failure:
     68after_script:
  • wp-js-detect/trunk/bin/install-wp-tests.sh

    r874121 r896114  
    3030
    3131    wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
     32
     33    cd $WP_CORE_DIR/wp-content/plugins
     34   
     35    array=( "wp-js-detect" )
     36    for element in ${array[@]}
     37    do
     38        svn co --quiet http://plugins.svn.wordpress.org/$element temporary_plugin_copy
     39        mkdir $element
     40        cp -r temporary_plugin_copy/trunk/* $element
     41        rm -rf temporary_plugin_copy
     42    done
     43
     44       
    3245}
    3346
     
    7487}
    7588
     89php_tools() {
     90
     91  ## PHP_CodeSniffer
     92  # - phpcs --standard=PSR1 .
     93  # - phpcs --standard=PSR2 .
     94  phpcs --standard=WordPress $WP_CORE_DIR"wp-content/plugins/wp-js-detect/wp-js-detect.php"
     95
     96  ## PHP Copy/Paste Detector
     97  phpcpd --verbose $WP_CORE_DIR"wp-content/plugins/wp-js-detect/"
     98
     99  ## PHP Mess Detector
     100  phpmd $WP_CORE_DIR"wp-content/plugins/wp-js-detect/" text cleancode --exclude lightopenid
     101  phpmd $WP_CORE_DIR"wp-content/plugins/wp-js-detect/" text codesize --exclude lightopenid
     102  phpmd $WP_CORE_DIR"wp-content/plugins/wp-js-detect/" text controversial --exclude lightopenid
     103  phpmd $WP_CORE_DIR"wp-content/plugins/wp-js-detect/" text design --exclude lightopenid
     104  phpmd $WP_CORE_DIR"wp-content/plugins/wp-js-detect/" text naming --exclude lightopenid
     105  phpmd $WP_CORE_DIR"wp-content/plugins/wp-js-detect/" text unusedcode --exclude lightopenid
     106
     107  ## PHPLOC
     108  php phploc.phar $WP_CORE_DIR"wp-content/plugins/wp-js-detect/wp-js-detect.php"
     109}
     110
    76111install_wp
    77112install_test_suite
    78113install_db
     114php_tools
  • wp-js-detect/trunk/phpunit.xml

    r874121 r896114  
    11<phpunit
    2     bootstrap="tests/bootstrap.php"
     2    bootstrap="bootstrap_tests.php"
    33    backupGlobals="false"
    44    colors="true"
  • wp-js-detect/trunk/readme.md

    r891421 r896114  
    55 - Tags: javascript,js, disabled js,disabled javascript,disabled javascript notification,disabled javascript message, warning
    66 - Requires at least: 3.5
    7  - Tested up to: 3.8
     7 - Tested up to: 3.9
    88 - Stable tag: 1.0.9
    99 - License: GPLv2 or later
  • wp-js-detect/trunk/tests/bootstrap.php

    r874121 r896114  
    11<?php
    22
    3 $_tests_dir = getenv('WP_TESTS_DIR');
    4 if ( !$_tests_dir ) $_tests_dir = '/tmp/wordpress-tests-lib';
     3/**
     4 * Bootstrap the plugin unit testing environment. Customize 'active_plugins'
     5 * setting below to point to your main plugin file.
     6 *
     7 * Requires WordPress Unit Tests (http://unit-test.svn.wordpress.org/trunk/).
     8 *
     9 * @package wordpress-plugin-tests
     10 */
    511
    6 require_once $_tests_dir . '/includes/functions.php';
     12// Add this plugin to WordPress for activation so it can be tested.
    713
    8 function _manually_load_plugin() {
    9     require dirname( __FILE__ ) . '/../wp-js-detect.php';
     14$GLOBALS['wp_tests_options'] = array(
     15    'active_plugins' => array( "wp-js-detect/wp-js-detect.php" ),
     16);
     17
     18// If the wordpress-tests repo location has been customized (and specified
     19// with WP_TESTS_DIR), use that location. This will most commonly be the case
     20// when configured for use with Travis CI.
     21
     22// Otherwise, we'll just assume that this plugin is installed in the WordPress
     23// SVN external checkout configured in the wordpress-tests repo.
     24
     25if( false !== getenv( 'WP_TESTS_DIR' ) ) {
     26    require getenv( 'WP_TESTS_DIR' ) . '/bootstrap.php';
     27} else {
     28    require dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) . '/bootstrap.php';
    1029}
    11 tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
    12 
    13 require $_tests_dir . '/includes/bootstrap.php';
    14 
  • wp-js-detect/trunk/wp-js-detect.php

    r891421 r896114  
    11<?php
    22
    3 if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
    4     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.' );
    55}
    66
     
    3636 *
    3737 */
    38 interface JsDetectInterface {
     38interface Js_Detect_Interface {
    3939    public function __construct();
    4040    public function install();
     
    5353 *
    5454 */
    55 class JsDetect implements JsDetectInterface {
     55class Js_Detect implements Js_Detect_Interface {
    5656    /**
    5757     *  Function __construct
     
    6161    public function __construct() {
    6262   
    63         add_action('wp_head', array($this, 'wp_non_js_notification'));
    64         add_action('admin_menu', array($this, 'admin_menu_customization'));
    65 
    66         register_activation_hook(__FILE__, array($this, 'install'));
    67         register_deactivation_hook(__FILE__, array($this, 'uninstall'));
    68 
    69         $plugin = plugin_basename(__FILE__);
    70         add_filter("plugin_action_links_$plugin", array($this, 'plugin_settings_link'));
    71 
    72         add_action('wp_footer', array($this, 'add_plugin_js'), -2);
    73         add_action('wp_footer', array($this, 'add_plugin_css'), -3);
    74         add_action('plugin_wp_js_detect_css', array($this, 'plugin_wp_js_detect_css'));
    75 
    76         add_action('plugins_loaded', array($this, 'js_detect_init'));
     63        add_action('wp_head', array( $this, 'wp_non_js_notification' ) );
     64        add_action('admin_menu', array( $this, 'admin_menu_customization' ) );
     65
     66        register_activation_hook( __FILE__, array( $this, 'install' ) );
     67        register_deactivation_hook( __FILE__, array( $this, 'uninstall' ) );
     68
     69        $plugin = plugin_basename( __FILE__ );
     70        add_filter("plugin_action_links_$plugin", array( $this, 'plugin_settings_link' ) );
     71
     72        add_action('wp_footer', array( $this, 'add_plugin_js' ), -2 );
     73        add_action('wp_footer', array( $this, 'add_plugin_css' ), -3 );
     74        add_action('plugin_wp_js_detect_css', array( $this, 'plugin_wp_js_detect_css' ) );
     75
     76        add_action('plugins_loaded', array( $this, 'js_detect_init' ) );
    7777    }
    7878
     
    9595     */
    9696    public function add_plugin_css() {
    97         wp_enqueue_style('wp-js-detect-css-dynamic', plugins_url('css/dynamic.css.php', __FILE__));
     97        wp_enqueue_style( 'wp-js-detect-css-dynamic', plugins_url( 'css/dynamic.css.php', __FILE__ ) );
    9898    }
    9999
     
    106106     */
    107107    public function plugin_wp_js_detect_css() {   
    108         echo get_option('wp_non_js_notification_css');
     108        echo get_option( 'wp_non_js_notification_css' );
    109109    }
    110110
     
    117117    public function install() {
    118118   
    119         $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>.');
    120         add_option('wp_non_js_notification_text', $wp_non_js_notification_text, '', 'yes');
     119        $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>.');
     120        add_option( 'wp_non_js_notification_text', $wp_non_js_notification_text, '', 'yes' );
    121121
    122122        $wp_non_js_notification_css = "
     
    126126                width: 100%;
    127127                height: 100%;
    128                 background: url(" . plugins_url('images/dark-bg.png', __FILE__) . ") repeat;
     128                background: url(" . plugins_url('images/dark-bg.png', __FILE__ ) . ") repeat;
    129129                z-index: 2000;               
    130130                -webkit-transition-property: width height background-color font-size left top color;
     
    148148                box-shadow: 0 0 10px #000;
    149149                padding: 30px 30px 30px 120px;
    150                 background: #fef5f2 url(" . plugins_url('images/symbol_error.png', __FILE__) . ") 30px 50% no-repeat;
     150                background: #fef5f2 url(" . plugins_url('images/symbol_error.png', __FILE__ ) . ") 30px 50% no-repeat;
    151151                font-size: 20px;
    152152                text-align: left;
     
    158158            }
    159159        ";
    160         add_option('wp_non_js_notification_css', $wp_non_js_notification_css, '', 'yes');
     160        add_option('wp_non_js_notification_css', $wp_non_js_notification_css, '', 'yes' );
    161161    }
    162162
     
    167167     */
    168168    public function uninstall() {
    169         delete_option('wp_non_js_notification_text');
    170         delete_option('wp_non_js_notification_css');
     169        delete_option( 'wp_non_js_notification_text' );
     170        delete_option( 'wp_non_js_notification_css' );
    171171    }
    172172
     
    177177     */
    178178    public function admin_menu_customization() {
    179         add_menu_page(__('Js Detect','js-detect'), 'Js Detect', 'administrator', 'js-detect-settings', array($this, 'plugin_settings'), '', 99999999);
     179        add_menu_page( __( 'Js Detect','js-detect' ), 'Js Detect', 'administrator', 'js-detect-settings', array( $this, 'plugin_settings' ), '', 99999999 );
    180180    }
    181181
     
    188188   
    189189        if ( isset( $_POST['wp_non_js_notification_text'] ) ) {
    190             update_option('wp_non_js_notification_text', stripslashes_deep( $_POST['wp_non_js_notification_text'] ) );
     190            update_option( 'wp_non_js_notification_text', stripslashes_deep( $_POST['wp_non_js_notification_text'] ) );
    191191        }
    192192        if ( isset( $_POST['wp_non_js_notification_css'] ) ) {
     
    317317        <script>
    318318            var item = document.getElementById('jsDisabled');
    319             if (item.style.display === "block" || !item.style.display) {
     319            if ( item.style.display === "block" || !item.style.display ) {
    320320                item.style.display = 'none';
    321321            }
     
    370370
    371371        $currentLocale = get_locale();
    372         if ( !empty($currentLocale) ) {
    373             $moFile = dirname(__FILE__) . "/languages/" . $currentLocale . ".mo";
    374             if( @file_exists( $moFile ) && is_readable( $moFile) )
    375                 load_textdomain('js-detect', $moFile);
     372        if ( !empty( $currentLocale ) ) {
     373            $moFile = dirname( __FILE__ ) . "/languages/" . $currentLocale . ".mo";
     374            if( @file_exists( $moFile ) && is_readable( $moFile ) ) {
     375                load_textdomain( 'js-detect', $moFile );
     376            }
    376377        }
    377378    }
     
    379380}
    380381
    381 new JsDetect();
     382new Js_Detect();
Note: See TracChangeset for help on using the changeset viewer.