Skip to content

Commit

Permalink
Merge pull request #59 from fpcorso/3.7.1
Browse files Browse the repository at this point in the history
Version 3.7.1
  • Loading branch information
fpcorso committed Dec 9, 2014
2 parents 09a4c7c + b9c2756 commit 38d6d39
Show file tree
Hide file tree
Showing 13 changed files with 827 additions and 548 deletions.
Binary file added assets/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 5 additions & 8 deletions includes/mlw_adverts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function mlw_qmn_show_adverts()
$mlw_advert_text = "";
if ( get_option('mlw_advert_shows') == 'true' )
{
$mlw_random_int = rand(0, 8);
$mlw_random_int = rand(0, 7);
switch ($mlw_random_int) {
case 0:
$mlw_advert_text = "Need support or features? Check out our Premium Support options! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details!";
Expand All @@ -21,19 +21,16 @@ function mlw_qmn_show_adverts()
$mlw_advert_text = "Would you like to support this plugin but do not need or want premium support? Please consider our inexpensive 'Advertisements Be Gone' add-on which will get rid of these ads. Visit our <a href=\"http://mylocalwebstop.com/shop/\">Plugin Add-On Store</a> for details!";
break;
case 4:
$mlw_advert_text = "Need to be able to export the results of your quizzes? Be sure to check out our new Export Results add-on in our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a>!";
$mlw_advert_text = "Need help keeping your plugins, themes, and WordPress up to date? Want around the clock security monitoring and off-site back-ups? How about WordPress training videos, a monthly status report, and support/consultation? Check out our <a href=\"http://mylocalwebstop.com/wordpress-maintenance-services/\">WordPress Maintenance Services</a> for more details!";
break;
case 5:
$mlw_advert_text = "Need help keeping your plugins, themes, and WordPress up to date? Want around the clock security monitoring and off-site back-ups? How about WordPress training videos, a monthly status report, and support/consultation? Check out our <a href=\"http://mylocalwebstop.com/wordpress-maintenance-services/\">WordPress Maintenance Services</a> for more details!";
$mlw_advert_text = "Setting up a new site? Let us take care of the set-up so you back to running your business. Check out our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for more details!";
break;
case 6:
$mlw_advert_text = "Setting up a new site? Let us take care of the set-up so you back to running your business. Check out our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for more details!";
$mlw_advert_text = "Our new Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.";
break;
case 7:
$mlw_advert_text = "Need a page so your users can see their results from all the quizzes they have taken? Try our new User Dashboard add-on. Check out our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for more details!";
break;
case 8:
$mlw_advert_text = "Our new Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.";
$mlw_advert_text = "Please consider taking our survey so we can improve this add-on. The survey only takes a few minutes. When you are ready, please <a href='http://mylocalwebstop.com/quiz-master-next-survey/'>take our survey</a>";
break;
default:
$mlw_advert_text = "Need support or features? Check out our Premium Support options! Visit our <a href=\"http://mylocalwebstop.com/shop/\">Plugin Add-On Store</a> for details!";
Expand Down
1 change: 0 additions & 1 deletion includes/mlw_alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ public function showAlerts()
}

}
$mlwQmnAlertManager = new MlwQmnAlertManager();
?>
20 changes: 9 additions & 11 deletions includes/mlw_qmn_credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ function mlw_qmn_setTab(tab) {
<div class="mlw_qmn_icon_wrap">Version <?php echo $mlw_quiz_version; ?></div>
<h2 class="nav-tab-wrapper">
<a href="javascript:mlw_qmn_setTab(1);" id="mlw_qmn_tab_1" class="nav-tab nav-tab-active">
What&#8217;s New In 3.6</a>
What&#8217;s New In 3.7</a>
<a href="javascript:mlw_qmn_setTab(2);" id="mlw_qmn_tab_2" class="nav-tab">
Changelog For <?php echo $mlw_quiz_version; ?> </a>
<a href="javascript:mlw_qmn_setTab(3);" id="mlw_qmn_tab_3" class="nav-tab">
Requested Features</a>
</h2>
<div id="mlw_quiz_what_new">
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Separate Social Network Text Templates</h2>
<p style="text-align: center;">You can now customize the sharing text for each social network instead of having one for all of them.</p>
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Ability To Schedule When Quiz Is Active</h2>
<p style="text-align: center;">You can now set a time-frame of when the quiz is active. On the quiz options tab, you will see a spot to put in two dates. The quiz will now only be active during that time. Leave those fields blank to leave the quiz always active.</p>
<br />
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">New Developer Filters</h2>
<p style="text-align: center;">For the developers that like to extend this plugin's functionality, there are now two new filters for creating your own template variables.</p>
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">Please Take Our Survey To Better Improve This Plugin</h2>
<p style="text-align: center;">When you have a moment, please take our survey for this plugin. By filling out the survey, you are helping us improve this plugin. Users who take the survey between now and December 31st, 2014 will be emailed a 25% off coupon for our WordPress Store. When you are ready, please <a href='http://mylocalwebstop.com/quiz-master-next-survey/'>take our survey</a>.</p>
<br />
<h2 style="margin: 1.1em 0 .2em;font-size: 2.4em;font-weight: 300;line-height: 1.3;text-align: center;">We Are On GitHub Now</h2>
<p style="text-align: center;">We have had several users ask for this so we thought we would try it out. We now love github! Be sure to <a href="https://github.com/fpcorso/quiz_master_next/">make suggestions or contribute</a>.</p>
Expand All @@ -109,13 +109,11 @@ function mlw_qmn_setTab(tab) {
<p style="text-align: center;">Our Popular Add-On Pack is now only $45 for 6 add-ons! Now is the time to save almost 50%! Visit our <a href=\"http://mylocalwebstop.com/shop/\">WordPress Store</a> for details.</p>
</div>
<div id="mlw_quiz_changelog" style="display: none;">
<h3><?php echo $mlw_quiz_version; ?> (December 2, 2014)</h3>
<h3><?php echo $mlw_quiz_version; ?> (December 10, 2014)</h3>
<ul>
<li>* Add Separate Social Network Text Templates</li>
<li>* Added Hours Field To Timer And Completion Time</li>
<li>* Converted Quizzes Page To Use wpdb->update And wpdb->insert Instead Of query</li>
<li>* Created New Filter For Creating New Variables For Quiz Page</li>
<li>* Created New Filter For Creating New Variables For Results Page</li>
<li>* Added Ability To Schedule A Timeframe That The Quiz Is Active In</li>
<li>* In Backend: Moved Alert Class Inside Main Class</li>
<li>* In Backend: Created New Quiz Creator Class</li>
</ul>
</div>
<div id="mlw_quiz_requested" style="display: none;">
Expand Down
102 changes: 69 additions & 33 deletions includes/mlw_quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function mlw_quiz_shortcode($atts)
'quiz' => 0
), $atts));


