Changeset 1306886
- Timestamp:
- 12/12/2015 01:34:22 PM (10 years ago)
- Location:
- wp-notice/branches/develop
- Files:
-
- 2 edited
- 30 copied
-
. (copied) (copied from wp-notice/trunk)
-
Gruntfile.js (copied) (copied from wp-notice/trunk/Gruntfile.js)
-
README.md (copied) (copied from wp-notice/trunk/README.md) (1 diff)
-
README.txt (copied) (copied from wp-notice/trunk/README.txt) (4 diffs)
-
admin/assets/css/admin.css (copied) (copied from wp-notice/trunk/admin/assets/css/admin.css) (1 diff)
-
admin/assets/css/index.php (copied) (copied from wp-notice/trunk/admin/assets/css/index.php)
-
admin/assets/js/admin.js (copied) (copied from wp-notice/trunk/admin/assets/js/admin.js)
-
admin/assets/js/index.php (copied) (copied from wp-notice/trunk/admin/assets/js/index.php)
-
admin/class-wp-notice-admin.php (copied) (copied from wp-notice/trunk/admin/class-wp-notice-admin.php) (8 diffs)
-
admin/fonts.php (copied) (copied from wp-notice/trunk/admin/fonts.php)
-
admin/views/admin.php (copied) (copied from wp-notice/trunk/admin/views/admin.php)
-
admin/views/index.php (copied) (copied from wp-notice/trunk/admin/views/index.php)
-
includes/index.php (copied) (copied from wp-notice/trunk/includes/index.php)
-
languages/index.php (copied) (copied from wp-notice/trunk/languages/index.php)
-
languages/wp-notice-he_IL.mo (copied) (copied from wp-notice/trunk/languages/wp-notice-he_IL.mo)
-
languages/wp-notice-he_IL.po (copied) (copied from wp-notice/trunk/languages/wp-notice-he_IL.po) (4 diffs)
-
languages/wp-notice.pot (copied) (copied from wp-notice/trunk/languages/wp-notice.pot)
-
package.json (copied) (copied from wp-notice/trunk/package.json)
-
phpunit.xml (copied) (copied from wp-notice/trunk/phpunit.xml)
-
public/assets/css/index.php (copied) (copied from wp-notice/trunk/public/assets/css/index.php)
-
public/assets/css/public.css (copied) (copied from wp-notice/trunk/public/assets/css/public.css)
-
public/assets/index.php (copied) (copied from wp-notice/trunk/public/assets/index.php)
-
public/assets/source_css (copied) (copied from wp-notice/trunk/public/assets/source_css)
-
public/class-wp-notice.php (copied) (copied from wp-notice/trunk/public/class-wp-notice.php) (7 diffs)
-
public/views/index.php (copied) (copied from wp-notice/trunk/public/views/index.php)
-
public/views/public.php (copied) (copied from wp-notice/trunk/public/views/public.php)
-
tests/bin/install-wp-tests.sh (modified) (2 diffs)
-
tests/bin/router.php (modified) (1 diff)
-
tests/bootstrap.php (copied) (copied from wp-notice/trunk/tests/bootstrap.php)
-
tests/test_wp_notice_plugin_tests.php (copied) (copied from wp-notice/trunk/tests/test_wp_notice_plugin_tests.php) (3 diffs)
-
uninstall.php (copied) (copied from wp-notice/trunk/uninstall.php)
-
wp-notice.php (copied) (copied from wp-notice/trunk/wp-notice.php) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-notice/branches/develop/README.md
r1253593 r1306886 1 [](https://travis-ci.org/barzik/wp-notice) 2 3 https://travis-ci.org/barzik/wp-notice.svg 1 [](https://travis-ci.org/barzik/wp-notice) 4 2 5 3 # WP Notice 6 4 7 WP Notice plugin enable every admin to post animated announcement or messages on top ofposts based on tags, categories or date.5 WP Notice plugin enable every admin to post animated announcement or messages in posts based on tags, categories or date. 8 6 You can assign several messages for the several posts. There are several custom designs based on BootStrap styles. 9 7 Along with the styles, you can also add to every message one of hundreds icons based on Font Awesome repository and 10 also choose animation type, duration and number of repetition. 8 also choose animation type, duration and number of repetition. You can choose the position of the notices. 11 9 12 10 # Installation and other information -
wp-notice/branches/develop/README.txt
r1254423 r1306886 2 2 Contributors: barzik 3 3 Tags: notification, posts, obsolete, notice, messages, notice based on category, animation, font awesome 4 Requires at least: 3. 75 Tested up to: 4. 3.14 Requires at least: 3.8 5 Tested up to: 4.4 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 12 12 == Description == 13 13 14 WP Notice plugin enable every website manager to display animated announcement or messages on top ofposts based on tags, categories or date.15 You can assign several messages for the several posts. There are several custom designs based on TwitterBootStrap styles.14 WP Notice plugin enable every admin to post animated announcement or messages in posts based on tags, categories or date. 15 You can assign several messages for the several posts. There are several custom designs based on BootStrap styles. 16 16 Along with the styles, you can also add to every message one of hundreds icons based on Font Awesome repository and 17 also choose animation type, duration and number of repetition. You can preview the message with the animation before saving it.17 also choose animation type, duration and number of repetition. You can choose the position of the notices. 18 18 19 19 Ideal for technical sites that need to post deprecated notice on old posts and any other sites that need to show … … 59 59 60 60 == Changelog == 61 62 = 1.3.4 = 63 * Adding Position choice: before content, after content or both. 64 * Added PHPUnit test case. 65 * Removed tests from production to testing. 61 66 62 67 = 1.3.2 = … … 104 109 == Upgrade Notice == 105 110 111 = 1.3.4 = 112 * Adding Position choice: before content, after content or both. 113 * Added PHPUnit test case. 114 * Removed tests from production to testing. 115 106 116 = 1.3.2 = 107 117 Fix for issue with link being inserted to message and got malformed. -
wp-notice/branches/develop/admin/assets/css/admin.css
r1252797 r1306886 45 45 } 46 46 47 fieldset.wp_notice > div.wp_notice_position > label { 48 display: inline; 49 } 50 47 51 .wp_notice_animation.form-group > span { 48 52 display: inline-block; -
wp-notice/branches/develop/admin/class-wp-notice-admin.php
r1254423 r1306886 306 306 $wp_notice_options_raw['animation'][ $i ]['repeat'] = ''; 307 307 } 308 if ( isset( $wp_notice_options_raw['position'][ $i ] ) ) { 309 $wp_notice_options[ $i ]['position'] = sanitize_text_field( $wp_notice_options_raw['position'][ $i ] ); 310 } else { 311 $wp_notice_options[ $i ]['position'] = 'before'; 312 } 308 313 } 309 314 return $wp_notice_options; … … 391 396 $key, $wp_notice_option['tag'], $wp_notice_option['cat'], 392 397 $wp_notice_option['wp_notice_time'], $wp_notice_option['wp_notice_text'], $wp_notice_option['style'], 393 $wp_notice_option['font'], $wp_notice_option['animation'] 398 $wp_notice_option['font'], $wp_notice_option['animation'], $wp_notice_option['position'] 394 399 ); 395 400 } … … 417 422 $category_list .= "<option $all value='0'>".__( 'Do not use categories', $this->plugin_slug ).'</option>'; 418 423 foreach ( $categories as $cat ) { 419 if ( is_array( $selected_category ) && ! empty( $selected_category ) && in_array( $cat->term_id, $selected_category ) ) {424 if ( is_array( $selected_category ) && ! empty( $selected_category ) && in_array( $cat->term_id, $selected_category, true ) ) { 420 425 $selected = $cat->term_id; 421 426 } else { … … 449 454 foreach ( $tags as $tag ) { 450 455 $selected = ''; 451 if ( is_array( $selected_tag ) && ! empty( $selected_tag ) && in_array( $tag->term_id, $selected_tag ) ) {456 if ( is_array( $selected_tag ) && ! empty( $selected_tag ) && in_array( $tag->term_id, $selected_tag, true ) ) { 452 457 $selected = $tag->term_id; 453 458 } … … 499 504 500 505 return $font_list; 506 } 507 508 /** 509 * 510 * Generating the position list for the fieldset in the admin options menu 511 * 512 * @param int $number The serial ID of the fieldset. 513 * @param string $selected_position The position for the notice. 514 * @return string 515 */ 516 private function generate_position( $number = 0, $selected_position = 'befote' ) { 517 518 $position_list = ''; 519 $position_list .= "<label for='position_{$number}'>" . __( 'Select position for the notice : ', $this->plugin_slug ) . '</label>'; 520 $position_list .= "<select id='position_{$number}' name='position[{$number}]' class='wp_notice_position'>"; 521 $position_list .= '<option ' . selected( $selected_position, 'before', false ) . ' value="before">'. __( 'Before', $this->plugin_slug ) . '</option>'; 522 $position_list .= '<option ' . selected( $selected_position, 'after', false ) . ' value="after">'. __( 'After', $this->plugin_slug ) . '</option>'; 523 $position_list .= '<option ' . selected( $selected_position, 'both', false ) . ' value="both">'. __( 'Both', $this->plugin_slug ) . '</option>'; 524 $position_list .= '</select> '; 525 526 return $position_list; 501 527 } 502 528 … … 553 579 * @param string $selected_font The font string for fontAwsome. 554 580 * @param array $selected_animation Array for fonts. 581 * @param string $selected_position - The position of the notice. 555 582 * @return string 556 583 */ 557 584 private function build_fieldset( $number = 0, $selected_tag = array(), $selected_category = array(), $time = null, 558 $text = '', $selected_style = 'wp-notice-regular', $selected_font = 'none', $selected_animation = array() ) { 559 560 $category_list = $this->generate_category_list( $number, $selected_category ); 561 $tag_list = $this->generate_tag_list( $number, $selected_tag ); 562 $style_list = $this->generate_style_list( $number, $selected_style ); 563 $fonts_list = $this->generate_fonts_list( $number, $selected_font ); 564 $animation = $this->generate_animation( $number, $selected_animation ); 565 $text_label = __( 'The Notice', $this->plugin_slug ); 566 $time_label = __( 'Show in all posts that were created before:', $this->plugin_slug ); 567 $text_place_holder = __( 'Insert the text of the notice here. It can be HTML or text string', $this->plugin_slug ); 568 $time_place_holder = __( 'DD/MM/YYYY', $this->plugin_slug ); 569 $fieldset = <<<EOD 585 $text = '', $selected_style = 'wp-notice-regular', $selected_font = 'none', $selected_animation = array(), 586 $selected_position = 'before' ) { 587 588 $category_list = $this->generate_category_list( $number, $selected_category ); 589 $tag_list = $this->generate_tag_list( $number, $selected_tag ); 590 $style_list = $this->generate_style_list( $number, $selected_style ); 591 $fonts_list = $this->generate_fonts_list( $number, $selected_font ); 592 $animation = $this->generate_animation( $number, $selected_animation ); 593 $position = $this->generate_position( $number, $selected_position ); 594 $text_label = __( 'The Notice', $this->plugin_slug ); 595 $time_label = __( 'Show in all posts that were created before:', $this->plugin_slug ); 596 $text_place_holder = __( 'Insert the text of the notice here. It can be HTML or text string', $this->plugin_slug ); 597 $time_place_holder = __( 'DD/MM/YYYY', $this->plugin_slug ); 598 $fieldset = <<<EOD 570 599 <fieldset class="wp_notice" rel="$number"> 571 600 <div class="form-group"> … … 586 615 $animation 587 616 </div> 617 <div class="wp_notice_position form-group"> 618 $position 619 </div> 588 620 <div class="wp_notice_mock_example"> 589 621 <div class="wp_notice_message" id="wp_notice_message-$number"></div> … … 593 625 EOD; 594 626 595 return $fieldset;627 return $fieldset; 596 628 } 597 629 -
wp-notice/branches/develop/languages/wp-notice-he_IL.po
r1252797 r1306886 5 5 "Project-Id-Version: wp-notice 1\n" 6 6 "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n" 7 "POT-Creation-Date: 2015- 09-19 13:32+0200\n"8 "PO-Revision-Date: 2015- 09-24 18:50+0200\n"7 "POT-Creation-Date: 2015-12-12 14:49+0200\n" 8 "PO-Revision-Date: 2015-12-12 14:52+0200\n" 9 9 "Last-Translator: Ran Bar-Zik <[email protected]>\n" 10 10 "Language-Team: <[email protected]>\n" … … 21 21 "X-Poedit-SearchPath-0: .\n" 22 22 23 #: admin/class-wp-notice-admin.php: 79 admin/class-wp-notice-admin.php:9024 #: public/class-wp-notice.php: 82 public/class-wp-notice.php:9323 #: admin/class-wp-notice-admin.php:115 admin/class-wp-notice-admin.php:126 24 #: public/class-wp-notice.php:98 public/class-wp-notice.php:109 25 25 msgid "Cheatin’ huh?" 26 msgstr " "26 msgstr "לרמות זה לא יפה." 27 27 28 #: admin/class-wp-notice-admin.php:1 5228 #: admin/class-wp-notice-admin.php:175 29 29 msgid "Done" 30 30 msgstr "בוצע" 31 31 32 #: admin/class-wp-notice-admin.php:1 5332 #: admin/class-wp-notice-admin.php:176 33 33 msgid "Today" 34 34 msgstr "היום" 35 35 36 #: admin/class-wp-notice-admin.php:1 5636 #: admin/class-wp-notice-admin.php:179 37 37 msgid "Show a different month" 38 38 msgstr "הראה חודש אחר" 39 39 40 #: admin/class-wp-notice-admin.php: 18440 #: admin/class-wp-notice-admin.php:204 41 41 msgid "WP Notice Setting page" 42 42 msgstr "מסך ההגדרות של WP Notice" 43 43 44 #: admin/class-wp-notice-admin.php:200 44 #: admin/class-wp-notice-admin.php:205 45 msgid "WP Notice" 46 msgstr "הודעות וורדפרס" 47 48 #: admin/class-wp-notice-admin.php:224 45 49 msgid "Insert the notice and the conditions" 46 50 msgstr "הכניסו את ההודעה ואת התנאים" 47 51 48 #: admin/class-wp-notice-admin.php:3 3152 #: admin/class-wp-notice-admin.php:374 49 53 msgid "WP Notice Settings Updated" 50 54 msgstr "ההגדרות של WP Notice עודכנו" 51 55 52 #: admin/class-wp-notice-admin.php:3 3356 #: admin/class-wp-notice-admin.php:376 53 57 #, fuzzy 54 58 msgid "WP Notice Error! You did change the form, right? please try again." 55 59 msgstr "שגיאה ב Wp Notice אנא נסו שוב." 56 60 57 #: admin/class-wp-notice-admin.php: 371 admin/class-wp-notice-admin.php:40061 #: admin/class-wp-notice-admin.php:420 admin/class-wp-notice-admin.php:451 58 62 msgid "Show in all posts that belongs to : " 59 63 msgstr "הראה בכל הפוסטים ששייכים אל:" 60 64 61 #: admin/class-wp-notice-admin.php: 37365 #: admin/class-wp-notice-admin.php:422 62 66 msgid "Do not use categories" 63 67 msgstr "אל תשתמש בקטגוריות" 64 68 65 #: admin/class-wp-notice-admin.php:4 0269 #: admin/class-wp-notice-admin.php:453 66 70 msgid "Do not use tags" 67 71 msgstr "אל תשתמש בתגיות" 68 72 69 #: admin/class-wp-notice-admin.php:4 2773 #: admin/class-wp-notice-admin.php:477 70 74 msgid "Select the style of the notice : " 71 75 msgstr "בחרו את עיצוב ההודעה : " 72 76 73 #: admin/class-wp-notice-admin.php:455 77 #: admin/class-wp-notice-admin.php:497 78 msgid "Select icon for the notice : " 79 msgstr "בחרו אייקון שיופיע בהודעה" 80 81 #: admin/class-wp-notice-admin.php:499 82 #, fuzzy 83 msgid "Do not use font" 84 msgstr "אל תשתמש בתגיות" 85 86 #: admin/class-wp-notice-admin.php:519 87 #, fuzzy 88 msgid "Select position for the notice : " 89 msgstr "בחרו אייקון שיופיע בהודעה" 90 91 #: admin/class-wp-notice-admin.php:521 92 msgid "Before" 93 msgstr "לפני" 94 95 #: admin/class-wp-notice-admin.php:522 96 msgid "After" 97 msgstr "אחרי" 98 99 #: admin/class-wp-notice-admin.php:523 100 msgid "Both" 101 msgstr "גם וגם" 102 103 #: admin/class-wp-notice-admin.php:550 104 msgid "Select animation type : " 105 msgstr "בחרו את סוג האנימציה" 106 107 #: admin/class-wp-notice-admin.php:552 108 msgid "None" 109 msgstr "ללא" 110 111 #: admin/class-wp-notice-admin.php:559 112 msgid "Select animation duration (seconds) : " 113 msgstr "משך האנימציה בשניות" 114 115 #: admin/class-wp-notice-admin.php:563 116 msgid "Select animation repetition, -1 for infinite : " 117 msgstr "מספר החזרות. -1 עבור אינסוף" 118 119 #: admin/class-wp-notice-admin.php:594 74 120 msgid "The Notice" 75 121 msgstr "ההודעה" 76 122 77 #: admin/class-wp-notice-admin.php: 456123 #: admin/class-wp-notice-admin.php:595 78 124 msgid "Show in all posts that were created before:" 79 125 msgstr "הצג בכל הפוסטים שנוצרו לפני:" 80 126 81 #: admin/class-wp-notice-admin.php: 457127 #: admin/class-wp-notice-admin.php:596 82 128 msgid "Insert the text of the notice here. It can be HTML or text string" 83 129 msgstr "הכנס את הטקסט של ההודעה כאן. הטקסט יכול להיות HTML" 84 130 85 #: admin/class-wp-notice-admin.php: 458131 #: admin/class-wp-notice-admin.php:597 86 132 #, fuzzy 87 133 msgid "DD/MM/YYYY" 88 134 msgstr "DD/MM/YY" 89 135 90 #: admin/class-wp-notice-admin.php: 489136 #: admin/class-wp-notice-admin.php:639 91 137 msgid "Settings" 92 138 msgstr "הגדרות" 93 139 94 #: admin/views/admin.php: 26140 #: admin/views/admin.php:30 95 141 msgid "" 96 142 "Please fill in the notice text and the proper conditions that need to be " … … 98 144 msgstr "אנא מלאו את ההודעה ואת התנאים שצריכים להתקיים על מנת שהיא תופיע" 99 145 100 #: admin/views/admin.php: 27146 #: admin/views/admin.php:31 101 147 msgid "You can combine several conditions and create several notices" 102 148 msgstr "אפשר לשלב מספר תנאים וליצור מספר הודעות" 103 149 104 #: admin/views/admin.php: 32150 #: admin/views/admin.php:41 105 151 msgid "Submit" 106 152 msgstr "שלח" … … 109 155 msgstr "תוסף להצגת הודעות ומסרים בפוסטים שונים" 110 156 111 msgid "Select icon for the notice : "112 msgstr "בחרו אייקון שיופיע בהודעה"113 114 msgid "Select animation type : "115 msgstr "בחרו את סוג האנימציה"116 117 msgid "None"118 msgstr "ללא"119 120 msgid "Select animation duration (seconds) : "121 msgstr "משך האנימציה בשניות"122 123 msgid "Select animation repetition, -1 for infinite : "124 msgstr "מספר החזרות. -1 עבור אינסוף"125 126 #. Author of the plugin/theme127 157 msgid "Ran Bar-Zik <[email protected]>" 128 158 msgstr "רן בר-זיק <[email protected]>" 129 130 #. Plugin name131 msgid "WP Notice"132 msgstr "הודעות וורדפרס" -
wp-notice/branches/develop/public/class-wp-notice.php
r1254423 r1306886 182 182 foreach ( $messages_array as $key => $message ) { 183 183 $messages_html .= $this->create_message_block( $message['text'], $key, $message['style'], $message['font'], $message['animation'] ); 184 } 185 $content = $messages_html.$content; 184 switch ( $message['position'] ) { 185 case 'after': 186 $content = $content.$messages_html; 187 break; 188 case 'both': 189 $content = $messages_html.$content.$messages_html; 190 break; 191 default: 192 $content = $messages_html.$content; 193 break; 194 } 195 } 196 186 197 return $content; 187 198 } … … 243 254 if ( isset( $sort_option['tag'] ) && ! empty( $sort_option['tag'] ) ) { 244 255 foreach ( $sort_option['tag'] as $tag ) { 245 if ( in_array( $tag, $current_tags ) ) {246 $ messages[]= array(256 if ( in_array( $tag, $current_tags, true ) ) { 257 $temp_message = array( 247 258 'text' => $sort_option['wp_notice_text'], 248 259 'style' => $sort_option['style'], … … 250 261 'animation' => $sort_option['animation'], 251 262 ); 263 if ( isset( $sort_option['position'] ) ) { 264 $temp_message['position'] = $sort_option['position']; 265 } else { 266 $temp_message['position'] = 'before'; 267 } 268 $messages[] = $temp_message; 252 269 $found = true; 253 270 break; … … 262 279 if ( isset( $sort_option['cat'] ) && ! empty( $sort_option['cat'] ) ) { 263 280 foreach ( $sort_option['cat'] as $cat ) { 264 if ( in_array( $cat, $current_categories ) ) {265 $ messages[]= array(281 if ( in_array( $cat, $current_categories, true ) ) { 282 $temp_message = array( 266 283 'text' => $sort_option['wp_notice_text'], 267 284 'style' => $sort_option['style'], … … 269 286 'animation' => $sort_option['animation'], 270 287 ); 288 if ( isset( $sort_option['position'] ) ) { 289 $temp_message['position'] = $sort_option['position']; 290 } else { 291 $temp_message['position'] = 'before'; 292 } 293 $messages[] = $temp_message; 271 294 $found = true; 272 295 break; … … 283 306 $ts = $dt->getTimestamp(); 284 307 if ( $ts > get_the_time( 'U' ) ) { 285 $ messages[]= array(308 $temp_message = array( 286 309 'text' => $sort_option['wp_notice_text'], 287 310 'style' => $sort_option['style'], … … 289 312 'animation' => $sort_option['animation'], 290 313 ); 314 if ( isset( $sort_option['position'] ) ) { 315 $temp_message['position'] = $sort_option['position']; 316 } else { 317 $temp_message['position'] = 'before'; 318 } 319 $messages[] = $temp_message; 291 320 } 292 321 } -
wp-notice/branches/develop/tests/bin/install-wp-tests.sh
r1249165 r1306886 164 164 } 165 165 166 run_phpcs() { 167 pear config-set auto_discover 1 168 pear install PHP_CodeSniffer 169 git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress 170 phpenv rehash 171 npm install -g jshint 172 phpcs --config-set installed_paths $(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress 173 phpcs -i 174 local FOLDER_PATH=$(dirname $DIR) 175 cd $FOLDER_PATH 176 npm install 177 grunt lint 178 } 179 166 180 install_wp 167 181 install_test_suite … … 171 185 # install_rspec_requirements 172 186 start_server 187 run_phpcs -
wp-notice/branches/develop/tests/bin/router.php
r1244882 r1306886 1 1 <?php 2 /* 2 /** 3 * Router.php 4 * 3 5 * This is router for built-in php server. It is designed to use only for testing 4 6 * This frees us from installing apache or nginx in travis -
wp-notice/branches/develop/tests/test_wp_notice_plugin_tests.php
r1254423 r1306886 412 412 } 413 413 414 /** 415 * @group toextend 416 */ 417 418 function test_plugin_submit_notice_with_position() { 419 //Lets create some notice with date and assign to it animation 420 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 421 wp_set_current_user( $user->ID ); 422 // fetching options, validate it is empty 423 $wp_notice_settings = get_option( 'wp_notice_settings_information', array() ); 424 425 $this->assertEmpty( $wp_notice_settings ); 426 427 $i = 0; 428 $cat_id = $this->generate_category(); 429 // generate $_POST data 430 $this->create_valid_post_data( $i, $cat_id, NULL, NULL , 'wp-notice-regular', 'none', array('duration' => '', 'repeat' => '', 'type' => 'none'), 'after' ); 431 432 // checking the admin page with $_POST - should insert it to the options 433 $this->plugin_admin->display_plugin_admin_page(); 434 435 // fetching options, now it is not empty 436 $wp_notice_settings = get_option( 'wp_notice_settings_information', array() ); 437 438 $this->assertNotEmpty( $wp_notice_settings ); 439 440 $options_data = unserialize( $wp_notice_settings ); 441 $this->assertInternalType( 'array', $options_data[ $i ] ); 442 $this->assertEmpty( $options_data[ $i ]['wp_notice_time']); 443 $this->assertEmpty( $options_data[ $i ]['tag']); 444 $this->assertEquals( $options_data[ $i ]['position'], 'after'); 445 446 $this->assertEquals( $options_data[ $i ]['wp_notice_text'], 'This is <a href="http://www.google.com">notice</a> #'.$i.' message' ); 447 $this->assertEquals( $options_data[ $i ]['style'], 'wp-notice-regular' ); 448 $this->assertEquals( $options_data[ $i ]['font'], 'none' ); 449 $this->assertEquals( $options_data[ $i ]['position'], 'after' ); 450 451 // now test it with real post - it should not contain message and not errors 452 // notice, warnings and errors will drop tests - added convertErrorsToExceptions = "true" 453 //convertNoticesToExceptions = "true" 454 //convertWarningsToExceptions = "true" 455 // in phpunit.xml 456 // create one post 457 $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() ) ) ); 458 459 // go to this post 460 $this->go_to( get_permalink( $post_id ) ); 461 // fetch the content 462 $post_content_with_notice = get_echo( 'the_content' ); 463 464 } 465 414 466 415 467 function test_plugin_delete_all_options() { … … 494 546 495 547 496 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') ) {548 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' ) { 497 549 global $_POST; 498 550 … … 517 569 $_POST['animation'][ $i ] = $animation; 518 570 571 $_POST['position'][ $i ] = $position; 572 519 573 } 520 574 -
wp-notice/branches/develop/wp-notice.php
r1254423 r1306886 13 13 * Plugin URI: http://internet-israel.com 14 14 * Description: WP Notice Plugin enables admin to put custom animated announcements in the beginning of posts based on date, categories or tags. 15 * Version: 1.3. 215 * Version: 1.3.4 16 16 * Author: Ran Bar-Zik <[email protected]> 17 17 * Author URI: http://internet-israel.com
Note: See TracChangeset
for help on using the changeset viewer.