Plugin Directory

Changeset 1830810


Ignore:
Timestamp:
02/28/2018 01:15:18 PM (8 years ago)
Author:
ClearcodeHQ
Message:

Version 1.2.0

Location:
cc-scripts
Files:
41 added
3 edited

Legend:

Unmodified
Added
Removed
  • cc-scripts/trunk/README.txt

    r1552781 r1830810  
    22Contributors: ClearcodeHQ, PiotrPress
    33Tags: JavaScript, scripts, head, body, footer, minify, minification, dependency, dependencies, output buffering, Clearcode, PiotrPress
     4Requires PHP: 7.0
    45Requires at least: 4.6
    5 Tested up to: 4.7
     6Tested up to: 4.9.4
    67Stable tag: trunk
    78License: GPLv3
     
    3738
    3839* wp_head action is the preferred location for firing scripts in the head section.
    39 * wp_body_open action is the preferred location for firing scripts in the body section.
     40* wp_body action is the preferred location for firing scripts in the body section.
    4041* wp_footer action is the preferred location for firing scripts in the footer section.
    4142* Use output buffering if you don't have access to the source code of your theme and/or you don't know if the functions above are included in your theme.
     
    5051== Frequently Asked Questions ==
    5152
    52 = How do I use the wp_body_open action? =
     53= How do I use the wp_body action? =
    5354
    5455Paste the following code directly after the opening `<body>` tag in your theme:
    55 `<?php do_action( 'wp_body_open' ); ?>`
     56`<?php do_action( 'wp_body' ); ?>`
    5657
    5758= Which inclusion method should I chose? =
    5859
    5960* wp_head action is the preferred location for firing scripts in the head section.
    60 * wp_body_open action is the preferred location for firing scripts in the body section.
     61* wp_body action is the preferred location for firing scripts in the body section.
    6162* wp_footer action is the preferred location for firing scripts in the footer section.
    6263* Use output buffering if you don't have access to the source code of your theme and/or you don't know if the functions above are included in your theme.
     
    7273== Changelog ==
    7374
     75= 1.2.0 =
     76*Release date: 28.02.2018*
     77
     78* Changed function from `wp_body_open()` to `wp_body()`.
     79
    7480= 1.1.0 =
    7581*Release date: 12.12.2016*
  • cc-scripts/trunk/includes/class-scripts.php

    r1552781 r1830810  
    2727            if ( ! self::get_option() ) {
    2828                self::add_option( array(
    29                     'head'   => array( 'scripts' => '', 'method' => 'wp_head',      'dependencies' => '', 'minify' => true ),
    30                     'body'   => array( 'scripts' => '', 'method' => 'wp_body_open', 'dependencies' => '', 'minify' => true ),
    31                     'footer' => array( 'scripts' => '', 'method' => 'wp_footer',    'dependencies' => '', 'minify' => true )
     29                    'head'   => array( 'scripts' => '', 'method' => 'wp_head',   'dependencies' => '', 'minify' => true ),
     30                    'body'   => array( 'scripts' => '', 'method' => 'wp_body',  'dependencies' => '', 'minify' => true ),
     31                    'footer' => array( 'scripts' => '', 'method' => 'wp_footer', 'dependencies' => '', 'minify' => true )
    3232                ) );
    3333            }
     
    258258                        self::__( 'Comma separated %s handles. Works only with %s method.' ),
    259259                        '<code>wp_enqueue_script</code>',
    260                         '<code>wp_body_open</code>'
    261                     )
    262                 )
    263             );
    264 
    265             add_settings_field( $field = 'body\method\wp_body_open', '', array(
     260                        '<code>wp_body</code>'
     261                    )
     262                )
     263            );
     264
     265            add_settings_field( $field = 'body\method\wp_body', '', array(
    266266                    $this,
    267267                    'input'
     
    272272                    'id'      => self::get( 'slug' ) . '\\' . $field,
    273273                    'name'    => self::get( 'slug' ) . '[body][method]',
    274                     'value'   => 'wp_body_open',
    275                     'checked' => 'wp_body_open' == self::get_body( 'method', 'wp_body_open' ) ? 'checked' : '',
     274                    'value'   => 'wp_body',
     275                    'checked' => 'wp_body' == self::get_body( 'method', 'wp_body' ) ? 'checked' : '',
    276276                    'before'  => '',
    277                     'after'   => 'wp_body_open',
     277                    'after'   => 'wp_body',
    278278                    'desc'    => sprintf(
    279279                        self::__( 'Add the following code directly after the %s tag in your theme (preferred method)' ) . ': ' .
    280                         '<code>' . htmlspecialchars( "<?php do_action( 'wp_body_open' ); ?>" ) . '</code>',
     280                        '<code>' . htmlspecialchars( "<?php do_action( 'wp_body' ); ?>" ) . '</code>',
    281281                        '<code>' . htmlspecialchars( '<body>' ) . '</code>'
    282282                    )
     
    300300                        self::__( 'Use this option if you cannot add the %s action to your theme.' ) . '<br />' .
    301301                        self::__( 'It will add the scripts directly after the %s tag using %s.' ),
    302                         '<code>wp_body_open</code>',
     302                        '<code>wp_body</code>',
    303303                        '<code>' . htmlspecialchars( '<body>' ) . '</code>',
    304304                        '<code>output buffering</code>'
     
    445445                    'dependencies' => empty( $option['body']['dependencies'] ) ? null  : sanitize_text_field( $option['body']['dependencies'] ),
    446446                    'minify'       => empty( $option['body']['minify'] )       ? false : true,
    447                     'method'       => in_array( $option['body']['method'], array( 'wp_body_open', 'output_buffering' ) ) ? $option['body']['method'] : null
     447                    'method'       => in_array( $option['body']['method'], array( 'wp_body', 'output_buffering' ) ) ? $option['body']['method'] : null
    448448                ),
    449449                'footer' => array(
     
    727727         *  Echo body scripts.
    728728         */
    729         public function action_wp_body_open() {
     729        public function action_wp_body() {
    730730            $dependencies = self::get_body( 'dependencies', '' );
    731731            if ( ! empty( $dependencies ) && ! self::wp_script_is( $dependencies, 'done' ) ) return;
    732732
    733             if ( 'wp_body_open' == self::get_body( 'method', 'wp_body_open' ) && $scripts = self::get_scripts( 'body' ) ) {
     733            if ( 'wp_body' == self::get_body( 'method', 'wp_body' ) && $scripts = self::get_scripts( 'body' ) ) {
    734734                if ( self::get_body( 'minify', true ) ) $scripts = self::minify( $scripts );
    735735                echo self::get_template( 'stamp.php',   array( 'time'    => date( 'Y-m-d H:i:s' ), 'version' => self::get( 'Version' ) ) ) . "\n" .
  • cc-scripts/trunk/plugin.php

    r1552781 r1830810  
    55    Plugin URI: https://wordpress.org/plugins/cc-scripts
    66    Description: Add custom JavaScript code to all your WordPress pages at once via the Admin panel.
    7     Version: 1.1.0
     7    Version: 1.2.0
    88    Author: Clearcode.cc
    99    Author URI: http://clearcode.cc
     
    4040}
    4141
    42 foreach ( array( 'class-singleton.php', 'class-plugin.php', 'class-scripts.php' ) as $file ) {
     42foreach ( array( 'class-singleton.php', 'class-plugin.php', 'class-scripts.php', 'functions.php' ) as $file ) {
    4343    require_once( plugin_dir_path( __FILE__ ) . 'includes/' . $file );
    4444}
Note: See TracChangeset for help on using the changeset viewer.