Changeset 1135656
- Timestamp:
- 04/15/2015 07:20:42 PM (11 years ago)
- Location:
- questions
- Files:
-
- 90 added
- 7 edited
-
tags/1.0.0 beta 7 (added)
-
tags/1.0.0 beta 7/README.txt (added)
-
tags/1.0.0 beta 7/assets (added)
-
tags/1.0.0 beta 7/assets/.DS_Store (added)
-
tags/1.0.0 beta 7/assets/banner-772x250.png (added)
-
tags/1.0.0 beta 7/assets/icon-128x128.png (added)
-
tags/1.0.0 beta 7/assets/icon-256x256.png (added)
-
tags/1.0.0 beta 7/assets/images (added)
-
tags/1.0.0 beta 7/assets/images/icon-dropdown.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-multiplechoice.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-onechoice.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-separator.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-split-form.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-text.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-textarea.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-textfield.png (added)
-
tags/1.0.0 beta 7/assets/images/icon-updown.png (added)
-
tags/1.0.0 beta 7/assets/images/loading-blue.gif (added)
-
tags/1.0.0 beta 7/assets/images/loading.gif (added)
-
tags/1.0.0 beta 7/assets/screenshot-1.png (added)
-
tags/1.0.0 beta 7/assets/screenshot-2.png (added)
-
tags/1.0.0 beta 7/assets/screenshot-3.png (added)
-
tags/1.0.0 beta 7/assets/screenshot-4.png (added)
-
tags/1.0.0 beta 7/assets/screenshot-5.png (added)
-
tags/1.0.0 beta 7/assets/screenshot-6.png (added)
-
tags/1.0.0 beta 7/assets/screenshot-7.png (added)
-
tags/1.0.0 beta 7/components (added)
-
tags/1.0.0 beta 7/components/admin (added)
-
tags/1.0.0 beta 7/components/admin/admin.php (added)
-
tags/1.0.0 beta 7/components/admin/includes (added)
-
tags/1.0.0 beta 7/components/admin/includes/js (added)
-
tags/1.0.0 beta 7/components/admin/includes/js/admin-questions-post-type.js (added)
-
tags/1.0.0 beta 7/components/admin/pages (added)
-
tags/1.0.0 beta 7/components/admin/pages/settings.php (added)
-
tags/1.0.0 beta 7/components/charts (added)
-
tags/1.0.0 beta 7/components/charts/chart-creator-c3.php (added)
-
tags/1.0.0 beta 7/components/charts/chart-creator-dimple.php (added)
-
tags/1.0.0 beta 7/components/charts/chart-creator.php (added)
-
tags/1.0.0 beta 7/components/charts/charts.php (added)
-
tags/1.0.0 beta 7/components/charts/data-abstraction.php (added)
-
tags/1.0.0 beta 7/components/charts/includes (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/d3 (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/d3/LICENSE (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/d3/d3.js (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/d3/d3.min.js (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/dimple (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/dimple/dimple.v2.1.0.js (added)
-
tags/1.0.0 beta 7/components/charts/includes/3rdparty/dimple/dimple.v2.1.0.min.js (added)
-
tags/1.0.0 beta 7/components/charts/shortcodes.php (added)
-
tags/1.0.0 beta 7/components/component.php (added)
-
tags/1.0.0 beta 7/components/core (added)
-
tags/1.0.0 beta 7/components/core/core.php (added)
-
tags/1.0.0 beta 7/components/core/export.php (added)
-
tags/1.0.0 beta 7/components/core/process-response.php (added)
-
tags/1.0.0 beta 7/components/core/questions.php (added)
-
tags/1.0.0 beta 7/components/core/shortcodes.php (added)
-
tags/1.0.0 beta 7/components/core/tools (added)
-
tags/1.0.0 beta 7/components/core/tools/post.php (added)
-
tags/1.0.0 beta 7/components/core/tools/survey.php (added)
-
tags/1.0.0 beta 7/components/element.php (added)
-
tags/1.0.0 beta 7/components/elements (added)
-
tags/1.0.0 beta 7/components/elements/description.php (added)
-
tags/1.0.0 beta 7/components/elements/dropdown.php (added)
-
tags/1.0.0 beta 7/components/elements/elements.php (added)
-
tags/1.0.0 beta 7/components/elements/multiplechoice.php (added)
-
tags/1.0.0 beta 7/components/elements/onechoice.php (added)
-
tags/1.0.0 beta 7/components/elements/separator.php (added)
-
tags/1.0.0 beta 7/components/elements/splitter.php (added)
-
tags/1.0.0 beta 7/components/elements/text.php (added)
-
tags/1.0.0 beta 7/components/elements/textarea.php (added)
-
tags/1.0.0 beta 7/components/survey.php (added)
-
tags/1.0.0 beta 7/functions.php (added)
-
tags/1.0.0 beta 7/includes (added)
-
tags/1.0.0 beta 7/includes/css (added)
-
tags/1.0.0 beta 7/includes/css/admin.css (added)
-
tags/1.0.0 beta 7/includes/css/display.css (added)
-
tags/1.0.0 beta 7/includes/css/fonts (added)
-
tags/1.0.0 beta 7/includes/css/fonts.css (added)
-
tags/1.0.0 beta 7/includes/css/fonts/questions.eot (added)
-
tags/1.0.0 beta 7/includes/css/fonts/questions.svg (added)
-
tags/1.0.0 beta 7/includes/css/fonts/questions.ttf (added)
-
tags/1.0.0 beta 7/includes/css/fonts/questions.woff (added)
-
tags/1.0.0 beta 7/init.php (added)
-
tags/1.0.0 beta 7/languages (added)
-
tags/1.0.0 beta 7/languages/plugin.po (added)
-
tags/1.0.0 beta 7/languages/questions-locale-de_DE.mo (added)
-
tags/1.0.0 beta 7/languages/questions-locale-de_DE.po (added)
-
tags/1.0.0 beta 7/testing (added)
-
tags/1.0.0 beta 7/testing/main.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/components/charts/shortcodes.php (modified) (2 diffs)
-
trunk/components/core/process-response.php (modified) (22 diffs)
-
trunk/components/core/shortcodes.php (modified) (1 diff)
-
trunk/init.php (modified) (8 diffs)
-
trunk/languages/questions-locale-de_DE.mo (modified) (previous)
-
trunk/languages/questions-locale-de_DE.po (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
questions/trunk/README.txt
r1131329 r1135656 66 66 == Changelog == 67 67 68 = 1.0.0 beta 7 = 69 * Fixed problems with errors on further steps 70 * Made (int) for steps 71 * Returning shortcode content and not echo it 72 * Changed collation of tables to utf8_general_ci 73 * Changed to more secure getting path function 74 * Fixed text mistake on separator 75 68 76 = 1.0.0 beta 6 = 69 77 * Fixed result charts bug -
questions/trunk/components/charts/shortcodes.php
r1131329 r1135656 62 62 endforeach; 63 63 64 echo$html;64 return $html; 65 65 } 66 66 … … 88 88 endforeach; 89 89 90 echo$html;90 return $html; 91 91 } 92 92 -
questions/trunk/components/core/process-response.php
r1131247 r1135656 50 50 } // end constructor 51 51 52 /** 53 * Adding filter for the content to show Survey 54 */ 52 55 public function add_post_filter(){ 53 56 add_filter( 'the_content', array( $this, 'the_content' ) ); 54 57 } 55 58 59 /** 60 * The filtered content gehts a survey 61 * @param string $content 62 * @return strint $content 63 */ 56 64 public function the_content( $content ){ 57 65 global $post, $questions_global; … … 67 75 } 68 76 77 /** 78 * Showing survey 79 * @param int $survey_id 80 * @return string $survey_html 81 */ 69 82 public function show_survey( $survey_id ){ 70 83 if( TRUE === $this->check_restrictions( $survey_id ) ): … … 74 87 endif; 75 88 } 76 89 90 /** 91 * Check restrictions 92 * 93 * Checking restrictions if user can participate 94 * 95 * @param int $survey_id 96 * @return boolean $can_participate 97 */ 77 98 private function check_restrictions( $survey_id ){ 78 99 $participiant_restrictions = get_post_meta( $survey_id, 'participiant_restrictions', TRUE ); … … 130 151 } 131 152 153 /** 154 * Survey form 155 * 156 * Creating form HTML 157 * 158 * @param int $survey_id 159 * @return string $html 160 */ 132 161 private function survey_form( $survey_id ){ 133 162 global $questions_response_errors, $questions_survey_id; … … 137 166 138 167 if( array_key_exists( 'questions_next_step', $_POST ) && 0 == count( $questions_response_errors ) ): 139 $next_step = $_POST[ 'questions_next_step' ];140 else: 141 $next_step = 0;168 $next_step = (int) $_POST[ 'questions_next_step' ]; 169 else: 170 $next_step = (int) $_POST[ 'questions_actual_step' ]; 142 171 endif; 143 172 144 173 if( array_key_exists( 'questions_submission_back', $_POST ) ): 145 $next_step = $_POST[ 'questions_actual_step' ] - 1;174 $next_step = (int) $_POST[ 'questions_actual_step' ] - 1; 146 175 endif; 147 176 … … 188 217 } 189 218 219 /** 220 * Checks if a user can participate 221 * @param int $survey_id 222 * @param int $user_id 223 * @return boolean $can_participate 224 */ 190 225 public function user_can_participate( $survey_id, $user_id = NULL ){ 191 226 global $wpdb, $current_user; … … 202 237 } 203 238 239 /** 240 * Get numer of spits in survey 241 * @param int $survey_id 242 * @return int $splitter_count 243 */ 204 244 private function get_step_count( $survey_id ){ 205 245 $survey = new Questions_Survey( $survey_id ); 206 246 return $survey->splitter_count; 207 247 } 208 248 249 /** 250 * Getting elements of a survey 251 * @param int $survey_id 252 * @param int $step 253 * @return array $elements 254 */ 209 255 public function get_elements( $survey_id, $step = 0 ){ 210 256 $survey = new Questions_Survey( $survey_id ); … … 225 271 return $elements[ $step ]; 226 272 } 227 273 274 /** 275 * Processing entered data 276 */ 228 277 public function process_response( $wp_object ){ 229 278 global $wpdb, $post, $questions_global, $questions_survey_id; … … 261 310 // Getting data of posted step 262 311 $survey_response = $_POST[ 'questions_response' ]; 263 $survey_actual_step = $_POST[ 'questions_actual_step' ];312 $survey_actual_step = (int) $_POST[ 'questions_actual_step' ]; 264 313 265 314 // Validating response values and setting up error variables … … 291 340 } 292 341 342 /** 343 * Saving response data 344 */ 293 345 private function save_response(){ 294 346 global $questions_response_errors, $questions_survey_id; … … 299 351 return; 300 352 301 if( $_POST[ 'questions_actual_step' ] ==$_POST[ 'questions_next_step' ] && 0 == count( $questions_response_errors ) && !array_key_exists( 'questions_submission_back', $_POST ) ):353 if( (int) $_POST[ 'questions_actual_step' ] == (int) $_POST[ 'questions_next_step' ] && 0 == count( $questions_response_errors ) && !array_key_exists( 'questions_submission_back', $_POST ) ): 302 354 $response = $_SESSION[ 'questions_response' ][ $questions_survey_id ]; 303 355 … … 315 367 } 316 368 369 /** 370 * Validating response 371 * @param int $survey_id 372 * @param array $response 373 * @param int $step 374 * @return boolean $validated 375 */ 317 376 public function validate_response( $survey_id, $response, $step ){ 318 377 global $questions_response_errors; … … 362 421 endforeach; 363 422 364 if( is_array( $questions_response_errors ) && array_key_exists( $element->id, $questions_response_errors) ):423 if( is_array( $questions_response_errors ) && array_key_exists( $element->id, $questions_response_errors ) ): 365 424 // ??? One Element at the end ??? 366 425 if( is_array( $questions_response_errors[ $element->id ] ) && count( $questions_response_errors[ $element->id ] ) == 0 ): … … 375 434 } 376 435 436 /** 437 * Sub function for save_response 438 * @param int $survey_id 439 * @param array $response 440 * @return boolean $saved 441 */ 377 442 private function save_data( $survey_id, $response ){ 378 443 global $wpdb, $questions_global, $current_user; … … 433 498 } 434 499 500 /** 501 * Has the user participated survey 502 * @param int $survey_id 503 * @param int $user_id 504 * @return boolean $has_participated 505 */ 435 506 public function has_participated( $questions_id, $user_id = NULL ){ 436 507 global $wpdb, $current_user, $questions_global; … … 456 527 } 457 528 529 /** 530 * Has IP already participated 531 * @param int $survey_id 532 * @return boolean $has_participated 533 */ 458 534 public function ip_has_participated( $questions_id ){ 459 535 global $wpdb, $questions_global; … … 471 547 } 472 548 549 /** 550 * Sending out finish email to participator 551 */ 473 552 public function email_finished(){ 474 553 global $post, $current_user; … … 492 571 } 493 572 573 /** 574 * Text which will be shown after a user has participated successful 575 * @param int $survey_id 576 * @return string $html 577 */ 494 578 public function text_thankyou_for_participation( $survey_id ){ 495 579 $show_results = get_post_meta( $survey_id, 'show_results', TRUE ); … … 507 591 } 508 592 593 /** 594 * Text which will be shown if a user has participated already 595 * @param int $survey_id 596 * @return string $html 597 */ 509 598 public function text_already_participated( $survey_id ){ 510 599 $show_results = get_post_meta( $survey_id, 'show_results', TRUE ); … … 520 609 } 521 610 611 /** 612 * Showing results 613 * @param int $survey_id 614 * @return string $html 615 */ 522 616 public function show_results( $survey_id ){ 523 617 $html = '<p>' . __( 'This are the actual results:', 'questions-locale' ) . '</p>'; 524 ob_start(); 525 do_shortcode( '[survey_results id="' . $survey_id . '"]' ); 526 $html.= ob_get_clean(); 618 $html.= do_shortcode( '[survey_results id="' . $survey_id . '"]' ); 527 619 528 620 return $html; 529 621 } 530 622 623 /** 624 * Text which will be shown if a user has to login to participate 625 * @return string $html 626 */ 531 627 public function text_not_logged_in(){ 532 628 $html = '<div id="questions-not-logged-in">'; … … 536 632 } 537 633 634 /** 635 * Text which will be shown if a user cant participate 636 * @return string $html 637 */ 538 638 public function text_cant_participate(){ 539 639 $html = '<div id="questions-cant-participate">'; … … 546 646 $Questions_ProcessResponse = new Questions_ProcessResponse(); 547 647 648 /** 649 * Checks if a user has participated on a survey 650 * @return int $survey_id 651 * @return boolean $has_participated 652 */ 548 653 function qu_user_has_participated( $questions_id, $user_id = NULL){ 549 654 global $Questions_ProcessResponse; -
questions/trunk/components/core/shortcodes.php
r1131247 r1135656 59 59 endif; 60 60 61 echo$Questions_ProcessResponse->show_survey( $atts[ 'id' ] );61 return $Questions_ProcessResponse->show_survey( $atts[ 'id' ] ); 62 62 } 63 63 -
questions/trunk/init.php
r1131329 r1135656 4 4 Plugin URI: http://www.awesome.ug 5 5 Description: Drag & drop your survey/poll with the WordPress Questions plugin. 6 Version: 1.0.0 beta 66 Version: 1.0.0 beta 7 7 7 Author: awesome.ug 8 8 Author URI: http://www.awesome.ug … … 97 97 type char(50) NOT NULL, 98 98 UNIQUE KEY id (id) 99 ) ";99 ) ENGINE = INNODB DEFAULT CHARSET = utf8;"; 100 100 101 101 dbDelta( $sql ); … … 108 108 sort int(11) NOT NULL, 109 109 UNIQUE KEY id (id) 110 ) ";110 ) ENGINE = INNODB DEFAULT CHARSET = utf8;"; 111 111 112 112 dbDelta( $sql ); … … 120 120 cookie_key char(30) NOT NULL, 121 121 UNIQUE KEY id (id) 122 ) ";122 ) ENGINE = INNODB DEFAULT CHARSET = utf8;"; 123 123 124 124 dbDelta( $sql ); … … 130 130 value text NOT NULL, 131 131 UNIQUE KEY id (id) 132 ) ";132 ) ENGINE = INNODB DEFAULT CHARSET = utf8;"; 133 133 134 134 dbDelta( $sql ); … … 140 140 value text NOT NULL, 141 141 UNIQUE KEY id (id) 142 ) ";142 ) ENGINE = INNODB DEFAULT CHARSET = utf8;"; 143 143 144 144 dbDelta( $sql ); … … 149 149 user_id int(11) NOT NULL, 150 150 UNIQUE KEY id (id) 151 )"; 152 153 dbDelta( $sql ); 151 ) ENGINE = INNODB DEFAULT CHARSET = utf8;"; 152 153 dbDelta( $sql ); 154 155 $sql = "ALTER TABLE $table_questions CONVERT TO CHARACTER SET utf8 collate utf8_general_ci;"; 156 $wpdb->query( $sql ); 157 158 $sql = "ALTER TABLE $table_answers CONVERT TO CHARACTER SET utf8 collate utf8_general_ci;"; 159 $wpdb->query( $sql ); 160 161 $sql = "ALTER TABLE $table_responds CONVERT TO CHARACTER SET utf8 collate utf8_general_ci;"; 162 $wpdb->query( $sql ); 163 164 $sql = "ALTER TABLE $table_respond_answers CONVERT TO CHARACTER SET utf8 collate utf8_general_ci;"; 165 $wpdb->query( $sql ); 166 167 $sql = "ALTER TABLE $table_participiants CONVERT TO CHARACTER SET utf8 collate utf8_general_ci;"; 168 $wpdb->query( $sql ); 169 170 $sql = "ALTER TABLE $table_settings CONVERT TO CHARACTER SET utf8 collate utf8_general_ci;"; 171 $wpdb->query( $sql ); 154 172 155 173 update_option( 'questions_db_version', '1.1.0' ); … … 264 282 */ 265 283 private static function get_folder(){ 266 $sub_folder = substr( dirname(__FILE__), strlen( ABSPATH ), ( strlen( dirname(__FILE__) ) - strlen( ABSPATH ) ) ); 267 $script_folder = ABSPATH . $sub_folder; 268 return $script_folder; 284 return plugin_dir_path( __FILE__ ); 269 285 } 270 286 -
questions/trunk/languages/questions-locale-de_DE.po
r1131247 r1135656 4 4 "Report-Msgid-Bugs-To: \n" 5 5 "POT-Creation-Date: 2015-04-09 15:39+0100\n" 6 "PO-Revision-Date: 2015-04-09 1 5:41+0100\n"6 "PO-Revision-Date: 2015-04-09 19:10+0100\n" 7 7 "Last-Translator: Sven Wagener <sven.wagener@rheinschmiede.de>\n" 8 8 "Language-Team: \n" … … 676 676 #: ../components/elements/separator.php:18 677 677 msgid "Separator" 678 msgstr "Separator n"678 msgstr "Separator" 679 679 680 680 # @ surveyval-locale
Note: See TracChangeset
for help on using the changeset viewer.