Plugin Directory

Changeset 3468087


Ignore:
Timestamp:
02/23/2026 11:12:11 PM (5 weeks ago)
Author:
Harmonic_Design
Message:

minor code cleanup

Location:
hd-quiz
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • hd-quiz/tags/2.0.10/assets/block/render.php

    r3448896 r3468087  
    55 */
    66
    7 $quizId = intval($attributes["quizId"]);
     7$quizId = intval($attributes["quizId"] ?? 0);
    88if ($quizId > 0) {
    99    echo do_shortcode('[HDquiz quiz = "' . esc_attr($quizId) . '"]');
  • hd-quiz/tags/2.0.10/classes/dashboard.php

    r3448896 r3468087  
    66    public $settings = array();
    77
    8     function __construct($flat = false)
     8    function __construct()
    99    {
    1010        $this->settings();
  • hd-quiz/tags/2.0.10/classes/question.php

    r3448896 r3468087  
    365365        }
    366366
    367         $res = $this->validateAccess($this->data);
     367        $res = $this->validateAccess();
    368368
    369369        if ($res !== false) {
     
    397397        }
    398398
    399         $res = $this->validateAccess($this->data);
     399        $res = $this->validateAccess();
    400400        if ($res !== false) {
    401401            return $res;
     
    504504        }
    505505
    506         $res = $this->validateAccess($this->data);
     506        $res = $this->validateAccess();
    507507        if ($res !== false) {
    508508            return $res;
  • hd-quiz/tags/2.0.10/classes/quiz.php

    r3448896 r3468087  
    621621        }
    622622
    623         $res = $this->validateAccess($this->data);
     623        $res = $this->validateAccess();
    624624
    625625        if ($res !== false) {
     
    858858        $this->term = get_term($this->quiz_id, "quiz");
    859859
    860         $res = $this->validateAccess($this->data);
     860        $res = $this->validateAccess();
    861861        if ($res !== false) {
    862862            return $res;
  • hd-quiz/tags/2.0.10/hdfields/classes/fields.php

    r3448896 r3468087  
    190190            $html .= '<div id = "hd_tab_content_' . esc_attr($tab["id"]) . '" class = "hd_tab_content_section ' . $active . '">';
    191191            $html .= '<h2 class="hd_tab_heading">' . esc_html($tab["label"]) . '</h2>';
    192             $html .= $this->render_fields($tab["children"], $tab["id"]);
     192            $html .= $this->render_fields($tab["children"]);
    193193            $html .= '</div>';
    194194            $i++;
  • hd-quiz/tags/2.0.10/index.php

    r3448896 r3468087  
    110110{
    111111    if (hdq_user_permission()) {
    112         function hdq_register_quizzes_page()
    113         {
    114             $addon_text = "";
    115             $new_addon = get_transient("hdq_new_addon");
    116             if ($new_addon === false) {
    117                 hdq_check_for_updates();
    118             } else {
    119                 $new_addon["isNew"] = sanitize_text_field($new_addon["isNew"]);
    120                 if ($new_addon["isNew"] === "yes") {
    121                     $addon_text = ' <span class="awaiting-mod">NEW</span>';
    122                 }
    123             }
    124 
    125             add_menu_page('HD Quiz', 'HD Quiz', 'publish_posts', 'hdq_quizzes', 'hdq_main_page', 'dashicons-clipboard', 5);
    126 
    127             add_submenu_page("hdq_quizzes", "HD Quiz Addons", __("Addons", "hd-quiz") . $addon_text, "delete_others_posts", "hdq_addons", "hdq_addons_page");
    128             add_submenu_page("hdq_quizzes", "HD Quiz Tools", __("Tools", "hd-quiz"), "manage_options", "hdq_tools", "hdq_tools_page");
    129             add_submenu_page("hdq_quizzes", "HD Quiz Settings", __("Settings", "hd-quiz"), "manage_options", 'hdq_options', 'hdq_about_settings_page');
    130 
    131             // tools, hidden pages
    132             add_submenu_page("", "CSV Importer", "CSV Importer", "manage_options", "hdq_importer", "hdq_tools_csv_importer");
     112        add_action('admin_menu', 'hdq_register_quizzes_page');
     113    }
     114}
     115add_action('init', 'hdq_create_settings_page');
     116
     117function hdq_register_quizzes_page()
     118{
     119    $addon_text = "";
     120    $new_addon = get_transient("hdq_new_addon");
     121    if ($new_addon === false) {
     122        hdq_check_for_updates();
     123    } else {
     124        $new_addon["isNew"] = sanitize_text_field($new_addon["isNew"]);
     125        if ($new_addon["isNew"] === "yes") {
     126            $addon_text = ' <span class="awaiting-mod">NEW</span>';
    133127        }
    134         add_action('admin_menu', 'hdq_register_quizzes_page');
    135     }
    136 }
    137 add_action('init', 'hdq_create_settings_page');
     128    }
     129
     130    add_menu_page('HD Quiz', 'HD Quiz', 'publish_posts', 'hdq_quizzes', 'hdq_main_page', 'dashicons-clipboard', 5);
     131
     132    add_submenu_page("hdq_quizzes", "HD Quiz Addons", __("Addons", "hd-quiz") . $addon_text, "delete_others_posts", "hdq_addons", "hdq_addons_page");
     133    add_submenu_page("hdq_quizzes", "HD Quiz Tools", __("Tools", "hd-quiz"), "manage_options", "hdq_tools", "hdq_tools_page");
     134    add_submenu_page("hdq_quizzes", "HD Quiz Settings", __("Settings", "hd-quiz"), "manage_options", 'hdq_options', 'hdq_about_settings_page');
     135
     136    // tools, hidden pages
     137    add_submenu_page("", "CSV Importer", "CSV Importer", "manage_options", "hdq_importer", "hdq_tools_csv_importer");
     138}
    138139
    139140/* Set custom plugin links on WP plugins page
  • hd-quiz/trunk/assets/block/render.php

    r3201067 r3468087  
    55 */
    66
    7 $quizId = intval($attributes["quizId"]);
     7$quizId = intval($attributes["quizId"] ?? 0);
    88if ($quizId > 0) {
    99    echo do_shortcode('[HDquiz quiz = "' . esc_attr($quizId) . '"]');
  • hd-quiz/trunk/classes/dashboard.php

    r3228552 r3468087  
    66    public $settings = array();
    77
    8     function __construct($flat = false)
     8    function __construct()
    99    {
    1010        $this->settings();
  • hd-quiz/trunk/classes/question.php

    r3228552 r3468087  
    365365        }
    366366
    367         $res = $this->validateAccess($this->data);
     367        $res = $this->validateAccess();
    368368
    369369        if ($res !== false) {
     
    397397        }
    398398
    399         $res = $this->validateAccess($this->data);
     399        $res = $this->validateAccess();
    400400        if ($res !== false) {
    401401            return $res;
     
    504504        }
    505505
    506         $res = $this->validateAccess($this->data);
     506        $res = $this->validateAccess();
    507507        if ($res !== false) {
    508508            return $res;
  • hd-quiz/trunk/classes/quiz.php

    r3288559 r3468087  
    621621        }
    622622
    623         $res = $this->validateAccess($this->data);
     623        $res = $this->validateAccess();
    624624
    625625        if ($res !== false) {
     
    858858        $this->term = get_term($this->quiz_id, "quiz");
    859859
    860         $res = $this->validateAccess($this->data);
     860        $res = $this->validateAccess();
    861861        if ($res !== false) {
    862862            return $res;
  • hd-quiz/trunk/hdfields/classes/fields.php

    r3201067 r3468087  
    190190            $html .= '<div id = "hd_tab_content_' . esc_attr($tab["id"]) . '" class = "hd_tab_content_section ' . $active . '">';
    191191            $html .= '<h2 class="hd_tab_heading">' . esc_html($tab["label"]) . '</h2>';
    192             $html .= $this->render_fields($tab["children"], $tab["id"]);
     192            $html .= $this->render_fields($tab["children"]);
    193193            $html .= '</div>';
    194194            $i++;
  • hd-quiz/trunk/index.php

    r3448821 r3468087  
    110110{
    111111    if (hdq_user_permission()) {
    112         function hdq_register_quizzes_page()
    113         {
    114             $addon_text = "";
    115             $new_addon = get_transient("hdq_new_addon");
    116             if ($new_addon === false) {
    117                 hdq_check_for_updates();
    118             } else {
    119                 $new_addon["isNew"] = sanitize_text_field($new_addon["isNew"]);
    120                 if ($new_addon["isNew"] === "yes") {
    121                     $addon_text = ' <span class="awaiting-mod">NEW</span>';
    122                 }
    123             }
    124 
    125             add_menu_page('HD Quiz', 'HD Quiz', 'publish_posts', 'hdq_quizzes', 'hdq_main_page', 'dashicons-clipboard', 5);
    126 
    127             add_submenu_page("hdq_quizzes", "HD Quiz Addons", __("Addons", "hd-quiz") . $addon_text, "delete_others_posts", "hdq_addons", "hdq_addons_page");
    128             add_submenu_page("hdq_quizzes", "HD Quiz Tools", __("Tools", "hd-quiz"), "manage_options", "hdq_tools", "hdq_tools_page");
    129             add_submenu_page("hdq_quizzes", "HD Quiz Settings", __("Settings", "hd-quiz"), "manage_options", 'hdq_options', 'hdq_about_settings_page');
    130 
    131             // tools, hidden pages
    132             add_submenu_page("", "CSV Importer", "CSV Importer", "manage_options", "hdq_importer", "hdq_tools_csv_importer");
     112        add_action('admin_menu', 'hdq_register_quizzes_page');
     113    }
     114}
     115add_action('init', 'hdq_create_settings_page');
     116
     117function hdq_register_quizzes_page()
     118{
     119    $addon_text = "";
     120    $new_addon = get_transient("hdq_new_addon");
     121    if ($new_addon === false) {
     122        hdq_check_for_updates();
     123    } else {
     124        $new_addon["isNew"] = sanitize_text_field($new_addon["isNew"]);
     125        if ($new_addon["isNew"] === "yes") {
     126            $addon_text = ' <span class="awaiting-mod">NEW</span>';
    133127        }
    134         add_action('admin_menu', 'hdq_register_quizzes_page');
    135     }
    136 }
    137 add_action('init', 'hdq_create_settings_page');
     128    }
     129
     130    add_menu_page('HD Quiz', 'HD Quiz', 'publish_posts', 'hdq_quizzes', 'hdq_main_page', 'dashicons-clipboard', 5);
     131
     132    add_submenu_page("hdq_quizzes", "HD Quiz Addons", __("Addons", "hd-quiz") . $addon_text, "delete_others_posts", "hdq_addons", "hdq_addons_page");
     133    add_submenu_page("hdq_quizzes", "HD Quiz Tools", __("Tools", "hd-quiz"), "manage_options", "hdq_tools", "hdq_tools_page");
     134    add_submenu_page("hdq_quizzes", "HD Quiz Settings", __("Settings", "hd-quiz"), "manage_options", 'hdq_options', 'hdq_about_settings_page');
     135
     136    // tools, hidden pages
     137    add_submenu_page("", "CSV Importer", "CSV Importer", "manage_options", "hdq_importer", "hdq_tools_csv_importer");
     138}
    138139
    139140/* Set custom plugin links on WP plugins page
Note: See TracChangeset for help on using the changeset viewer.