date_default_timezone_set(get_option('timezone_string'));

/*
Code before loading the quiz
Expand Down Expand Up @@ -43,11 +43,32 @@ function mlw_quiz_shortcode($atts)
{
$mlw_message = htmlspecialchars_decode($mlw_quiz_options->require_log_in_text, ENT_QUOTES);
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $mlw_qmn_quiz_options_array);
$mlw_message = str_replace( "\n" , "<br>", $mlw_message);
$mlw_display = $mlw_message;
$mlw_display .= wp_login_form( array('echo' => false) );
return $mlw_display;
$mlw_qmn_isAllowed = false;
}
}

//Check if date is inside scheduled timeframe
if (is_serialized($mlw_quiz_options->scheduled_timeframe) && is_array(@unserialize($mlw_quiz_options->scheduled_timeframe)))
{
$qmn_scheduled_timeframe = @unserialize($mlw_quiz_options->scheduled_timeframe);
if ($qmn_scheduled_timeframe["start"] != '' && $qmn_scheduled_timeframe["end"] != '')
{
$qmn_scheduled_start = strtotime($qmn_scheduled_timeframe["start"]);
$qmn_scheduled_end = strtotime($qmn_scheduled_timeframe["end"]) + 86399; ///Added seconds to bring time to 11:59:59 PM of given day
if (time() < $qmn_scheduled_start | time() > $qmn_scheduled_end)
{
$mlw_message = htmlspecialchars_decode($mlw_quiz_options->scheduled_timeframe_text, ENT_QUOTES);
$mlw_message = apply_filters( 'mlw_qmn_template_variable_quiz_page', $mlw_message, $mlw_qmn_quiz_options_array);
$mlw_message = str_replace( "\n" , "<br>", $mlw_message);
$mlw_display = $mlw_message;
return $mlw_display;
$mlw_qmn_isAllowed = false;
}
}
}

//Check to see if there is limit on the amount of tries
if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() )
Expand Down Expand Up @@ -78,8 +99,12 @@ function mlw_quiz_shortcode($atts)
//Load and prepare answer arrays
$mlw_qmn_answer_arrays = array();
foreach($mlw_questions as $mlw_question_info) {
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
if ( !is_array($mlw_qmn_answer_array_each) )
if (is_serialized($mlw_question_info->answer_array) && is_array(@unserialize($mlw_question_info->answer_array)))
{
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
$mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
}
else
{
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
Expand All @@ -91,10 +116,6 @@ function mlw_quiz_shortcode($atts)
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
}
else
{
$mlw_qmn_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
}
}


Expand Down Expand Up @@ -209,10 +230,14 @@ function mlw_quiz_shortcode($atts)

//Gather text for pagination buttons
$mlw_qmn_pagination_text = "";
$mlw_qmn_pagination_text = @unserialize($mlw_quiz_options->pagination_text);
if (!is_array($mlw_qmn_pagination_text)) {
$mlw_qmn_pagination_text = array('Previous', $mlw_quiz_options->pagination_text);
}
if (is_serialized($mlw_quiz_options->pagination_text) && is_array(@unserialize($mlw_quiz_options->pagination_text)))
{
$mlw_qmn_pagination_text = @unserialize($mlw_quiz_options->pagination_text);
}
else
{
$mlw_qmn_pagination_text = array('Previous', $mlw_quiz_options->pagination_text);
}
?>
<script type="text/javascript">
setTimeout(function(){
Expand Down Expand Up @@ -513,8 +538,11 @@ function mlw_validateForm()

//Display the questions
foreach($mlw_questions as $mlw_question) {
$mlw_question_settings = @unserialize($mlw_question->question_settings);
if (!is_array($mlw_question_settings))
if (is_serialized($mlw_question->question_settings) && is_array(@unserialize($mlw_question->question_settings)))
{
$mlw_question_settings = @unserialize($mlw_question->question_settings);
}
else
{
$mlw_question_settings = array();
$mlw_question_settings['required'] = 1;
Expand Down Expand Up @@ -654,7 +682,7 @@ function mlw_validateForm()
$mlw_answer_total++;
if ($mlw_qmn_answer_each[0] != "")
{
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='".esc_attr($mlw_qmn_answer_each[0])."' /> ".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)." ";
$mlw_display .= "<input type='radio' id='question".$mlw_question->question_id."_".$mlw_answer_total."' name='question".$mlw_question->question_id."' value='".esc_attr($mlw_qmn_answer_each[0])."' /> <label for='question".$mlw_question->question_id."_".$mlw_answer_total."'>".htmlspecialchars_decode($mlw_qmn_answer_each[0], ENT_QUOTES)."</label> ";
}
}
$mlw_display .= "<input type='radio' style='display: none;' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_none' checked='checked' value='No Answer Provided' />";
Expand Down Expand Up @@ -901,8 +929,12 @@ function mlw_validateForm()
//Load and prepare answer arrays
$mlw_qmn_loaded_answer_arrays = array();
foreach($mlw_questions as $mlw_question_info) {
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
if ( !is_array($mlw_qmn_answer_array_each) )
if (is_serialized($mlw_question_info->answer_array) && is_array(@unserialize($mlw_question_info->answer_array)))
{
$mlw_qmn_answer_array_each = @unserialize($mlw_question_info->answer_array);
$mlw_qmn_loaded_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
}
else
{
$mlw_answer_array_correct = array(0, 0, 0, 0, 0, 0);
$mlw_answer_array_correct[$mlw_question_info->correct_answer-1] = 1;
Expand All @@ -914,10 +946,6 @@ function mlw_validateForm()
array($mlw_question_info->answer_five, $mlw_question_info->answer_five_points, $mlw_answer_array_correct[4]),
array($mlw_question_info->answer_six, $mlw_question_info->answer_six_points, $mlw_answer_array_correct[5]));
}
else
{
$mlw_qmn_loaded_answer_arrays[$mlw_question_info->question_id] = $mlw_qmn_answer_array_each;
}
}

//Variables needed for scoring
Expand Down Expand Up @@ -1095,11 +1123,14 @@ function mlw_validateForm()

//Prepare Certificate
$mlw_certificate_link = "";
$mlw_certificate_options = unserialize($mlw_quiz_options->certificate_template);
if (!is_array($mlw_certificate_options)) {
// something went wrong, initialize to empty array
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
}
if (is_serialized($mlw_quiz_options->certificate_template) && is_array(@unserialize($mlw_quiz_options->certificate_template)))
{
$mlw_certificate_options = unserialize($mlw_quiz_options->certificate_template);
}
else
{
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
}
if ($mlw_certificate_options[4] == 0)
{
$mlw_message_certificate = $mlw_certificate_options[1];
Expand Down Expand Up @@ -1139,9 +1170,9 @@ function mlw_validateForm()
-Second, check for array in case user has not updated
Message array = (array( bottomvalue, topvalue, text),array( bottomvalue, topvalue, text), etc..., array(0,0,text))
*/
$mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
if (is_array($mlw_message_after_array))
if (is_serialized($mlw_quiz_options->message_after) && is_array(@unserialize($mlw_quiz_options->message_after)))
{
$mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
//Cycle through landing pages
foreach($mlw_message_after_array as $mlw_each)
{
Expand Down Expand Up @@ -1218,9 +1249,13 @@ function mlw_qmn_share(network, mlw_qmn_social_text, mlw_qmn_title)
<?php
//Load Social Media Text
$qmn_social_media_text = "";
$qmn_social_media_text = @unserialize($mlw_quiz_options->social_media_text);
if (!is_array($qmn_social_media_text)) {
$qmn_social_media_text = array(
if (is_serialized($mlw_quiz_options->social_media_text) && is_array(@unserialize($mlw_quiz_options->social_media_text)))
{
$qmn_social_media_text = @unserialize($mlw_quiz_options->social_media_text);
}
else
{
$qmn_social_media_text = array(
'twitter' => $mlw_quiz_options->social_media_text,
'facebook' => $mlw_quiz_options->social_media_text
);
Expand All @@ -1246,9 +1281,10 @@ function mlw_qmn_share(network, mlw_qmn_social_text, mlw_qmn_title)
{
if ($mlw_user_email != "")
{
$mlw_user_email_array = @unserialize($mlw_quiz_options->user_email_template);
if (is_array($mlw_user_email_array))
if (is_serialized($mlw_quiz_options->user_email_template) && is_array(@unserialize($mlw_quiz_options->user_email_template)))
{
$mlw_user_email_array = @unserialize($mlw_quiz_options->user_email_template);

//Cycle through landing pages
foreach($mlw_user_email_array as $mlw_each)
{
Expand Down
Loading

0 comments on commit 38d6d39

Please sign in to comment.