Changeset 1167167
- Timestamp:
- 05/25/2015 02:53:38 PM (11 years ago)
- Location:
- questions
- Files:
-
- 99 added
- 16 edited
-
tags/1.0.0 beta 13 (added)
-
tags/1.0.0 beta 13/.gitignore (added)
-
tags/1.0.0 beta 13/.project (added)
-
tags/1.0.0 beta 13/README.txt (added)
-
tags/1.0.0 beta 13/assets (added)
-
tags/1.0.0 beta 13/assets/.DS_Store (added)
-
tags/1.0.0 beta 13/assets/banner-772x250.png (added)
-
tags/1.0.0 beta 13/assets/icon-128x128.png (added)
-
tags/1.0.0 beta 13/assets/icon-256x256.png (added)
-
tags/1.0.0 beta 13/assets/images (added)
-
tags/1.0.0 beta 13/assets/images/icon-dropdown.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-multiplechoice.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-onechoice.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-separator.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-split-form.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-text.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-textarea.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-textfield.png (added)
-
tags/1.0.0 beta 13/assets/images/icon-updown.png (added)
-
tags/1.0.0 beta 13/assets/images/loading-blue.gif (added)
-
tags/1.0.0 beta 13/assets/images/loading.gif (added)
-
tags/1.0.0 beta 13/assets/screenshot-1.png (added)
-
tags/1.0.0 beta 13/assets/screenshot-2.png (added)
-
tags/1.0.0 beta 13/assets/screenshot-3.png (added)
-
tags/1.0.0 beta 13/assets/screenshot-4.png (added)
-
tags/1.0.0 beta 13/assets/screenshot-5.png (added)
-
tags/1.0.0 beta 13/assets/screenshot-6.png (added)
-
tags/1.0.0 beta 13/assets/screenshot-7.png (added)
-
tags/1.0.0 beta 13/components (added)
-
tags/1.0.0 beta 13/components/admin (added)
-
tags/1.0.0 beta 13/components/admin/admin.php (added)
-
tags/1.0.0 beta 13/components/admin/includes (added)
-
tags/1.0.0 beta 13/components/admin/includes/js (added)
-
tags/1.0.0 beta 13/components/admin/includes/js/admin-questions-post-type.js (added)
-
tags/1.0.0 beta 13/components/admin/pages (added)
-
tags/1.0.0 beta 13/components/admin/pages/settings.php (added)
-
tags/1.0.0 beta 13/components/charts (added)
-
tags/1.0.0 beta 13/components/charts/chart-creator-c3.php (added)
-
tags/1.0.0 beta 13/components/charts/chart-creator-dimple.php (added)
-
tags/1.0.0 beta 13/components/charts/chart-creator.php (added)
-
tags/1.0.0 beta 13/components/charts/charts.php (added)
-
tags/1.0.0 beta 13/components/charts/includes (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty/d3 (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty/d3/LICENSE (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty/d3/d3.js (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty/d3/d3.min.js (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty/dimple (added)
-
tags/1.0.0 beta 13/components/charts/includes/3rdparty/dimple/dimple.v2.1.2.min.js (added)
-
tags/1.0.0 beta 13/components/charts/shortcodes.php (added)
-
tags/1.0.0 beta 13/components/component.php (added)
-
tags/1.0.0 beta 13/components/core (added)
-
tags/1.0.0 beta 13/components/core/core.php (added)
-
tags/1.0.0 beta 13/components/core/data-abstraction.php (added)
-
tags/1.0.0 beta 13/components/core/export.php (added)
-
tags/1.0.0 beta 13/components/core/process-response.php (added)
-
tags/1.0.0 beta 13/components/core/questions.php (added)
-
tags/1.0.0 beta 13/components/core/shortcodes.php (added)
-
tags/1.0.0 beta 13/components/core/tools (added)
-
tags/1.0.0 beta 13/components/core/tools/post.php (added)
-
tags/1.0.0 beta 13/components/core/tools/survey.php (added)
-
tags/1.0.0 beta 13/components/element.php (added)
-
tags/1.0.0 beta 13/components/elements (added)
-
tags/1.0.0 beta 13/components/elements/description.php (added)
-
tags/1.0.0 beta 13/components/elements/dropdown.php (added)
-
tags/1.0.0 beta 13/components/elements/elements.php (added)
-
tags/1.0.0 beta 13/components/elements/multiplechoice.php (added)
-
tags/1.0.0 beta 13/components/elements/onechoice.php (added)
-
tags/1.0.0 beta 13/components/elements/separator.php (added)
-
tags/1.0.0 beta 13/components/elements/splitter.php (added)
-
tags/1.0.0 beta 13/components/elements/text.php (added)
-
tags/1.0.0 beta 13/components/elements/textarea.php (added)
-
tags/1.0.0 beta 13/components/survey.php (added)
-
tags/1.0.0 beta 13/functions.php (added)
-
tags/1.0.0 beta 13/includes (added)
-
tags/1.0.0 beta 13/includes/css (added)
-
tags/1.0.0 beta 13/includes/css/admin.css (added)
-
tags/1.0.0 beta 13/includes/css/display.css (added)
-
tags/1.0.0 beta 13/includes/css/fonts (added)
-
tags/1.0.0 beta 13/includes/css/fonts.css (added)
-
tags/1.0.0 beta 13/includes/css/fonts/questions.eot (added)
-
tags/1.0.0 beta 13/includes/css/fonts/questions.svg (added)
-
tags/1.0.0 beta 13/includes/css/fonts/questions.ttf (added)
-
tags/1.0.0 beta 13/includes/css/fonts/questions.woff (added)
-
tags/1.0.0 beta 13/init.php (added)
-
tags/1.0.0 beta 13/languages (added)
-
tags/1.0.0 beta 13/languages/plugin.po (added)
-
tags/1.0.0 beta 13/languages/questions-locale-de_DE.mo (added)
-
tags/1.0.0 beta 13/languages/questions-locale-de_DE.po (added)
-
tags/1.0.0 beta 13/languages/questions-locale-fa_IR.mo (added)
-
tags/1.0.0 beta 13/languages/questions-locale-fa_IR.po (added)
-
tags/1.0.0 beta 13/languages/questions-locale-nl_NL.mo (added)
-
tags/1.0.0 beta 13/languages/questions-locale-nl_NL.po (added)
-
tags/1.0.0 beta 13/languages/questions-locale-sv_SE.mo (added)
-
tags/1.0.0 beta 13/languages/questions-locale-sv_SE.po (added)
-
tags/1.0.0 beta 13/license.txt (added)
-
tags/1.0.0 beta 13/testing (added)
-
tags/1.0.0 beta 13/testing/main.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/components/charts/charts.php (modified) (1 diff)
-
trunk/components/core/core.php (modified) (1 diff)
-
trunk/components/core/data-abstraction.php (added)
-
trunk/components/core/process-response.php (modified) (23 diffs)
-
trunk/components/element.php (modified) (4 diffs)
-
trunk/components/elements/description.php (modified) (2 diffs)
-
trunk/components/elements/dropdown.php (modified) (1 diff)
-
trunk/components/elements/multiplechoice.php (modified) (1 diff)
-
trunk/components/elements/onechoice.php (modified) (1 diff)
-
trunk/components/elements/separator.php (modified) (1 diff)
-
trunk/components/elements/text.php (modified) (1 diff)
-
trunk/components/elements/textarea.php (modified) (1 diff)
-
trunk/components/survey.php (modified) (11 diffs)
-
trunk/functions.php (modified) (1 diff)
-
trunk/includes/css/display.css (modified) (4 diffs)
-
trunk/init.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
questions/trunk/README.txt
r1162710 r1167167 69 69 == Changelog == 70 70 71 = 1.0.0 beta 13 = 72 * Making Questions Multisite-Ready 73 * Flushing rewrite rules correct 74 * Added WP Editor to settings API 75 * Changed description editor to WP Editor 76 * Moved description text under question, before fields 77 * Fixed bug on double description output 78 * Bettered up Plugin CSS 79 * Enhanced code structure 80 71 81 = 1.0.0 beta 12 = 72 82 * Fixed exporting bug on exporting multiple choice fields results -
questions/trunk/components/charts/charts.php
r1140359 r1167167 55 55 56 56 public function includes(){ 57 include( QUESTIONS_COMPONENTFOLDER . '/charts/data-abstraction.php' );58 57 include( QUESTIONS_COMPONENTFOLDER . '/charts/chart-creator-dimple.php' ); 59 58 include( QUESTIONS_COMPONENTFOLDER . '/charts/shortcodes.php' ); -
questions/trunk/components/core/core.php
r1127623 r1167167 118 118 include( QUESTIONS_COMPONENTFOLDER . '/core/tools/post.php' ); 119 119 include( QUESTIONS_COMPONENTFOLDER . '/core/tools/survey.php' ); 120 include( QUESTIONS_COMPONENTFOLDER . '/core/data-abstraction.php' ); 120 121 } 121 122 -
questions/trunk/components/core/process-response.php
r1162557 r1167167 36 36 class Questions_ProcessResponse { 37 37 38 /** 39 * Survey id of processed survey 40 */ 38 41 var $survey_id; 39 42 40 var $response_errors = array(); 41 43 /** 44 * Is survey fineshed? 45 */ 42 46 var $finished = FALSE; 43 47 … … 48 52 /** 49 53 * Initializes the Component. 50 *51 54 * @since 1.0.0 52 55 */ … … 64 67 /** 65 68 * Adding filter for the content to show Survey 69 * @since 1.0.0 66 70 */ 67 71 public function add_post_filter() { … … 74 78 * 75 79 * @param string $content 76 *77 80 * @return string $content 81 * @since 1.0.0 78 82 */ 79 83 public function the_content( $content ) { … … 107 111 * 108 112 * @param int $survey_id 109 *110 113 * @return string $survey_html 114 * @since 1.0.0 111 115 */ 112 116 public function show_survey( $survey_id ) { … … 127 131 * 128 132 * @param int $survey_id 129 *130 133 * @return mixed $participate True 134 * @since 1.0.0 131 135 */ 132 136 private function check_restrictions( $survey_id ) { … … 229 233 * 230 234 * @param int $survey_id 231 *232 235 * @return string $html 236 * @since 1.0.0 233 237 */ 234 238 private function survey_form( $survey_id ) { … … 259 263 $step_count = $this->get_step_count( $survey_id ); 260 264 261 $html .= '<div class="questions- description">' . sprintf(265 $html .= '<div class="questions-pagination">' . sprintf( 262 266 __( 263 267 'Step <span class="questions-highlight-number">%d</span> of <span class="questions-highlight-number">%s</span>', … … 311 315 * @param int $survey_id 312 316 * @param int $user_id 313 *314 317 * @return boolean $can_participate 318 * @since 1.0.0 315 319 */ 316 320 public function user_can_participate( $survey_id, $user_id = NULL ) { … … 333 337 * 334 338 * @param int $survey_id 335 *336 339 * @return int $splitter_count 340 * @since 1.0.0 337 341 */ 338 342 private function get_step_count( $survey_id ) { … … 348 352 * @param int $survey_id 349 353 * @param int $step 350 *351 354 * @return array $elements 355 * @since 1.0.0 352 356 */ 353 357 public function get_elements( $survey_id, $step = 0 ) { … … 374 378 /** 375 379 * Processing entered data 380 * @since 1.0.0 376 381 */ 377 382 public function process_response() { … … 449 454 /** 450 455 * Saving response data 456 * @since 1.0.0 451 457 */ 452 458 private function save_response() { … … 487 493 * @param array $response 488 494 * @param int $step 489 *490 495 * @return boolean $validated 496 * @since 1.0.0 491 497 */ 492 498 public function validate_response( $survey_id, $response, $step ) { … … 569 575 * @param int $survey_id 570 576 * @param array $response 571 *572 577 * @return boolean $saved 578 * @since 1.0.0 573 579 */ 574 580 private function save_data( $survey_id, $response ) { … … 635 641 * Has the user participated survey 636 642 * 637 * @param $questions_id 638 * @param int $user_id 639 * 640 * @return bool $has_participated 643 * @param $questions_id 644 * @param int $user_id 645 * @return boolean $has_participated 641 646 * @internal param int $survey_id 647 * @since 1.0.0 642 648 */ 643 649 public function has_participated( $questions_id, $user_id = NULL ) { … … 673 679 * 674 680 * @param $questions_id 675 *676 681 * @return bool $has_participated 677 682 * @internal param int $survey_id 683 * @since 1.0.0 678 684 * 679 685 */ … … 699 705 /** 700 706 * Sending out finish email to participator 707 * @since 1.0.0 701 708 */ 702 709 public function email_finished() { … … 730 737 * 731 738 * @param int $survey_id 732 *733 739 * @return string $html 740 * @since 1.0.0 734 741 */ 735 742 public function text_thankyou_for_participation( $survey_id ) { … … 756 763 * 757 764 * @param int $survey_id 758 *759 765 * @return string $html 766 * @since 1.0.0 760 767 */ 761 768 public function text_already_participated( $survey_id ) { … … 781 788 * 782 789 * @return string $html 790 * @since 1.0.0 783 791 */ 784 792 public function text_not_logged_in() { … … 795 803 * 796 804 * @return string $html 805 * @since 1.0.0 797 806 */ 798 807 public function text_cant_participate() { … … 809 818 * 810 819 * @param int $survey_id 811 *812 820 * @return string $html 821 * @since 1.0.0 813 822 */ 814 823 public function show_results( $survey_id ) { -
questions/trunk/components/element.php
r1162557 r1167167 119 119 */ 120 120 var $create_answer_params = array(); 121 122 var $answer_is_multiple = FALSE; 121 123 122 124 /** … … 342 344 endif; 343 345 346 // Adding description 347 if ( ! empty( $this->settings[ 'description' ] ) ): 348 $html .= '<div class="questions-element-description">'; 349 $html .= $this->settings[ 'description' ]; 350 $html .= '</div>'; 351 endif; 352 344 353 // Fetching user response data 345 354 $this->get_response(); … … 347 356 $html .= '<div class="answer">'; 348 357 $html .= $this->input_html(); 349 350 // Adding description351 if ( ! empty( $this->settings[ 'description' ] ) ):352 $html .= '<p class="questions-element-description">';353 $html .= $this->settings[ 'description' ];354 $html .= '</p>';355 endif;356 357 358 $html .= '</div>'; 358 359 … … 709 710 710 711 $input = '<textarea name="' . $name . '">' . $value . '</textarea>'; 712 break; 713 714 case 'wp_editor': 715 $settings = array( 716 'textarea_name' => $name 717 ); 718 ob_start(); 719 wp_editor( $value, 'qu_wp_editor_' . md5( time() * rand() ), $settings ); 720 $input = ob_get_clean(); 711 721 break; 712 722 -
questions/trunk/components/elements/description.php
r1162557 r1167167 29 29 30 30 public function input_html() { 31 32 $html = '<div class="survey-element survey-element-' . $this->id . '">';33 $html .= '<div class="survey-description">' . $this->settings[ 'description' ] . '</div>';34 $html .= '</div>';35 36 return $html;37 31 } 38 32 … … 42 36 'description' => array( 43 37 'title' => esc_attr__( 'Text to show', 'questions-locale' ), 44 'type' => ' textarea',38 'type' => 'wp_editor', 45 39 'description' => esc_attr__( 'The text which will be shown in the form.', 'questions-locale' ), 46 40 'default' => '' -
questions/trunk/components/elements/dropdown.php
r1162557 r1167167 68 68 'description' => array( 69 69 'title' => esc_attr__( 'Description', 'questions-locale' ), 70 'type' => ' text',70 'type' => 'wp_editor', 71 71 'description' => esc_attr__( 'The description will be shown after the question.', 'questions-locale' ), 72 72 'default' => '' -
questions/trunk/components/elements/multiplechoice.php
r1162557 r1167167 63 63 'description' => array( 64 64 'title' => esc_attr__( 'Description', 'questions-locale' ), 65 'type' => ' text',65 'type' => 'wp_editor', 66 66 'description' => esc_attr__( 'The description will be shown after the question.', 'questions-locale' ), 67 67 'default' => '' -
questions/trunk/components/elements/onechoice.php
r1162557 r1167167 62 62 'description' => array( 63 63 'title' => esc_attr__( 'Description', 'questions-locale' ), 64 'type' => ' text',64 'type' => 'wp_editor', 65 65 'description' => esc_attr__( 'The description will be shown after the question.', 'questions-locale' ), 66 66 'default' => '' -
questions/trunk/components/elements/separator.php
r1162557 r1167167 46 46 'header' => array( 47 47 'title' => esc_attr__( 'Headline', 'questions-locale' ), 48 'type' => ' text',48 'type' => 'wp_editor', 49 49 'description' => esc_attr__( 'Text which will be shown above the separator', 'questions-locale' ), 50 50 'default' => '' -
questions/trunk/components/elements/text.php
r1162557 r1167167 38 38 'description' => array( 39 39 'title' => esc_attr__( 'Description', 'questions-locale' ), 40 'type' => ' text',40 'type' => 'wp_editor', 41 41 'description' => esc_attr__( 'The description will be shown after the question.', 'questions-locale' ), 42 42 'default' => '' -
questions/trunk/components/elements/textarea.php
r1162557 r1167167 39 39 'description' => array( 40 40 'title' => esc_attr__( 'Description', 'questions-locale' ), 41 'type' => ' text',41 'type' => 'wp_editor', 42 42 'description' => esc_attr__( 'The description will be shown after the question.', 'questions-locale' ), 43 43 'default' => '' -
questions/trunk/components/survey.php
r1162557 r1167167 27 27 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 28 28 */ 29 30 if ( ! defined( 'ABSPATH' ) ) { 31 exit; 32 } 33 29 34 class Questions_Survey { 30 35 31 36 /** 32 37 * @var int $id Survey ID 38 * @since 1.0.0 33 39 */ 34 40 public $id; … … 36 42 /** 37 43 * @var string $title Title of Survey 44 * @since 1.0.0 38 45 */ 39 46 public $title; … … 41 48 /** 42 49 * @var array $elements All elements of the survey 50 * @since 1.0.0 43 51 */ 44 52 public $elements = array(); … … 46 54 /** 47 55 * @var int $splitter_count Counter for form splitters 56 * @since 1.0.0 48 57 */ 49 58 public $splitter_count = 0; … … 51 60 /** 52 61 * Constructor 53 *54 62 * @param int $id The id of the survey 63 * @since 1.0.0 55 64 */ 56 65 public function __construct( $id = NULL ) { … … 63 72 /** 64 73 * Populating class variables 65 * 74 * 66 75 * @param int $id The id of the survey 76 * @since 1.0.0 67 77 */ 68 78 private function populate( $id ) { … … 80 90 /** 81 91 * Getting all element objects 82 * 92 * 83 93 * @param int $id The id of the survey 84 *85 94 * @return array $elements All element objects of the survey 95 * @since 1.0.0 86 96 */ 87 97 public function get_elements( $id = NULL ) { … … 126 136 /** 127 137 * Getting responses of a survey 128 * 138 * 129 139 * @param bool|int $element_id Get responses of a special element 130 140 * @param boolean $userdata Adding user specified data to response array 131 *132 141 * @return array $responses 142 * @since 1.0.0 133 143 */ 134 144 public function get_responses( $element_id = FALSE, $userdata = TRUE ) { … … 166 176 /** 167 177 * Gettiung all user ids of a survey 168 * 178 * 169 179 * @return array $responses All user ids formatted for response array 180 * @since 1.0.0 170 181 */ 171 182 private function get_response_user_ids() { … … 196 207 /** 197 208 * Gettiung all timestrings of a survey 198 * 209 * 199 210 * @param string $timeformat 200 *201 211 * @return array $responses All timestrings formatted for response array 212 * @since 1.0.0 202 213 */ 203 214 private function get_response_timestrings( $timeformat = 'd.m.Y H:i' ) { … … 225 236 return $responses; 226 237 } 227 228 // Need to be here?229 public function participated_survey( $user_id = NULL ) {230 231 global $wpdb, $current_user, $questions_global;232 233 if ( '' == $user_id ):234 get_currentuserinfo();235 $user_id = $user_id = $current_user->ID;236 endif;237 238 $sql = $wpdb->prepare( "SELECT id FROM {$questions_global->tables->responds} WHERE user_id=%s", $user_id );239 240 return $wpdb->get_col( $sql );241 }242 238 } 243 239 240 /** 241 * Checks if a survey exists 242 * 243 * @param int $survey_id Survey id 244 * @return boolean $exists TRUE if survey exists, FALSE if not 245 */ 244 246 function qu_survey_exists( $survey_id ) { 245 247 -
questions/trunk/functions.php
r1161504 r1167167 222 222 $data = trim( $data ); 223 223 $data = stripslashes( $data ); 224 $data = htmlspecialchars( $data );225 224 return $data; 226 225 } -
questions/trunk/includes/css/display.css
r1161504 r1167167 1 1 /* This stylesheet is used to style the public view of the plugin. */ 2 /** 3 * Survey Element 4 */ 2 5 #questions .survey-element{ 3 6 margin-bottom:20px; 4 7 } 5 8 #questions .survey-element p{ 6 margin:0; 7 font-size:0.9em; 9 margin:5px; 8 10 } 9 #questions .survey-element h3, 10 #questions .survey-element h5{ 11 margin: 0 0 10px 0; 11 #questions .survey-element > h3, 12 #questions .survey-element > h5, 13 #questions .survey-element > div 14 { 15 margin-bottom:10px; 12 16 } 13 17 #questions .survey-element hr{ … … 16 20 border-radius: 3px; 17 21 } 18 #questions .questions-description{ 22 /** 23 * Pagination 24 */ 25 #questions .questions-pagination{ 19 26 margin-bottom: 20px; 20 27 } 21 #questions .questions- description span.questions-highlight-number{28 #questions .questions-pagination span.questions-highlight-number{ 22 29 border-radius: 3px; 23 30 background-color: #CCC; … … 25 32 color:#FFF; 26 33 } 34 /** 35 * Errors 36 */ 27 37 #questions .questions-element-error{ 28 38 border: 1px dashed #F00; … … 41 51 margin: 0 0 0 20px; 42 52 } 53 /** 54 * ? 55 */ 43 56 #questions table.questions-range-table{ 44 57 width:auto; -
questions/trunk/init.php
r1162710 r1167167 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 1 26 * Version: 1.0.0 beta 13 7 7 * Author: awesome.ug 8 8 * Author URI: http://www.awesome.ug … … 39 39 register_deactivation_hook( __FILE__, array( __CLASS__, 'deactivate' ) ); 40 40 register_uninstall_hook( __FILE__, array( __CLASS__, 'uninstall' ) ); 41 42 // If plugin isn't installed, install it now 43 if( !self::is_installed() ) 44 add_action( 'init', array( __CLASS__, 'install_plugin' ), 100 ); 41 45 42 46 // Functions on Frontend … … 75 79 */ 76 80 public static function activate( $network_wide ) { 77 78 81 global $wpdb; 79 82 83 self::install_tables(); 84 } // end activate 85 86 /** 87 * Is plugin already installed? 88 */ 89 public static function is_installed(){ 90 global $wpdb; 91 92 $tables = array( 93 $wpdb->prefix . 'questions_questions', 94 $wpdb->prefix . 'questions_answers', 95 $wpdb->prefix . 'questions_responds', 96 $wpdb->prefix . 'questions_respond_answers', 97 $wpdb->prefix . 'questions_settings', 98 $wpdb->prefix . 'questions_participiants' 99 ); 100 101 // Checking if all tables are existing 102 $not_found = FALSE; 103 foreach( $tables AS $table ): 104 if( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) != $table ): 105 $not_found = TRUE; 106 endif; 107 endforeach; 108 109 $is_installed_option = (boolean) get_option( 'questions_is_installed', FALSE ); 110 111 if( $not_found || FALSE == $is_installed_option ) 112 return FALSE; 113 114 return TRUE; 115 } 116 117 /** 118 * Installing plugin 119 */ 120 public static function install_plugin(){ 121 self::install_tables(); 122 flush_rewrite_rules(); 123 update_option( 'questions_is_installed', TRUE ); 124 } 125 126 /** 127 * Creating / Updating tables 128 */ 129 public static function install_tables(){ 130 global $wpdb; 131 80 132 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 81 133 … … 169 221 170 222 update_option( 'questions_db_version', '1.1.0' ); 171 172 } // end activate 223 } 173 224 174 225 /** … … 179 230 */ 180 231 public static function deactivate( $network_wide ) { 232 233 delete_option( 'questions_is_installed' ); 181 234 } // end deactivate 182 235
Note: See TracChangeset
for help on using the changeset viewer.