Wp-Pro-Quiz - Version 0.3

Version Description

  • added version number for js and css
Download this release

Release Info

Developer xeno010
Plugin Icon 128x128 Wp-Pro-Quiz
Version 0.3
Comparing to
See all releases

Code changes from version 0.2 to 0.3

js/wpProQuiz_admin.js CHANGED
@@ -178,7 +178,7 @@ jQuery(document).ready(function($) {
178
  saveSort: function() {
179
 
180
  var data = {
181
- action: 'update_sort',
182
  sort: methode.parseSortArray()
183
  };
184
 
178
  saveSort: function() {
179
 
180
  var data = {
181
+ action: 'wp_pro_quiz_update_sort',
182
  sort: methode.parseSortArray()
183
  };
184
 
js/wpProQuiz_admin.min.js CHANGED
@@ -3,7 +3,7 @@ break;case "free_answer":b.displayFreeAnswer();break;case "sort_answer":b.displa
3
  displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display","block")},displaySortAnswer:function(){a(".sort_answer").css("display","block")},addAnswer:function(c){a(c).siblings("ul").children().first().clone().css("display",
4
  "block").appendTo(a(c).siblings("ul"));b.setValueClassicAnswer();a(".deleteAnswer").click(function(){b.deleteAnswer(this)})},deleteAnswer:function(c){a(c).parent("li").remove();b.setValueClassicAnswer()},setValueClassicAnswer:function(){i=0;a('input[name="answerJson[classic_answer][correct][]"]').each(function(){this.value=i++})}},c=function(){var b=tinymce.editors.question.getContent(),c=a('input[name="answerType"]:checked');if(!b||0===b.length)return alert(wpProQuizLocalize.no_question_msg),!1;
5
  if("single"==c.val()||"multiple"==c.val()){var d=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){d=""!=a.trim(a(this).parent().siblings("textarea").val())?d&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!d)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("sort_answer"==c.val()&&(d=!1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){var b=a(this).val();d=!b||0===b.length?d|0:!0}),!d))return alert(wpProQuizLocalize.no_answer_msg),
6
- !1;return!0};b.setup();1>a('input[name="answerType"][checked="checked"]').size()&&a('input[name="answerType"][value="single"]').attr({checked:"checked"});a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change()};a.fn.wpProQuiz_questionOverall=function(){var b={saveSort:function(){var c={action:"update_sort",sort:b.parseSortArray()},e=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(e,c,function(b){console.debug(b);
7
  a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var b=[];a("tbody tr").each(function(){b.push(this.id.replace("wpProQuiz_questionId_",""))});return b},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:b.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),
8
  !1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();b.saveSort()});console.debug(a)};a.fn.wpProQuiz_quizEdit=function(){a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a("#statistics_on").change()};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();
9
  a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall()});
3
  displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display","block")},displaySortAnswer:function(){a(".sort_answer").css("display","block")},addAnswer:function(c){a(c).siblings("ul").children().first().clone().css("display",
4
  "block").appendTo(a(c).siblings("ul"));b.setValueClassicAnswer();a(".deleteAnswer").click(function(){b.deleteAnswer(this)})},deleteAnswer:function(c){a(c).parent("li").remove();b.setValueClassicAnswer()},setValueClassicAnswer:function(){i=0;a('input[name="answerJson[classic_answer][correct][]"]').each(function(){this.value=i++})}},c=function(){var b=tinymce.editors.question.getContent(),c=a('input[name="answerType"]:checked');if(!b||0===b.length)return alert(wpProQuizLocalize.no_question_msg),!1;
5
  if("single"==c.val()||"multiple"==c.val()){var d=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){d=""!=a.trim(a(this).parent().siblings("textarea").val())?d&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!d)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("sort_answer"==c.val()&&(d=!1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){var b=a(this).val();d=!b||0===b.length?d|0:!0}),!d))return alert(wpProQuizLocalize.no_answer_msg),
6
+ !1;return!0};b.setup();1>a('input[name="answerType"][checked="checked"]').size()&&a('input[name="answerType"][value="single"]').attr({checked:"checked"});a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change()};a.fn.wpProQuiz_questionOverall=function(){var b={saveSort:function(){var c={action:"wp_pro_quiz_update_sort",sort:b.parseSortArray()},e=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(e,c,function(b){console.debug(b);
7
  a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var b=[];a("tbody tr").each(function(){b.push(this.id.replace("wpProQuiz_questionId_",""))});return b},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:b.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),
8
  !1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();b.saveSort()});console.debug(a)};a.fn.wpProQuiz_quizEdit=function(){a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a("#statistics_on").change()};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();
