| @@ -10,14 +10,15 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace LearnPress\Models\Question; |
| 13 | 13 | |
| 14 | -use ClassPress\Helpers\Debug; | |
| 15 | 14 | use Exception; |
| 16 | 15 | use LearnPress\Databases\QuestionAnswersDB; |
| 17 | 16 | use LearnPress\Filters\QuestionAnswersFilter; |
| 17 | +use LearnPress\Helpers\Template; | |
| 18 | 18 | use LearnPress\Models\PostModel; |
| 19 | 19 | use LP_Cache; |
| 20 | +use LP_Debug; | |
| 20 | 21 | use LP_Question_Filter; |
| 21 | 22 | |
| 22 | 23 | class QuestionPostModel extends PostModel { |
| 23 | 24 | /** |
| @@ -90,9 +91,9 @@ | ||
| 90 | 91 | |
| 91 | 92 | $this->answer_options = $answer_options; |
| 92 | 93 | } |
| 93 | 94 | } catch ( Exception $e ) { |
| 94 | - Debug::error_log( $e ); | |
| 95 | + LP_Debug::error_log( $e ); | |
| 95 | 96 | } |
| 96 | 97 | |
| 97 | 98 | return $this->answer_options; |
| 98 | 99 | } |
| @@ -161,19 +162,8 @@ | ||
| 161 | 162 | return $this->question_type; |
| 162 | 163 | } |
| 163 | 164 | |
| 164 | 165 | /** |
| 165 | - * @param $question_type | |
| 166 | - * @return $this | |
| 167 | - */ | |
| 168 | - public function set_type($question_type) | |
| 169 | - { | |
| 170 | - $this->question_type = $question_type; | |
| 171 | - | |
| 172 | - return $this; | |
| 173 | - } | |
| 174 | - | |
| 175 | - /** | |
| 176 | 166 | * Check type question is valid |
| 177 | 167 | * |
| 178 | 168 | * @param string $type |
| 179 | 169 | * |
| @@ -208,9 +198,11 @@ | ||
| 208 | 198 | /** |
| 209 | 199 | * @return mixed |
| 210 | 200 | */ |
| 211 | 201 | public function get_hint() { |
| 212 | - return $this->get_meta_value_by_key( self::META_KEY_HINT, '' ); | |
| 202 | + return Template::sanitize_html_content( | |
| 203 | + (string) $this->get_meta_value_by_key( self::META_KEY_HINT, '' ) | |
| 204 | + ); | |
| 213 | 205 | } |
| 214 | 206 | |
| 215 | 207 | /** |
| 216 | 208 | * @return mixed |
| @@ -215,9 +207,11 @@ | ||
| 215 | 207 | /** |
| 216 | 208 | * @return mixed |
| 217 | 209 | */ |
| 218 | 210 | public function get_explanation() { |
| 219 | - return $this->get_meta_value_by_key( self::META_KEY_EXPLANATION, '' ); | |
| 211 | + return Template::sanitize_html_content( | |
| 212 | + (string) $this->get_meta_value_by_key( self::META_KEY_EXPLANATION, '' ) | |
| 213 | + ); | |
| 220 | 214 | } |
| 221 | 215 | |
| 222 | 216 | /** |
| 223 | 217 | * @return mixed |
| @@ -222,9 +216,9 @@ | ||
| 222 | 216 | /** |
| 223 | 217 | * @return mixed |
| 224 | 218 | */ |
| 225 | 219 | public function get_mark() { |
| 226 | - return $this->get_meta_value_by_key( self::META_KEY_MARK, 1 ); | |
| 220 | + return (float) $this->get_meta_value_by_key( self::META_KEY_MARK, 1 ); | |
| 227 | 221 | } |
| 228 | 222 | |
| 229 | 223 | /** |
| 230 | 224 | * Create default answers for question |