Merge branch 'master' into enhancement/build-release
Conflicts: index.php
This commit is contained in:
commit
abce8b84b8
@ -19,6 +19,7 @@ Released: -
|
|||||||
(RFC 3986) in `Page::evaluateRequestUrl()`
|
(RFC 3986) in `Page::evaluateRequestUrl()`
|
||||||
* [Fixed] #272: Encode URLs using `rawurlencode()` in `Pico::getPageUrl()`
|
* [Fixed] #272: Encode URLs using `rawurlencode()` in `Pico::getPageUrl()`
|
||||||
* [Fixed] #274: Prevent double slashes in `base_url`
|
* [Fixed] #274: Prevent double slashes in `base_url`
|
||||||
|
* [Fixed] #285: Make `index.php` work when installed as a composer dependency
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version 1.0.0-beta.1
|
### Version 1.0.0-beta.1
|
||||||
|
13
index.php
13
index.php
@ -1,8 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
// @codingStandardsIgnoreFile
|
// @codingStandardsIgnoreFile
|
||||||
|
|
||||||
|
// check PHP version
|
||||||
|
if (version_compare(PHP_VERSION, '5.3.6', '<')) {
|
||||||
|
die('Sorry, Pico requires PHP 5.3.6 or above to run!');
|
||||||
|
}
|
||||||
|
|
||||||
// load dependencies
|
// load dependencies
|
||||||
|
if(is_file(__DIR__ . '/vendor/autoload.php')) {
|
||||||
|
// composer root package
|
||||||
require_once(__DIR__ . '/vendor/autoload.php');
|
require_once(__DIR__ . '/vendor/autoload.php');
|
||||||
|
} elseif(is_file(__DIR__ . '/../../../vendor/autoload.php')) {
|
||||||
|
// composer dependency package
|
||||||
|
require_once(__DIR__ . '/../../../vendor/autoload.php');
|
||||||
|
} else {
|
||||||
|
die("Cannot find `vendor/autoload.php`. Run `composer install`.");
|
||||||
|
}
|
||||||
|
|
||||||
// instance Pico
|
// instance Pico
|
||||||
$pico = new Pico(
|
$pico = new Pico(
|
||||||
|
13
lib/Pico.php
13
lib/Pico.php
@ -1214,14 +1214,13 @@ class Pico
|
|||||||
return $baseUrl;
|
return $baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
|
|
||||||
|| ($_SERVER['SERVER_PORT'] == 443)
|
|
||||||
|| (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
|
|
||||||
) {
|
|
||||||
$protocol = 'https';
|
|
||||||
} else {
|
|
||||||
$protocol = 'http';
|
$protocol = 'http';
|
||||||
|
if (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off')) {
|
||||||
|
$protocol = 'https';
|
||||||
|
} elseif ($_SERVER['SERVER_PORT'] == 443) {
|
||||||
|
$protocol = 'https';
|
||||||
|
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) {
|
||||||
|
$protocol = 'https';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->config['base_url'] =
|
$this->config['base_url'] =
|
||||||
|
@ -107,19 +107,17 @@ class PicoDeprecated extends AbstractPicoPlugin
|
|||||||
* @see PicoDeprecated::loadRootDirConfig()
|
* @see PicoDeprecated::loadRootDirConfig()
|
||||||
* @see PicoDeprecated::enablePlugins()
|
* @see PicoDeprecated::enablePlugins()
|
||||||
* @see DummyPlugin::onConfigLoaded()
|
* @see DummyPlugin::onConfigLoaded()
|
||||||
* @param mixed[] &$realConfig array of config variables
|
* @param mixed[] &$config array of config variables
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function onConfigLoaded(array &$realConfig)
|
public function onConfigLoaded(array &$config)
|
||||||
{
|
{
|
||||||
global $config;
|
|
||||||
|
|
||||||
$this->defineConstants();
|
$this->defineConstants();
|
||||||
$this->loadRootDirConfig($realConfig);
|
$this->loadRootDirConfig($config);
|
||||||
$this->enablePlugins();
|
$this->enablePlugins();
|
||||||
$config = &$realConfig;
|
$GLOBALS['config'] = &$config;
|
||||||
|
|
||||||
$this->triggerEvent('config_loaded', array(&$realConfig));
|
$this->triggerEvent('config_loaded', array(&$config));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,8 +342,12 @@ class PicoDeprecated extends AbstractPicoPlugin
|
|||||||
*
|
*
|
||||||
* @see DummyPlugin::onPagesLoaded()
|
* @see DummyPlugin::onPagesLoaded()
|
||||||
*/
|
*/
|
||||||
public function onPagesLoaded(array &$pages, array &$currentPage = null, array &$previousPage = null, array &$nextPage = null)
|
public function onPagesLoaded(
|
||||||
{
|
array &$pages,
|
||||||
|
array &$currentPage = null,
|
||||||
|
array &$previousPage = null,
|
||||||
|
array &$nextPage = null
|
||||||
|
) {
|
||||||
// remove keys of pages array
|
// remove keys of pages array
|
||||||
$plainPages = array();
|
$plainPages = array();
|
||||||
foreach ($pages as &$pageData) {
|
foreach ($pages as &$pageData) {
|
||||||
|
@ -270,8 +270,12 @@ final class DummyPlugin extends AbstractPicoPlugin
|
|||||||
* @param array|null &$nextPage data of the next page
|
* @param array|null &$nextPage data of the next page
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function onPagesLoaded(array &$pages, array &$currentPage = null, array &$previousPage = null, array &$nextPage = null)
|
public function onPagesLoaded(
|
||||||
{
|
array &$pages,
|
||||||
|
array &$currentPage = null,
|
||||||
|
array &$previousPage = null,
|
||||||
|
array &$nextPage = null
|
||||||
|
) {
|
||||||
// your code
|
// your code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,6 @@ blockquote {
|
|||||||
|
|
||||||
/* Small Devices, Tablets */
|
/* Small Devices, Tablets */
|
||||||
@media only screen and (max-width : 768px) {
|
@media only screen and (max-width : 768px) {
|
||||||
|
|
||||||
.inner {
|
.inner {
|
||||||
width: 85%;
|
width: 85%;
|
||||||
}
|
}
|
||||||
@ -324,12 +323,10 @@ blockquote {
|
|||||||
#header nav:hover ul {
|
#header nav:hover ul {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extra Small Devices, Phones */
|
/* Extra Small Devices, Phones */
|
||||||
@media only screen and (max-width : 480px) {
|
@media only screen and (max-width : 480px) {
|
||||||
|
|
||||||
.inner {
|
.inner {
|
||||||
width: 85%;
|
width: 85%;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user