Changeset 1830810
- Timestamp:
- 02/28/2018 01:15:18 PM (8 years ago)
- Location:
- cc-scripts
- Files:
-
- 41 added
- 3 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/AUTHORS.txt (added)
-
tags/1.2.0/LICENSE.txt (added)
-
tags/1.2.0/README.txt (added)
-
tags/1.2.0/assets (added)
-
tags/1.2.0/assets/css (added)
-
tags/1.2.0/assets/css/index.html (added)
-
tags/1.2.0/assets/css/style.css (added)
-
tags/1.2.0/assets/index.html (added)
-
tags/1.2.0/assets/js (added)
-
tags/1.2.0/assets/js/index.html (added)
-
tags/1.2.0/assets/js/script.js (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/class-plugin.php (added)
-
tags/1.2.0/includes/class-scripts.php (added)
-
tags/1.2.0/includes/class-singleton.php (added)
-
tags/1.2.0/includes/functions.php (added)
-
tags/1.2.0/includes/index.html (added)
-
tags/1.2.0/index.html (added)
-
tags/1.2.0/languages (added)
-
tags/1.2.0/languages/cc-scripts-pl_PL.mo (added)
-
tags/1.2.0/languages/cc-scripts-pl_PL.po (added)
-
tags/1.2.0/languages/index.html (added)
-
tags/1.2.0/plugin.php (added)
-
tags/1.2.0/screenshot-1.png (added)
-
tags/1.2.0/templates (added)
-
tags/1.2.0/templates/div.php (added)
-
tags/1.2.0/templates/index.html (added)
-
tags/1.2.0/templates/input.php (added)
-
tags/1.2.0/templates/link.php (added)
-
tags/1.2.0/templates/page.php (added)
-
tags/1.2.0/templates/scripts.php (added)
-
tags/1.2.0/templates/section.php (added)
-
tags/1.2.0/templates/stamp.php (added)
-
tags/1.2.0/templates/textarea.php (added)
-
tags/1.2.0/vendor (added)
-
tags/1.2.0/vendor/Minify (added)
-
tags/1.2.0/vendor/Minify/JSMin.php (added)
-
tags/1.2.0/vendor/Minify/index.html (added)
-
tags/1.2.0/vendor/index.html (added)
-
trunk/README.txt (modified) (4 diffs)
-
trunk/includes/class-scripts.php (modified) (6 diffs)
-
trunk/includes/functions.php (added)
-
trunk/plugin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cc-scripts/trunk/README.txt
r1552781 r1830810 2 2 Contributors: ClearcodeHQ, PiotrPress 3 3 Tags: JavaScript, scripts, head, body, footer, minify, minification, dependency, dependencies, output buffering, Clearcode, PiotrPress 4 Requires PHP: 7.0 4 5 Requires at least: 4.6 5 Tested up to: 4. 76 Tested up to: 4.9.4 6 7 Stable tag: trunk 7 8 License: GPLv3 … … 37 38 38 39 * wp_head action is the preferred location for firing scripts in the head section. 39 * wp_body _openaction 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. 40 41 * wp_footer action is the preferred location for firing scripts in the footer section. 41 42 * 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. … … 50 51 == Frequently Asked Questions == 51 52 52 = How do I use the wp_body _openaction? =53 = How do I use the wp_body action? = 53 54 54 55 Paste 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' ); ?>` 56 57 57 58 = Which inclusion method should I chose? = 58 59 59 60 * wp_head action is the preferred location for firing scripts in the head section. 60 * wp_body _openaction 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. 61 62 * wp_footer action is the preferred location for firing scripts in the footer section. 62 63 * 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. … … 72 73 == Changelog == 73 74 75 = 1.2.0 = 76 *Release date: 28.02.2018* 77 78 * Changed function from `wp_body_open()` to `wp_body()`. 79 74 80 = 1.1.0 = 75 81 *Release date: 12.12.2016* -
cc-scripts/trunk/includes/class-scripts.php
r1552781 r1830810 27 27 if ( ! self::get_option() ) { 28 28 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 ) 32 32 ) ); 33 33 } … … 258 258 self::__( 'Comma separated %s handles. Works only with %s method.' ), 259 259 '<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( 266 266 $this, 267 267 'input' … … 272 272 'id' => self::get( 'slug' ) . '\\' . $field, 273 273 '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' : '', 276 276 'before' => '', 277 'after' => 'wp_body _open',277 'after' => 'wp_body', 278 278 'desc' => sprintf( 279 279 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>', 281 281 '<code>' . htmlspecialchars( '<body>' ) . '</code>' 282 282 ) … … 300 300 self::__( 'Use this option if you cannot add the %s action to your theme.' ) . '<br />' . 301 301 self::__( 'It will add the scripts directly after the %s tag using %s.' ), 302 '<code>wp_body _open</code>',302 '<code>wp_body</code>', 303 303 '<code>' . htmlspecialchars( '<body>' ) . '</code>', 304 304 '<code>output buffering</code>' … … 445 445 'dependencies' => empty( $option['body']['dependencies'] ) ? null : sanitize_text_field( $option['body']['dependencies'] ), 446 446 'minify' => empty( $option['body']['minify'] ) ? false : true, 447 'method' => in_array( $option['body']['method'], array( 'wp_body _open', 'output_buffering' ) ) ? $option['body']['method'] : null447 'method' => in_array( $option['body']['method'], array( 'wp_body', 'output_buffering' ) ) ? $option['body']['method'] : null 448 448 ), 449 449 'footer' => array( … … 727 727 * Echo body scripts. 728 728 */ 729 public function action_wp_body _open() {729 public function action_wp_body() { 730 730 $dependencies = self::get_body( 'dependencies', '' ); 731 731 if ( ! empty( $dependencies ) && ! self::wp_script_is( $dependencies, 'done' ) ) return; 732 732 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' ) ) { 734 734 if ( self::get_body( 'minify', true ) ) $scripts = self::minify( $scripts ); 735 735 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 5 5 Plugin URI: https://wordpress.org/plugins/cc-scripts 6 6 Description: Add custom JavaScript code to all your WordPress pages at once via the Admin panel. 7 Version: 1. 1.07 Version: 1.2.0 8 8 Author: Clearcode.cc 9 9 Author URI: http://clearcode.cc … … 40 40 } 41 41 42 foreach ( array( 'class-singleton.php', 'class-plugin.php', 'class-scripts.php' ) as $file ) {42 foreach ( array( 'class-singleton.php', 'class-plugin.php', 'class-scripts.php', 'functions.php' ) as $file ) { 43 43 require_once( plugin_dir_path( __FILE__ ) . 'includes/' . $file ); 44 44 }
Note: See TracChangeset
for help on using the changeset viewer.