Skip to content

Commit

Permalink
#16: composer install of pages, and basic first page
Browse files Browse the repository at this point in the history
  • Loading branch information
yiendos committed Mar 27, 2021
1 parent fdd914d commit 737230e
Show file tree
Hide file tree
Showing 1,157 changed files with 342,673 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Joomlatools Framework - https://www.joomlatools.com/developer/framework/
*
* @copyright Copyright (C) 2007 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link https://github.com/joomlatools/joomlatools-framework for the canonical source repository
*/

defined('KOOWA') or die; ?>

<ktml:content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Hello World!</h3>
<p>Welcome to my new page.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; Copyright (C) 2018 Timble CVBA. (http://www.timble.net)
; GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
; Note : All ini files need to be saved as UTF-8

COM_PAGES="Pages"
COM_PAGES_XML_DESCRIPTION=""
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; Copyright (C) 2018 Timble CVBA. (http://www.timble.net)
; GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
; Note : All ini files need to be saved as UTF-8

COM_PAGES="Pages"
COM_PAGES_XML_DESCRIPTION=""
44 changes: 44 additions & 0 deletions Sites/pages/administrator/components/com_pages/pages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="0.19.8" method="upgrade">
<identifier>com:pages</identifier>
<name>com_pages</name>
<author>Joomlatools</author>
<creationDate>March 2021</creationDate>
<copyright>Copyright (C) 2018 Timble CVBA (http://www.timble.net)</copyright>
<license>GNU GPLv3 - http://www.gnu.org/licenses/gpl.html</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomlatools.com</authorUrl>
<version>0.19.8</version>
<description>COM_PAGES_XML_DESCRIPTION</description>

<files folder="site/components/com_pages">
<filename>pages.php</filename>
<filename>config.php</filename>

<folder>class</folder>
<folder>controller</folder>
<folder>data</folder>
<folder>database</folder>
<folder>dispatcher</folder>
<folder>event</folder>
<folder>http</folder>
<folder>model</folder>
<folder>object</folder>
<folder>page</folder>
<folder>resources</folder>
<folder>template</folder>
<folder>view</folder>
</files>

<media folder="media">
<folder>com_pages</folder>
</media>

<administration>
<files folder="administrator/components/com_pages">
<filename>version.php</filename>

<folder>language</folder>
</files>
</administration>
</extension>
22 changes: 22 additions & 0 deletions Sites/pages/administrator/components/com_pages/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Joomlatools Pages
*
* @copyright Copyright (C) 2018 Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link https://github.com/joomlatools/joomlatools-pages for the canonical source repository
*/
class ComPagesVersion extends KObject
{
const VERSION = '0.19.8';

public function getVersion()
{
return self::VERSION;
}

public function __toString()
{
return $this->getVersion();
}
}
69 changes: 69 additions & 0 deletions Sites/pages/components/com_pages/class/locator/extension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
/**
* Joomlatools Pages
*
* @copyright Copyright (C) 2018 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link https://github.com/joomlatools/joomlatools-pages for the canonical source repository
*/

class ComPagesClassLocatorExtension extends KClassLocatorAbstract
{
protected static $_name = 'ext';

public function locate($classname, $basepath = null)
{
if (substr($classname, 0, 3) === 'Ext')
{
$result = false;

$word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', ' \\1', $classname));
$parts = explode(' ', $word);

array_shift($parts);
$package = array_shift($parts);
$namespace = ucfirst($package);

if(count($parts)) {
$file = array_pop($parts);
} else {
$file = $package;
}

$path = '';
if (!empty($parts)) {
$path = implode('/', $parts) . '/';
}

$paths = [];

//Namespace paths
if($basepath = $this->getNamespace($namespace))
{
$paths[] = $basepath.'/'.$path . $file.'.php';
$paths[] = $basepath.'/'.$path . $file.'/'.$file.'.php';
}

///Fallback paths (unused)
if($basepath = $this->getNamespace('\\'))
{
$paths[] = $basepath.'/'.strtolower($namespace) .'/'.$path . $file.'.php';
$paths[] = $basepath.'/'.strtolower($namespace) .'/'.$path . $file.'/'.$file.'.php';
}

foreach($paths as $path)
{
if(is_file($path))
{
$result = $path;
break;
}
}

return $result;
}

return false;

}
}
128 changes: 128 additions & 0 deletions Sites/pages/components/com_pages/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?php
/**
* Joomlatools Pages
*
* @copyright Copyright (C) 2018 Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link https://github.com/joomlatools/joomlatools-pages for the canonical source repository
*/

class ComPagesConfig extends KObject implements KObjectSingleton
{
protected $_site_path;

public function __construct(KObjectConfig $config)
{
parent::__construct($config);

$this->_site_path = $config->site_path;

//Load the site specific options
$this->_loadOptions();
}

protected function _initialize(KObjectConfig $config)
{
$config->append(array(
'site_path' => Koowa::getInstance()->getRootPath().'/joomlatools-pages'
))->append(array(
'page_cache' => true,
'page_cache_path' => $config->site_path.'/cache/pages',
'page_cache_validation' => true,

'data_namespaces' => array(),
'data_cache' => true,
'data_cache_path' => $config->site_path ? $config->site_path.'/cache/data' : false,
'data_cache_validation' => true,

'template_cache' => true,
'template_cache_path' => $config->site_path ? $config->site_path.'/cache/templates' : false,
'template_cache_validation' => true,

'http_cache' => false,
'http_cache_path' => $config->site_path ? $config->site_path.'/cache/responses': false,
'http_cache_time' => false,
'http_cache_time_browser' => null,
'http_cache_validation' => true,
'http_cache_control' => array(),
'http_cache_control_private' => array('private', 'no-cache'),

'http_static_cache' => getenv('PAGES_STATIC_ROOT') ? true : false,
'http_static_cache_path' => getenv('PAGES_STATIC_ROOT') ? getenv('PAGES_STATIC_ROOT') : false,

'http_resource_cache' => JFactory::getConfig()->get('caching'),
'http_resource_cache_path' => $config->site_path ? $config->site_path.'/cache/resources' : false,
'http_resource_cache_debug' => (JDEBUG ? true : false),

'collections' => array(),
'redirects' => array(),
'page' => array(),
'sites' => array('[*]' => JPATH_ROOT.'/joomlatools-pages'),
'headers' => array(),

'composer_path' => $config->site_path.'/vendor',
));
}

public function getSitePath($path = null)
{
//If the site path is empty do not try to return a path
if($this->_site_path && $path) {
$result = $this->_site_path.'/'.$path;
} else {
$result = $this->_site_path;
}

return $result;
}

public function get($option, $default = null)
{
return $this->getConfig()->get($option, $default);
}

public function getOptions()
{
return KObjectConfig::unbox($this->getConfig());
}

protected function _loadOptions()
{
$options = array();

//Load site config
if($path = $this->getSitePath())
{
//Get the defaults
$options = KObjectConfig::unbox($this->getConfig());

//Load default config options
if(file_exists(JPATH_CONFIGURATION.'/configuration-pages.php'))
{
$config = (array) include JPATH_CONFIGURATION.'/configuration-pages.php';
$options = array_replace_recursive($options, $config);
}

//Register the composer class locator
if(isset($options['composer_path']) && file_exists($options['composer_path']))
{
$this->getObject('manager')->getClassLoader()->registerLocator(
new KClassLocatorComposer(array(
'vendor_path' => $options['composer_path']
)
));
}

//Load site config options
if(file_exists($path.'/config.php'))
{
$config = $this->getObject('object.config.factory')->fromFile($path.'/config.php', false);
$options = array_replace_recursive($options, $config);
}

$this->getConfig()->merge($options);
}

return $options;
}
}
Loading

0 comments on commit 737230e

Please sign in to comment.