PMA\libraries\Util::getMySQLDocuURL PHP Méthode

getMySQLDocuURL() public static méthode

Get a URL link to the official MySQL documentation
public static getMySQLDocuURL ( string $link, string $anchor = '' ) : string
$link string contains name of page/anchor that is being linked
$anchor string anchor to page part
Résultat string the URL link
    public static function getMySQLDocuURL($link, $anchor = '')
    {
        // Fixup for newly used names:
        $link = str_replace('_', '-', mb_strtolower($link));
        if (empty($link)) {
            $link = 'index';
        }
        $mysql = '5.5';
        $lang = 'en';
        if (defined('PMA_MYSQL_INT_VERSION')) {
            if (PMA_MYSQL_INT_VERSION >= 50700) {
                $mysql = '5.7';
            } elseif (PMA_MYSQL_INT_VERSION >= 50600) {
                $mysql = '5.6';
            } elseif (PMA_MYSQL_INT_VERSION >= 50500) {
                $mysql = '5.5';
            }
        }
        $url = 'https://dev.mysql.com/doc/refman/' . $mysql . '/' . $lang . '/' . $link . '.html';
        if (!empty($anchor)) {
            $url .= '#' . $anchor;
        }
        return PMA_linkURL($url);
    }

Usage Example

 /**
  * Creates the code for displaying the links
  * at the top of the navigation panel
  *
  * @return string HTML code for the links
  */
 private function _links()
 {
     // always iconic
     $showIcon = true;
     $showText = false;
     $retval = '<!-- LINKS START -->';
     $retval .= '<div id="navipanellinks">';
     $retval .= PMA\libraries\Util::getNavigationLink('index.php' . URL::getCommon(), $showText, __('Home'), $showIcon, 'b_home.png');
     // if we have chosen server
     if ($GLOBALS['server'] != 0) {
         // Logout for advanced authentication
         if ($GLOBALS['cfg']['Server']['auth_type'] != 'config') {
             $text = __('Log out');
         } else {
             $text = __('Empty session data');
         }
         $link = 'logout.php' . $GLOBALS['url_query'];
         $retval .= PMA\libraries\Util::getNavigationLink($link, $showText, $text, $showIcon, 's_loggoff.png', '', true, '', array('logout'));
     }
     $retval .= PMA\libraries\Util::getNavigationLink(PMA\libraries\Util::getDocuLink('index'), $showText, __('phpMyAdmin documentation'), $showIcon, 'b_docs.png', '', false, 'documentation');
     $retval .= PMA\libraries\Util::getNavigationLink(PMA\libraries\Util::getMySQLDocuURL('', ''), $showText, __('Documentation'), $showIcon, 'b_sqlhelp.png', '', false, 'mysql_doc');
     $retval .= PMA\libraries\Util::getNavigationLink('#', $showText, __('Navigation panel settings'), $showIcon, 's_cog.png', 'pma_navigation_settings_icon', false, '', defined('PMA_DISABLE_NAVI_SETTINGS') ? array('hide') : array());
     $retval .= PMA\libraries\Util::getNavigationLink('#', $showText, __('Reload navigation panel'), $showIcon, 's_reload.png', 'pma_navigation_reload');
     $retval .= '</div>';
     $retval .= '<!-- LINKS ENDS -->';
     return $retval;
 }
Util