9
  a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall()});
lib/controller/WpProQuiz_Controller_Admin.php CHANGED
@@ -10,11 +10,10 @@ class WpProQuiz_Controller_Admin {
10
  $this->_plugin_dir = $plugin_dir;
11
  $this->_plugin_file = $this->_plugin_dir.'/wp-pro-quiz.php';
12
 
13
- add_action('wp_ajax_update_sort', array($this, 'updateSort'));
14
  add_action('wp_ajax_wp_pro_quiz_statistics_save', array($this, 'statisticsSave'));
15
  add_action('wp_ajax_nopriv_wp_pro_quiz_statistics_save', array($this, 'statisticsSave'));
16
  add_action('admin_menu', array($this, 'register_page'));
17
- add_action('admin_enqueue_scripts', array($this, 'enqueueScript') );
18
  }
19
 
20
  public function updateSort() {
@@ -44,12 +43,14 @@ class WpProQuiz_Controller_Admin {
44
  }
45
 
46
  public function enqueueScript() {
 
 
 
 
 
 
47
 
48
- wp_enqueue_script('jquery');
49
- wp_enqueue_script('jquery-ui-sortable');
50
- wp_enqueue_script('wpProQuiz_admin_javascript', plugins_url('js/wpProQuiz_admin.min.js', $this->_plugin_file));
51
- $this->localizeScript();
52
-
53
  }
54
 
55
  public static function install() {
@@ -62,12 +63,14 @@ class WpProQuiz_Controller_Admin {
62
  }
63
 
64
  public function register_page() {
65
- add_menu_page(
66
- 'WP-Pro-Quiz',
67
- 'WP-Pro-Quiz',
68
- 'administrator',
69
- 'wpProQuiz',
70
- array($this, 'route'));
 
 
71
  }
72
 
73
  public function route() {
10
  $this->_plugin_dir = $plugin_dir;
11
  $this->_plugin_file = $this->_plugin_dir.'/wp-pro-quiz.php';
12
 
13
+ add_action('wp_ajax_wp_pro_quiz_update_sort', array($this, 'updateSort'));
14
  add_action('wp_ajax_wp_pro_quiz_statistics_save', array($this, 'statisticsSave'));
15
  add_action('wp_ajax_nopriv_wp_pro_quiz_statistics_save', array($this, 'statisticsSave'));
16
  add_action('admin_menu', array($this, 'register_page'));
 
17
  }
18
 
19
  public function updateSort() {
43
  }
44
 
45
  public function enqueueScript() {
46
+ wp_enqueue_script(
47
+ 'wpProQuiz_admin_javascript',
48
+ plugins_url('js/wpProQuiz_admin.min.js', $this->_plugin_file),
49
+ array('jquery', 'jquery-ui-sortable'),
50
+ WPPROQUIZ_VERSION
51
+ );
52
 
53
+ $this->localizeScript();
 
 
 
 
54
  }
55
 
56
  public static function install() {
63
  }
64
 
65
  public function register_page() {
66
+ $page = add_menu_page(
67
+ 'WP-Pro-Quiz',
68
+ 'WP-Pro-Quiz',
69
+ 'administrator',
70
+ 'wpProQuiz',
71
+ array($this, 'route'));
72
+
73
+ add_action('admin_print_scripts-'.$page, array($this, 'enqueueScript'));
74
  }
75
 
76
  public function route() {
lib/controller/WpProQuiz_Controller_Front.php CHANGED
@@ -16,15 +16,25 @@ class WpProQuiz_Controller_Front {
16
 
17
  public function loadDefaultScripts() {
18
  wp_enqueue_script('jquery');
19
- wp_enqueue_style('wpProQuiz_front_style', plugins_url('css/wpProQuiz_front.min.css', $this->_plugin_file));
 
 
 
 
 
 
20
  }
21
 
22
  public function shortcode($attr) {
23
  $id = $attr[0];
24
  $content = '';
25
 
26
- wp_enqueue_script('jquery-ui-sortable');
27
- wp_enqueue_script('wpProQuiz_front_javascript', plugins_url('js/wpProQuiz_front.min.js', $this->_plugin_file));
 
 
 
 
28
 
29
 
30
  if(is_numeric($id)) {
16
 
17
  public function loadDefaultScripts() {
18
  wp_enqueue_script('jquery');
19
+
20
+ wp_enqueue_style(
21
+ 'wpProQuiz_front_style',
22
+ plugins_url('css/wpProQuiz_front.min.css', $this->_plugin_file),
23
+ array(),
24
+ WPPROQUIZ_VERSION
25
+ );
26
  }
27
 
28
  public function shortcode($attr) {
29
  $id = $attr[0];
30
  $content = '';
31
 
32
+ wp_enqueue_script(
33
+ 'wpProQuiz_front_javascript',
34
+ plugins_url('js/wpProQuiz_front.min.js', $this->_plugin_file),
35
+ array('jquery-ui-sortable'),
36
+ WPPROQUIZ_VERSION
37
+ );
38
 
39
 
40
  if(is_numeric($id)) {
lib/controller/WpProQuiz_Controller_Preview.php CHANGED
@@ -12,11 +12,19 @@ class WpProQuiz_Controller_Preview extends WpProQuiz_Controller_Controller {
12
 
13
  public function route() {
14
 
15
- wp_enqueue_script('jquery');
16
- wp_enqueue_script('jquery-ui-sortable');
17
- wp_enqueue_script('wpProQuiz_fron_javascript', plugins_url('js/wpProQuiz_front.min.js', $this->_plugin_file));
 
 
 
18
 
19
- wp_enqueue_style('wpProQuiz_front_style', plugins_url('css/wpProQuiz_front.min.css', $this->_plugin_file));
 
 
 
 
 
20
 
21
  $this->showAction($_GET['id']);
22
  }
12
 
13
  public function route() {
14
 
15
+ wp_enqueue_script(
16
+ 'wpProQuiz_fron_javascript',
17
+ plugins_url('js/wpProQuiz_front.min.js', $this->_plugin_file),
18
+ array('jquery', 'jquery-ui-sortable'),
19
+ WPPROQUIZ_VERSION
20
+ );
21
 
22
+ wp_enqueue_style(
23
+ 'wpProQuiz_front_style',
24
+ plugins_url('css/wpProQuiz_front.min.css', $this->_plugin_file),
25
+ array(),
26
+ WPPROQUIZ_VERSION
27
+ );
28
 
29
  $this->showAction($_GET['id']);
30
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: xeno010
3
  Tags: quiz
4
  Requires at least: 3.3
5
  Tested up to: 3.4.2
6
- Stable tag: 0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -63,4 +63,7 @@ http://www.it-gecko.de/wp-pro-quiz-quiz-plugin-fuer-wordpress.html (scroll to "D
63
  = 0.2 =
64
  * bugfix
65
  * add statistics function
66
- * small changes
 
 
 
3
  Tags: quiz
4
  Requires at least: 3.3
5
  Tested up to: 3.4.2
6
+ Stable tag: 0.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
63
  = 0.2 =
64
  * bugfix
65
  * add statistics function
66
+ * small changes
67
+
68
+ = 0.3 =
69
+ * added version number for js and css
wp-pro-quiz.php CHANGED
@@ -3,11 +3,13 @@
3
  Plugin Name: WP-Pro-Quiz
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
5
  Description: A powerful and beautiful quiz plugin for WordPress.
6
- Version: 0.2
7
  Author: Julius Fischer
8
  Author URI: http://www.it-gecko.de
9
  */
10
 
 
 
11
  include_once 'lib/controller/WpProQuiz_Controller_Admin.php';
12
  include_once 'lib/helper/WpProQuiz_Helper_DbUpgrade.php';
13
 
3
  Plugin Name: WP-Pro-Quiz
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
5
  Description: A powerful and beautiful quiz plugin for WordPress.
6
+ Version: 0.3
7
  Author: Julius Fischer
8
  Author URI: http://www.it-gecko.de
9
  */
10
 
11
+ define('WPPROQUIZ_VERSION', '0.3');
12
+
13
  include_once 'lib/controller/WpProQuiz_Controller_Admin.php';
14
  include_once 'lib/helper/WpProQuiz_Helper_DbUpgrade.php';
15