Plugin Directory

Changeset 2385434


Ignore:
Timestamp:
09/21/2020 08:36:21 AM (5 years ago)
Author:
webhack
Message:

fix files ---

Location:
wha-crossword/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wha-crossword/trunk/readme.txt

    r2303235 r2385434  
    22=== Crossword Puzzles game ===
    33Contributors: webhelpagency
    4 Version: 1.1.8
     4Version: 1.1.9
    55Donate link: http://webhelpagency.com/
    66Tags: crossword, game, mind, puzzles
    77Requires at least: 4.0.1
    8 Tested up to: 5.4
     8Tested up to: 7.2
    99Requires PHP: 5.5
    1010License: GPLv2 or later
  • wha-crossword/trunk/wha-crossword.php

    r2303235 r2385434  
    44 * Plugin Name:       WHA Crossword
    55 * Description:       The plugin creates an easy crossword from the words of any combination.
    6  * Version:           1.1.8
     6 * Version:           1.1.9
    77 * Author:            WHA
    88 * Author URI:        http://webhelpagency.com/
     
    6464
    6565    wp_enqueue_script('crossword-script-admin', plugins_url('res/admin/crossword-admin.js', __FILE__), false, '1.0', true);
    66     wp_localize_script('crossword-script-admin', 'crossword_vars_admin', array(
    67         'whacw_use_global_options' => get_post_meta($post->ID, 'whacw_use_global_options', true),
    68         'clue' => __('Clue','wha-crossword'),
    69         'word' => __('Word','wha-crossword'),
    70 
    71     ));
     66
     67    if(!empty($post)):
     68
     69        wp_localize_script('crossword-script-admin', 'crossword_vars_admin', array(
     70            'whacw_use_global_options' => get_post_meta($post->ID, 'whacw_use_global_options', true),
     71            'clue' => __('Clue','wha-crossword'),
     72            'word' => __('Word','wha-crossword'),
     73        ));
     74    endif;
    7275
    7376    wp_enqueue_script('color-piker', plugins_url('res/admin/jscolor.js', __FILE__), false, '1.0', true);
     
    445448
    446449
    447 // Save data
    448 add_action('save_post', 'whacw_save_postdata');
    449 function whacw_save_postdata($post_id) {
    450 
    451     if (!wp_verify_nonce($_POST['myplugin_noncename'], plugin_basename(__FILE__)))
    452         return;
    453 
    454     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
    455         return;
    456 
    457     if (!current_user_can('edit_post', $post_id))
    458         return;
    459 
    460     $array = array();
    461     $questions = $_POST['wha-crossword-clue'];
    462     $words = $_POST['wha-crossword-word'];
    463 
    464     $whacw_color_background = htmlspecialchars($_POST['whacw_option_bg_color']);
    465     $whacw_color_border = htmlspecialchars($_POST['whacw_option_border_color']);
    466     $whacw_color_text = htmlspecialchars($_POST['whacw_option_text_color']);
    467     $whacw_color_question = htmlspecialchars($_POST['whacw_question_block_text_color']);
    468     $whacw_color_counter = htmlspecialchars($_POST['whacw_counter_color']);
    469     $whacw_correct_ansver = htmlspecialchars($_POST['whacw_highlight_correct_ansver']);
    470     $whacw_incorrect_ansver = htmlspecialchars($_POST['whacw_highlight_incorrect_ansver']);
    471     $whacw_align_question = htmlspecialchars($_POST['whacw_align_question']);
    472     $whacw_question_width = htmlspecialchars($_POST['whacw_question_width']);
    473     $whacw_congratulations_individual = $_POST['whacw_congratulations_individual'];
    474     $whacw_congratulations = $_POST['whacw_congratulations_message'];
    475     $whacw_use_global = htmlspecialchars($_POST['whacw_use_global_options']);
    476 
    477     $symbol = array("\\\"", "&", "!", "@", "#", "$", "^", "*", "\\", "(", ")", "-", "+", "%", "_", "|", "/", "(", ")", "=", ":", "[", "]");
    478 
    479     for ($i = 0; $i < count($questions); $i++) {
    480 
    481         $clue = str_replace($symbol, "", strip_tags($questions[$i]));
    482         $word = str_replace($symbol, "", strip_tags($words[$i]));
    483 
    484         $arr['clue'] = htmlspecialchars(str_replace(array("\\'"), "'", $clue), ENT_QUOTES);
    485         $arr['word'] = htmlspecialchars(str_replace(array("\\'"), "'", $word), ENT_QUOTES);
    486         $array[] = $arr;
    487     }
    488     $json = json_encode($array, JSON_UNESCAPED_UNICODE);
    489 
    490     update_post_meta($post_id, 'wha_crossword', $json);
    491     update_post_meta($post_id, 'whacw_option_bg_color', $whacw_color_background);
    492     update_post_meta($post_id, 'whacw_option_border_color', $whacw_color_border);
    493     update_post_meta($post_id, 'whacw_option_text_color', $whacw_color_text);
    494     update_post_meta($post_id, 'whacw_question_block_text_color', $whacw_color_question);
    495     update_post_meta($post_id, 'whacw_counter_color', $whacw_color_counter);
    496     update_post_meta($post_id, 'whacw_highlight_correct_ansver', $whacw_correct_ansver);
    497     update_post_meta($post_id, 'whacw_highlight_incorrect_ansver', $whacw_incorrect_ansver);
    498     update_post_meta($post_id, 'whacw_align_question', $whacw_align_question);
    499     update_post_meta($post_id, 'whacw_question_width', $whacw_question_width);
    500     update_post_meta($post_id, 'whacw_use_global_options', $whacw_use_global);
    501     update_post_meta($post_id, 'whacw_congratulations_message', $whacw_congratulations);
    502     update_post_meta($post_id, 'whacw_congratulations_individual', $whacw_congratulations_individual);
    503 }
     450/**
     451 * Save data
     452 */
     453if( ! function_exists('whacw_save_postdata' ) ) {
     454
     455    add_action('save_post', 'whacw_save_postdata', 10, 3);
     456
     457    function whacw_save_postdata($post_id, $post, $update) {
     458
     459        if( 'wha_crossword' === get_post_type($post_id) && $update === true && !in_array($post->post_status, ['trash','untrash']) ) {
     460
     461            if (@!wp_verify_nonce($_POST['myplugin_noncename'], plugin_basename(__FILE__)))
     462                return;
     463
     464            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
     465                return;
     466
     467            if (!current_user_can('edit_post', $post_id))
     468                return;
     469
     470            $array = array();
     471            $questions = $_POST['wha-crossword-clue'];
     472            $words = $_POST['wha-crossword-word'];
     473
     474            $whacw_color_background = htmlspecialchars($_POST['whacw_option_bg_color']);
     475            $whacw_color_border = htmlspecialchars($_POST['whacw_option_border_color']);
     476            $whacw_color_text = htmlspecialchars($_POST['whacw_option_text_color']);
     477            $whacw_color_question = htmlspecialchars($_POST['whacw_question_block_text_color']);
     478            $whacw_color_counter = htmlspecialchars($_POST['whacw_counter_color']);
     479            $whacw_correct_ansver = htmlspecialchars($_POST['whacw_highlight_correct_ansver']);
     480            $whacw_incorrect_ansver = htmlspecialchars($_POST['whacw_highlight_incorrect_ansver']);
     481            $whacw_align_question = htmlspecialchars($_POST['whacw_align_question']);
     482            $whacw_question_width = htmlspecialchars($_POST['whacw_question_width']);
     483            $whacw_congratulations_individual = $_POST['whacw_congratulations_individual'];
     484            $whacw_congratulations = @$_POST['whacw_congratulations_message'];
     485            $whacw_use_global = htmlspecialchars($_POST['whacw_use_global_options']);
     486
     487            $symbol = array("\\\"", "&", "!", "@", "#", "$", "^", "*", "\\", "(", ")", "-", "+", "%", "_", "|", "/", "(", ")", "=", ":", "[", "]");
     488
     489            for ($i = 0; $i < count($questions); $i++) {
     490
     491                $clue = str_replace($symbol, "", strip_tags($questions[$i]));
     492                $word = str_replace($symbol, "", strip_tags($words[$i]));
     493
     494                $arr['clue'] = htmlspecialchars(str_replace(array("\\'"), "'", $clue), ENT_QUOTES);
     495                $arr['word'] = htmlspecialchars(str_replace(array("\\'"), "'", $word), ENT_QUOTES);
     496                $array[] = $arr;
     497            }
     498            $json = json_encode($array, JSON_UNESCAPED_UNICODE);
     499
     500            update_post_meta($post_id, 'wha_crossword', $json);
     501            update_post_meta($post_id, 'whacw_option_bg_color', $whacw_color_background);
     502            update_post_meta($post_id, 'whacw_option_border_color', $whacw_color_border);
     503            update_post_meta($post_id, 'whacw_option_text_color', $whacw_color_text);
     504            update_post_meta($post_id, 'whacw_question_block_text_color', $whacw_color_question);
     505            update_post_meta($post_id, 'whacw_counter_color', $whacw_color_counter);
     506            update_post_meta($post_id, 'whacw_highlight_correct_ansver', $whacw_correct_ansver);
     507            update_post_meta($post_id, 'whacw_highlight_incorrect_ansver', $whacw_incorrect_ansver);
     508            update_post_meta($post_id, 'whacw_align_question', $whacw_align_question);
     509            update_post_meta($post_id, 'whacw_question_width', $whacw_question_width);
     510            update_post_meta($post_id, 'whacw_use_global_options', $whacw_use_global);
     511            update_post_meta($post_id, 'whacw_congratulations_message', $whacw_congratulations);
     512            update_post_meta($post_id, 'whacw_congratulations_individual', $whacw_congratulations_individual);
     513
     514        }
     515
     516    }
     517
     518}
     519
     520
    504521
    505522
Note: See TracChangeset for help on using the changeset viewer.