Permalink 1.12 minor feature request

2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: November 6   (RSS)

In the permalink_cmsMenus.php file around line 43 is this function:

function permalink_cms_onEditShowFieldPrefix($tableName, $recordNum)
{
    // for sections with a permalink field:
    if (array_key_exists('permalink', $GLOBALS['schema'])) {
        // update permalink prefix/suffix to show current hostname (whatever that may be)
        $GLOBALS['schema']['permalink']['fieldPrefix'] = implode(' ', array($GLOBALS['schema']['permalink']['fieldPrefix'], "http://" . htmlencode($_SERVER['HTTP_HOST']) . PREFIX_URL . '/'));
        $GLOBALS['schema']['permalink']['description'] = '/  ' . $GLOBALS['schema']['permalink']['description'];
    }

    // not yet used
    //if ($tableName == '_permalinks' && array_key_exists('customSourceUrl', $GLOBALS['schema'])) {
    //  $GLOBALS['schema']['customSourceUrl']['fieldPrefix']  = $GLOBALS['SETTINGS']['webRootDir'];
    //}

}

This function shows the field prefix using the hostname with '/' , and trailing '/', however the protocol is defaulting to http://. This should show the actual protocol being used or default to https:// - in my opinion.

function permalink_cms_onEditShowFieldPrefix($tableName, $recordNum)
{
    // for sections with a permalink field:
    if (array_key_exists('permalink', $GLOBALS['schema'])) {
        // update permalink prefix/suffix to show current hostname (whatever that may be)
        $GLOBALS['schema']['permalink']['fieldPrefix'] = implode(' ', array($GLOBALS['schema']['permalink']['fieldPrefix'], "https://" . htmlencode($_SERVER['HTTP_HOST']) . PREFIX_URL . '/'));
        $GLOBALS['schema']['permalink']['description'] = '/  ' . $GLOBALS['schema']['permalink']['description'];
    }

    // not yet used
    //if ($tableName == '_permalinks' && array_key_exists('customSourceUrl', $GLOBALS['schema'])) {
    //  $GLOBALS['schema']['customSourceUrl']['fieldPrefix']  = $GLOBALS['SETTINGS']['webRootDir'];
    //}

}
Jeff Shields