Plugin Directory

Changeset 3343427


Ignore:
Timestamp:
08/12/2025 10:04:36 AM (8 months ago)
Author:
netprofit
Message:

make it more robust in error cases (missing files)

Location:
menu-skip-links
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • menu-skip-links

    • Property svn:ignore set to
      .idea
  • menu-skip-links/tags/1.0.1/menu-skip-links.php

    r3290349 r3343427  
    2121    $client_lang = sanitize_key(wp_unslash($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? $default_lang)); // unnecessary sanitization to pass plugin checks.
    2222    $lang = substr($client_lang, 0, 2);
    23     $text = json_decode(file_get_contents(plugin_dir_path(__FILE__) . '/text.json'), true);
    24     if (!array_key_exists($lang, $text)) $lang = $default_lang;
     23    $text = json_decode(file_get_contents(plugin_dir_path(__FILE__) . '/text.json') ?: "[]", true);
     24    if ($text == null || !array_key_exists($lang, $text)) $lang = $default_lang;
    2525
    2626    // add skip links to nav menus
  • menu-skip-links/trunk/menu-skip-links.php

    r3290349 r3343427  
    2121    $client_lang = sanitize_key(wp_unslash($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? $default_lang)); // unnecessary sanitization to pass plugin checks.
    2222    $lang = substr($client_lang, 0, 2);
    23     $text = json_decode(file_get_contents(plugin_dir_path(__FILE__) . '/text.json'), true);
    24     if (!array_key_exists($lang, $text)) $lang = $default_lang;
     23    $text = json_decode(file_get_contents(plugin_dir_path(__FILE__) . '/text.json') ?: "[]", true);
     24    if ($text == null || !array_key_exists($lang, $text)) $lang = $default_lang;
    2525
    2626    // add skip links to nav menus
Note: See TracChangeset for help on using the changeset viewer.