Changeset 527


Ignore:
Timestamp:
Jun 18, 2015 7:03:20 PM (9 years ago)
Author:
anonymous
Message:

Added page_url calculation to App->start()

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/js/Utilities.js

    r525 r527  
    3333* @access   public
    3434* @param    string multiple Strings to pass to the formatted string.
    35 * @author   http://stackoverflow.com/questions/610406/javascript-printf-string-format/4673436#4673436
     35* @author   http://stackoverflow.com/a/4673436/277303
    3636* @version  1.0
    3737* @since    30 May 2014 18:02:39
  • trunk/lib/App.inc.php

    r526 r527  
    7373        'site_name' => null,
    7474        'site_email' => '', // Set to no-reply@HTTP_HOST if not set here.
    75         'site_url' => '', // URL automatically determined by _SERVER['HTTP_HOST'] if not set here.
     75        'site_url' => '', // URL to the root of the site (created during App->start()).
     76        'page_url' => '', // URL to the current page (created during App->start()).
    7677        'images_path' => '', // Location for codebase-generated interface widgets (ex: "/admin/i").
    7778        'site_version' => '', // Version of this application (set automatically during start() if site_version_file is used).
     
    424425         */
    425426
    426         // Script URI will be something like http://host.name.tld (no ending slash)
     427        // Site URL will become something like http://host.name.tld (no ending slash)
    427428        // and is used whenever a URL need be used to the current site.
    428         // Not available on cli scripts obviously.
     429        // Not available on CLI scripts obviously.
    429430        if (isset($_SERVER['HTTP_HOST']) && '' != $_SERVER['HTTP_HOST'] && '' == $this->getParam('site_url')) {
    430431            $this->setParam(array('site_url' => sprintf('%s://%s', ('on' == getenv('HTTPS') ? 'https' : 'http'), getenv('HTTP_HOST'))));
     432        }
     433
     434        // Page URL will become a permalink to the current page.
     435        // Also not available on CLI scripts obviously.
     436        if (isset($_SERVER['HTTP_HOST']) && '' != $_SERVER['HTTP_HOST']) {
     437            $this->setParam(array('page_url' => sprintf('%s://%s%s', ('on' == getenv('HTTPS') ? 'https' : 'http'), getenv('HTTP_HOST'), getenv('REQUEST_URI'))));
    431438        }
    432439
Note: See TracChangeset for help on using the changeset viewer.