From 16512a75ffc66b8ee9e451f24e406c7c60dc6d0a Mon Sep 17 00:00:00 2001 From: Ran Bar-Zik Date: Sat, 3 Oct 2015 18:20:20 +0300 Subject: [PATCH 1/8] Moving phpcs to proper location --- .travis.yml | 1 + tests/bin/install-wp-tests.sh | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbea45c..1a7b44b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,4 +28,5 @@ before_script: - bash tests/bin/install-wp-tests.sh test root '' localhost $WP_VERSION script: + - phpcs --standard=WordPress ./**/*.php - phpunit \ No newline at end of file diff --git a/tests/bin/install-wp-tests.sh b/tests/bin/install-wp-tests.sh index 9cb0b1b..0d7ffad 100644 --- a/tests/bin/install-wp-tests.sh +++ b/tests/bin/install-wp-tests.sh @@ -171,10 +171,6 @@ run_phpcs() { npm install -g jshint phpcs --config-set installed_paths $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress phpcs -i - local FOLDER_PATH=$(dirname $DIR) - cd $FOLDER_PATH - npm install - grunt lint } install_wp From 5b74cfc708390dbdac097eb5756f4001d21c4ef3 Mon Sep 17 00:00:00 2001 From: Ran Bar-Zik Date: Sat, 12 Dec 2015 14:48:57 +0200 Subject: [PATCH 2/8] Version 1.3.4 --- README.md | 4 +- README.txt | 20 +++++++--- admin/assets/css/admin.css | 4 ++ admin/class-wp-notice-admin.php | 36 ++++++++++++++++- public/class-wp-notice.php | 37 ++++++++++++++++-- tests/bin/router.php | 4 +- tests/test_wp_notice_plugin_tests.php | 56 ++++++++++++++++++++++++++- wp-notice.php | 2 +- 8 files changed, 147 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index b9cbed5..d9a01aa 100755 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ # WP Notice -WP Notice plugin enable every admin to post animated announcement or messages on top of posts based on tags, categories or date. +WP Notice plugin enable every admin to post animated announcement or messages in posts based on tags, categories or date. You can assign several messages for the several posts. There are several custom designs based on BootStrap styles. Along with the styles, you can also add to every message one of hundreds icons based on Font Awesome repository and -also choose animation type, duration and number of repetition. +also choose animation type, duration and number of repetition. You can chhose the position of the notices. # Installation and other information diff --git a/README.txt b/README.txt index 638f396..7774d2c 100755 --- a/README.txt +++ b/README.txt @@ -1,8 +1,8 @@ === WordPress Notice === Contributors: barzik Tags: notification, posts, obsolete, notice, messages, notice based on category, animation, font awesome -Requires at least: 3.7 -Tested up to: 4.3.1 +Requires at least: 3.8 +Tested up to: 4.4 Stable tag: trunk License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -11,10 +11,10 @@ WP Notice Plugin enables site admin to display custom animated announcements in == Description == -WP Notice plugin enable every website manager to display animated announcement or messages on top of posts based on tags, categories or date. -You can assign several messages for the several posts. There are several custom designs based on Twitter BootStrap styles. +WP Notice plugin enable every admin to post animated announcement or messages in posts based on tags, categories or date. +You can assign several messages for the several posts. There are several custom designs based on BootStrap styles. Along with the styles, you can also add to every message one of hundreds icons based on Font Awesome repository and -also choose animation type, duration and number of repetition. You can preview the message with the animation before saving it. +also choose animation type, duration and number of repetition. You can chhose the position of the notices. Ideal for technical sites that need to post deprecated notice on old posts and any other sites that need to show messages to users based on categories, tags or date and get attention to the message by using icons and animation if needed. @@ -59,6 +59,11 @@ GitHub: https://github.com/barzik/wp-notice == Changelog == += 1.3.4 = +* Adding Position choice: before content, after content or both. +* Added PHPUnit test case. +* Removed tests from production to testing. + = 1.3.2 = * Fix for link posting in messages. * Added PHPUnit test case for the link issues. @@ -103,6 +108,11 @@ GitHub: https://github.com/barzik/wp-notice == Upgrade Notice == += 1.3.4 = +* Adding Position choice: before content, after content or both. +* Added PHPUnit test case. +* Removed tests from production to testing. + = 1.3.2 = Fix for issue with link being inserted to message and got malformed. diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index debc279..811c5ac 100755 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -44,6 +44,10 @@ fieldset.wp_notice > div.wp_notice_style > label { display: inline; } +fieldset.wp_notice > div.wp_notice_position > label { + display: inline; +} + .wp_notice_animation.form-group > span { display: inline-block; } diff --git a/admin/class-wp-notice-admin.php b/admin/class-wp-notice-admin.php index 64247e0..4e40c72 100755 --- a/admin/class-wp-notice-admin.php +++ b/admin/class-wp-notice-admin.php @@ -305,6 +305,11 @@ private function prepare_wp_notice_post() { $wp_notice_options_raw['animation'][ $i ]['duration'] = ''; $wp_notice_options_raw['animation'][ $i ]['repeat'] = ''; } + if ( isset( $wp_notice_options_raw['position'][ $i ] ) ) { + $wp_notice_options[ $i ]['position'] = sanitize_text_field( $wp_notice_options_raw['position'][ $i ] ); + } else { + $wp_notice_options[ $i ]['position'] = 'before'; + } } return $wp_notice_options; } @@ -390,7 +395,7 @@ private function get_all_fieldsets( $wp_notice_options ) { $html .= $this->build_fieldset( $key, $wp_notice_option['tag'], $wp_notice_option['cat'], $wp_notice_option['wp_notice_time'], $wp_notice_option['wp_notice_text'], $wp_notice_option['style'], - $wp_notice_option['font'], $wp_notice_option['animation'] + $wp_notice_option['font'], $wp_notice_option['animation'], $wp_notice_option['position'] ); } return $html; @@ -500,6 +505,27 @@ private function generate_fonts_list( $number = 0, $selected_font = 'none' ) { return $font_list; } + /** + * + * Generating the position list for the fieldset in the admin options menu + * + * @param int $number The serial ID of the fieldset. + * @param string $selected_position The position for the notice. + * @return string + */ + private function generate_position( $number = 0, $selected_position = 'befote' ) { + + $position_list = ''; + $position_list .= "'; + $position_list .= " '; + + return $position_list; + } + /** * * Generating the animation for the fieldset in the admin options menu @@ -552,16 +578,19 @@ private function generate_animation( $number = 0, $selected_animation = array() * @param string $selected_style The style string. * @param string $selected_font The font string for fontAwsome. * @param array $selected_animation Array for fonts. + * @param string $selected_position - The position of the notice. * @return string */ private function build_fieldset( $number = 0, $selected_tag = array(), $selected_category = array(), $time = null, - $text = '', $selected_style = 'wp-notice-regular', $selected_font = 'none', $selected_animation = array() ) { + $text = '', $selected_style = 'wp-notice-regular', $selected_font = 'none', $selected_animation = array(), + $selected_position = 'before' ) { $category_list = $this->generate_category_list( $number, $selected_category ); $tag_list = $this->generate_tag_list( $number, $selected_tag ); $style_list = $this->generate_style_list( $number, $selected_style ); $fonts_list = $this->generate_fonts_list( $number, $selected_font ); $animation = $this->generate_animation( $number, $selected_animation ); + $position = $this->generate_position( $number, $selected_position ); $text_label = __( 'The Notice', $this->plugin_slug ); $time_label = __( 'Show in all posts that were created before:', $this->plugin_slug ); $text_place_holder = __( 'Insert the text of the notice here. It can be HTML or text string', $this->plugin_slug ); @@ -585,6 +614,9 @@ private function build_fieldset( $number = 0, $selected_tag = array(), $selected
$animation
+
+ $position +
diff --git a/public/class-wp-notice.php b/public/class-wp-notice.php index 416e4b5..5e10956 100755 --- a/public/class-wp-notice.php +++ b/public/class-wp-notice.php @@ -181,8 +181,19 @@ public function wp_notice_add_message( $content ) { $messages_array = $this->wp_notice_options_decider(); foreach ( $messages_array as $key => $message ) { $messages_html .= $this->create_message_block( $message['text'], $key, $message['style'], $message['font'], $message['animation'] ); + switch ( $message['position'] ) { + case 'after': + $content = $content.$messages_html; + break; + case 'both': + $content = $messages_html.$content.$messages_html; + break; + default: + $content = $messages_html.$content; + break; + } } - $content = $messages_html.$content; + return $content; } @@ -243,12 +254,18 @@ private function wp_notice_options_decider() { if ( isset( $sort_option['tag'] ) && ! empty( $sort_option['tag'] ) ) { foreach ( $sort_option['tag'] as $tag ) { if ( in_array( $tag, $current_tags ) ) { - $messages[] = array( + $temp_message = array( 'text' => $sort_option['wp_notice_text'], 'style' => $sort_option['style'], 'font' => $sort_option['font'], 'animation' => $sort_option['animation'], ); + if ( isset( $sort_option['position'] ) ) { + $temp_message['position'] = $sort_option['position']; + } else { + $temp_message['position'] = 'before'; + } + $messages[] = $temp_message; $found = true; break; } @@ -262,12 +279,18 @@ private function wp_notice_options_decider() { if ( isset( $sort_option['cat'] ) && ! empty( $sort_option['cat'] ) ) { foreach ( $sort_option['cat'] as $cat ) { if ( in_array( $cat, $current_categories ) ) { - $messages[] = array( + $temp_message = array( 'text' => $sort_option['wp_notice_text'], 'style' => $sort_option['style'], 'font' => $sort_option['font'], 'animation' => $sort_option['animation'], ); + if ( isset( $sort_option['position'] ) ) { + $temp_message['position'] = $sort_option['position']; + } else { + $temp_message['position'] = 'before'; + } + $messages[] = $temp_message; $found = true; break; } @@ -282,12 +305,18 @@ private function wp_notice_options_decider() { $dt = DateTime::createFromFormat( 'd/m/Y', $options[ $key ]['wp_notice_time'] ); $ts = $dt->getTimestamp(); if ( $ts > get_the_time( 'U' ) ) { - $messages[] = array( + $temp_message = array( 'text' => $sort_option['wp_notice_text'], 'style' => $sort_option['style'], 'font' => $sort_option['font'], 'animation' => $sort_option['animation'], ); + if ( isset( $sort_option['position'] ) ) { + $temp_message['position'] = $sort_option['position']; + } else { + $temp_message['position'] = 'before'; + } + $messages[] = $temp_message; } } } diff --git a/tests/bin/router.php b/tests/bin/router.php index 2ec72b0..239d0e7 100644 --- a/tests/bin/router.php +++ b/tests/bin/router.php @@ -1,5 +1,7 @@ factory->user->create( array( 'role' => 'administrator' ) ) ); + wp_set_current_user( $user->ID ); + // fetching options, validate it is empty + $wp_notice_settings = get_option( 'wp_notice_settings_information', array() ); + + $this->assertEmpty( $wp_notice_settings ); + + $i = 0; + $cat_id = $this->generate_category(); + // generate $_POST data + $this->create_valid_post_data( $i, $cat_id, NULL, NULL , 'wp-notice-regular', 'none', array('duration' => '', 'repeat' => '', 'type' => 'none'), 'after' ); + + // checking the admin page with $_POST - should insert it to the options + $this->plugin_admin->display_plugin_admin_page(); + + // fetching options, now it is not empty + $wp_notice_settings = get_option( 'wp_notice_settings_information', array() ); + + $this->assertNotEmpty( $wp_notice_settings ); + + $options_data = unserialize( $wp_notice_settings ); + $this->assertInternalType( 'array', $options_data[ $i ] ); + $this->assertEmpty( $options_data[ $i ]['wp_notice_time']); + $this->assertEmpty( $options_data[ $i ]['tag']); + $this->assertEquals( $options_data[ $i ]['position'], 'after'); + + $this->assertEquals( $options_data[ $i ]['wp_notice_text'], 'This is notice #'.$i.' message' ); + $this->assertEquals( $options_data[ $i ]['style'], 'wp-notice-regular' ); + $this->assertEquals( $options_data[ $i ]['font'], 'none' ); + $this->assertEquals( $options_data[ $i ]['position'], 'after' ); + + // now test it with real post - it should not contain message and not errors + // notice, warnings and errors will drop tests - added convertErrorsToExceptions = "true" + //convertNoticesToExceptions = "true" + //convertWarningsToExceptions = "true" + // in phpunit.xml + // create one post + $post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_status' => 'publish', 'post_title' => 'POST1', 'post_content' => 'POST CONTENT', 'post_excerpt'=> 'POST CONTENT', 'post_date' => date( 'Y-m-d H:i:s', time() ) ) ); + + // go to this post + $this->go_to( get_permalink( $post_id ) ); + // fetch the content + $post_content_with_notice = get_echo( 'the_content' ); + + } + function test_plugin_delete_all_options() { $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); @@ -493,7 +545,7 @@ class_exists('WP_notice_Admin'), } - function create_valid_post_data( $i = 0, $cat_id = 0, $term_id = 0, $date = '', $style = 'wp-notice-regular', $font = 'none', $animation = array('duration' => '', 'repeat' => '', 'type' => 'none') ) { + function create_valid_post_data( $i = 0, $cat_id = 0, $term_id = 0, $date = '', $style = 'wp-notice-regular', $font = 'none', $animation = array('duration' => '', 'repeat' => '', 'type' => 'none'), $position = 'before' ) { global $_POST; $_POST['wp_notice'] = wp_create_nonce( 'submit_notice' ); @@ -516,6 +568,8 @@ function create_valid_post_data( $i = 0, $cat_id = 0, $term_id = 0, $date = '', $_POST['animation'][ $i ] = $animation; + $_POST['position'][ $i ] = $position; + } public function generate_category() { diff --git a/wp-notice.php b/wp-notice.php index bea068a..8e7df5e 100755 --- a/wp-notice.php +++ b/wp-notice.php @@ -12,7 +12,7 @@ * Plugin Name: WP Notice * Plugin URI: http://internet-israel.com * Description: WP Notice Plugin enables admin to put custom animated announcements in the beginning of posts based on date, categories or tags. - * Version: 1.3.2 + * Version: 1.3.4 * Author: Ran Bar-Zik * Author URI: http://internet-israel.com * Text Domain: wp-notice From 09d7288a2906d73b5ffc2b27e570e34ce2967688 Mon Sep 17 00:00:00 2001 From: Ran Bar-Zik Date: Sat, 12 Dec 2015 14:53:13 +0200 Subject: [PATCH 3/8] i18n for version 1.3.4 --- languages/wp-notice-he_IL.mo | Bin 3023 -> 3200 bytes languages/wp-notice-he_IL.po | 114 +++++++++++++++++++++-------------- 2 files changed, 70 insertions(+), 44 deletions(-) diff --git a/languages/wp-notice-he_IL.mo b/languages/wp-notice-he_IL.mo index b2425d537564b5feb4282cb49174fdbc57b7f97f..2511237ab3644e3db4e7978327655d247cef2601 100755 GIT binary patch delta 843 zcmX}q&r4KM6u|MLqoe7hWNzREfOw72CiD!B7`#Y`_zd-V4lm*dti(M$hx-`DBkaTw)oP(Pu?ojf7jT#61l~h^ zZw4EgU!HSujT?Dfq*{YI!4!=er>VvVs5`WPm++O>|AhSH3yp){a1v{oO$$ljJU+x* zc!2tTJJp4mU&gr56+gnuxZ(A8u#Nt244_37x+4+n#u3k_s1t3Wj{AsO&^9*VF6s{b zzzz&B=r+bMtDl)KAR&^)O9iQ+=iz_oq>UtXNIe-OPmyOx7E=s%|2TAe^(^SQI7zah z#j^rZqYa@26Qjk7bz8M!3M__xZ;d)qS0IClj5{YoZX!MB%1}C!l;NZs&!lEsTdq2G zY`{uBPF^pJmoE9bZ6{(omfh3e)7KewqS31HJCO-@AvK>$&qi*|es%}Lz=nJ9^g9RgrNJP@4Q%8eAhem4=qeN;kiQRHz z>tK?YIx!d|7>F47022RGt&^PlyQjU+Jd@-}^71V?cZ-Izl^7SO~4 zjN>J`u#O%0fKGhIc6>u!_l-J~n?ILu3@dCZk5THEHXXRkV!CO=D3=t*aSL;(jjnMI zYq*LDy66jvXyQ5QL^l}2uV(FMcN5er*onKy#8SdER#p1T9XHzO2lYY2^S2={4pE0t z8_nY+?%*08Ve^!vpPGS%p@bnDllNjPeB5Xcmi!0v$fj0(B)ug-c9X5p&FI\n" "Language-Team: \n" "Language: he_IL\n" @@ -20,113 +20,139 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SearchPath-0: .\n" -#: admin/class-wp-notice-admin.php:79 admin/class-wp-notice-admin.php:90 -#: public/class-wp-notice.php:82 public/class-wp-notice.php:93 +#: admin/class-wp-notice-admin.php:115 admin/class-wp-notice-admin.php:126 +#: public/class-wp-notice.php:98 public/class-wp-notice.php:109 msgid "Cheatin’ huh?" -msgstr "" +msgstr "לרמות זה לא יפה." -#: admin/class-wp-notice-admin.php:152 +#: admin/class-wp-notice-admin.php:175 msgid "Done" msgstr "בוצע" -#: admin/class-wp-notice-admin.php:153 +#: admin/class-wp-notice-admin.php:176 msgid "Today" msgstr "היום" -#: admin/class-wp-notice-admin.php:156 +#: admin/class-wp-notice-admin.php:179 msgid "Show a different month" msgstr "הראה חודש אחר" -#: admin/class-wp-notice-admin.php:184 +#: admin/class-wp-notice-admin.php:204 msgid "WP Notice Setting page" msgstr "מסך ההגדרות של WP Notice" -#: admin/class-wp-notice-admin.php:200 +#: admin/class-wp-notice-admin.php:205 +msgid "WP Notice" +msgstr "הודעות וורדפרס" + +#: admin/class-wp-notice-admin.php:224 msgid "Insert the notice and the conditions" msgstr "הכניסו את ההודעה ואת התנאים" -#: admin/class-wp-notice-admin.php:331 +#: admin/class-wp-notice-admin.php:374 msgid "WP Notice Settings Updated" msgstr "ההגדרות של WP Notice עודכנו" -#: admin/class-wp-notice-admin.php:333 +#: admin/class-wp-notice-admin.php:376 #, fuzzy msgid "WP Notice Error! You did change the form, right? please try again." msgstr "שגיאה ב Wp Notice אנא נסו שוב." -#: admin/class-wp-notice-admin.php:371 admin/class-wp-notice-admin.php:400 +#: admin/class-wp-notice-admin.php:420 admin/class-wp-notice-admin.php:451 msgid "Show in all posts that belongs to : " msgstr "הראה בכל הפוסטים ששייכים אל:" -#: admin/class-wp-notice-admin.php:373 +#: admin/class-wp-notice-admin.php:422 msgid "Do not use categories" msgstr "אל תשתמש בקטגוריות" -#: admin/class-wp-notice-admin.php:402 +#: admin/class-wp-notice-admin.php:453 msgid "Do not use tags" msgstr "אל תשתמש בתגיות" -#: admin/class-wp-notice-admin.php:427 +#: admin/class-wp-notice-admin.php:477 msgid "Select the style of the notice : " msgstr "בחרו את עיצוב ההודעה : " -#: admin/class-wp-notice-admin.php:455 +#: admin/class-wp-notice-admin.php:497 +msgid "Select icon for the notice : " +msgstr "בחרו אייקון שיופיע בהודעה" + +#: admin/class-wp-notice-admin.php:499 +#, fuzzy +msgid "Do not use font" +msgstr "אל תשתמש בתגיות" + +#: admin/class-wp-notice-admin.php:519 +#, fuzzy +msgid "Select position for the notice : " +msgstr "בחרו אייקון שיופיע בהודעה" + +#: admin/class-wp-notice-admin.php:521 +msgid "Before" +msgstr "לפני" + +#: admin/class-wp-notice-admin.php:522 +msgid "After" +msgstr "אחרי" + +#: admin/class-wp-notice-admin.php:523 +msgid "Both" +msgstr "גם וגם" + +#: admin/class-wp-notice-admin.php:550 +msgid "Select animation type : " +msgstr "בחרו את סוג האנימציה" + +#: admin/class-wp-notice-admin.php:552 +msgid "None" +msgstr "ללא" + +#: admin/class-wp-notice-admin.php:559 +msgid "Select animation duration (seconds) : " +msgstr "משך האנימציה בשניות" + +#: admin/class-wp-notice-admin.php:563 +msgid "Select animation repetition, -1 for infinite : " +msgstr "מספר החזרות. -1 עבור אינסוף" + +#: admin/class-wp-notice-admin.php:594 msgid "The Notice" msgstr "ההודעה" -#: admin/class-wp-notice-admin.php:456 +#: admin/class-wp-notice-admin.php:595 msgid "Show in all posts that were created before:" msgstr "הצג בכל הפוסטים שנוצרו לפני:" -#: admin/class-wp-notice-admin.php:457 +#: admin/class-wp-notice-admin.php:596 msgid "Insert the text of the notice here. It can be HTML or text string" msgstr "הכנס את הטקסט של ההודעה כאן. הטקסט יכול להיות HTML" -#: admin/class-wp-notice-admin.php:458 +#: admin/class-wp-notice-admin.php:597 #, fuzzy msgid "DD/MM/YYYY" msgstr "DD/MM/YY" -#: admin/class-wp-notice-admin.php:489 +#: admin/class-wp-notice-admin.php:639 msgid "Settings" msgstr "הגדרות" -#: admin/views/admin.php:26 +#: admin/views/admin.php:30 msgid "" "Please fill in the notice text and the proper conditions that need to be " "fulfilled in order to make the notice to appear" msgstr "אנא מלאו את ההודעה ואת התנאים שצריכים להתקיים על מנת שהיא תופיע" -#: admin/views/admin.php:27 +#: admin/views/admin.php:31 msgid "You can combine several conditions and create several notices" msgstr "אפשר לשלב מספר תנאים וליצור מספר הודעות" -#: admin/views/admin.php:32 +#: admin/views/admin.php:41 msgid "Submit" msgstr "שלח" msgid "Plugin to display notice and messages on posts" msgstr "תוסף להצגת הודעות ומסרים בפוסטים שונים" -msgid "Select icon for the notice : " -msgstr "בחרו אייקון שיופיע בהודעה" - -msgid "Select animation type : " -msgstr "בחרו את סוג האנימציה" - -msgid "None" -msgstr "ללא" - -msgid "Select animation duration (seconds) : " -msgstr "משך האנימציה בשניות" - -msgid "Select animation repetition, -1 for infinite : " -msgstr "מספר החזרות. -1 עבור אינסוף" - -#. Author of the plugin/theme msgid "Ran Bar-Zik " msgstr "רן בר-זיק " - -#. Plugin name -msgid "WP Notice" -msgstr "הודעות וורדפרס" From 12652ed33080cdc5511db08402b5c9bfc983027b Mon Sep 17 00:00:00 2001 From: Ran Bar-Zik Date: Sat, 12 Dec 2015 15:01:19 +0200 Subject: [PATCH 4/8] Fixing TravisCI build --- .travis.yml | 1 - tests/bin/install-wp-tests.sh | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1a7b44b..fbea45c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,5 +28,4 @@ before_script: - bash tests/bin/install-wp-tests.sh test root '' localhost $WP_VERSION script: - - phpcs --standard=WordPress ./**/*.php - phpunit \ No newline at end of file diff --git a/tests/bin/install-wp-tests.sh b/tests/bin/install-wp-tests.sh index 0d7ffad..9cb0b1b 100644 --- a/tests/bin/install-wp-tests.sh +++ b/tests/bin/install-wp-tests.sh @@ -171,6 +171,10 @@ run_phpcs() { npm install -g jshint phpcs --config-set installed_paths $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress phpcs -i + local FOLDER_PATH=$(dirname $DIR) + cd $FOLDER_PATH + npm install + grunt lint } install_wp From c34779bab4216c749210d1439a74913ae37f6886 Mon Sep 17 00:00:00 2001 From: Ran Bar-Zik Date: Sat, 12 Dec 2015 15:08:19 +0200 Subject: [PATCH 5/8] Fixing lint --- admin/class-wp-notice-admin.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/admin/class-wp-notice-admin.php b/admin/class-wp-notice-admin.php index 4e40c72..eeea80c 100755 --- a/admin/class-wp-notice-admin.php +++ b/admin/class-wp-notice-admin.php @@ -585,17 +585,17 @@ private function build_fieldset( $number = 0, $selected_tag = array(), $selected $text = '', $selected_style = 'wp-notice-regular', $selected_font = 'none', $selected_animation = array(), $selected_position = 'before' ) { - $category_list = $this->generate_category_list( $number, $selected_category ); - $tag_list = $this->generate_tag_list( $number, $selected_tag ); - $style_list = $this->generate_style_list( $number, $selected_style ); - $fonts_list = $this->generate_fonts_list( $number, $selected_font ); - $animation = $this->generate_animation( $number, $selected_animation ); - $position = $this->generate_position( $number, $selected_position ); - $text_label = __( 'The Notice', $this->plugin_slug ); - $time_label = __( 'Show in all posts that were created before:', $this->plugin_slug ); - $text_place_holder = __( 'Insert the text of the notice here. It can be HTML or text string', $this->plugin_slug ); - $time_place_holder = __( 'DD/MM/YYYY', $this->plugin_slug ); - $fieldset = <<generate_category_list( $number, $selected_category ); + $tag_list = $this->generate_tag_list( $number, $selected_tag ); + $style_list = $this->generate_style_list( $number, $selected_style ); + $fonts_list = $this->generate_fonts_list( $number, $selected_font ); + $animation = $this->generate_animation( $number, $selected_animation ); + $position = $this->generate_position( $number, $selected_position ); + $text_label = __( 'The Notice', $this->plugin_slug ); + $time_label = __( 'Show in all posts that were created before:', $this->plugin_slug ); + $text_place_holder = __( 'Insert the text of the notice here. It can be HTML or text string', $this->plugin_slug ); + $time_place_holder = __( 'DD/MM/YYYY', $this->plugin_slug ); + $fieldset = <<
@@ -624,7 +624,7 @@ private function build_fieldset( $number = 0, $selected_tag = array(), $selected EOD; - return $fieldset; + return $fieldset; } /** From 96ababb7fa35c7bf321e3c3f027c4316f60e1be2 Mon Sep 17 00:00:00 2001 From: Ran Bar-Zik Date: Sat, 12 Dec 2015 15:14:58 +0200 Subject: [PATCH 6/8] Fixing lint --- admin/class-wp-notice-admin.php | 4 ++-- public/class-wp-notice.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/class-wp-notice-admin.php b/admin/class-wp-notice-admin.php index eeea80c..b09219c 100755 --- a/admin/class-wp-notice-admin.php +++ b/admin/class-wp-notice-admin.php @@ -421,7 +421,7 @@ private function generate_category_list( $number = 0, $selected_category = array $category_list .= "