Absolute url on themes
This commit is contained in:
parent
a90ff3e635
commit
85f863f586
|
@ -21,7 +21,6 @@ function setSettings($args)
|
|||
global $dbPages;
|
||||
|
||||
// Add slash at the begin and end
|
||||
$args['url'] = Text::addSlashes($args['url'],false,true);
|
||||
$args['uriPage'] = Text::addSlashes($args['uriPage']);
|
||||
$args['uriTag'] = Text::addSlashes($args['uriTag']);
|
||||
$args['uriCategory'] = Text::addSlashes($args['uriCategory']);
|
||||
|
|
|
@ -259,6 +259,7 @@ define('THEME_DIR_LANG', THEME_DIR.'languages'.DS);
|
|||
// This paths are absolutes for the user / web browsing.
|
||||
define('DOMAIN', $Site->domain());
|
||||
define('DOMAIN_BASE', DOMAIN.HTML_PATH_ROOT);
|
||||
define('DOMAIN_THEME', DOMAIN.HTML_PATH_THEME);
|
||||
define('DOMAIN_THEME_CSS', DOMAIN.HTML_PATH_THEME_CSS);
|
||||
define('DOMAIN_THEME_JS', DOMAIN.HTML_PATH_THEME_JS);
|
||||
define('DOMAIN_THEME_IMG', DOMAIN.HTML_PATH_THEME_IMG);
|
||||
|
|
|
@ -18,7 +18,7 @@ class dbPages extends dbJSON
|
|||
'category'=> array('inFile'=>false, 'value'=>''),
|
||||
'md5file'=> array('inFile'=>false, 'value'=>''),
|
||||
'uuid'=> array('inFile'=>false, 'value'=>''),
|
||||
'allowComments'=> array('inFile'=>false, 'value'=>false)
|
||||
'allowComments'=> array('inFile'=>false, 'value'=>true)
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
|
|
@ -57,7 +57,7 @@ class Theme {
|
|||
return '<meta name="viewport" content="'.$content.'">'.PHP_EOL;
|
||||
}
|
||||
|
||||
public static function css($files, $path=HTML_PATH_THEME)
|
||||
public static function css($files)
|
||||
{
|
||||
if( !is_array($files) ) {
|
||||
$files = array($files);
|
||||
|
@ -65,13 +65,13 @@ class Theme {
|
|||
|
||||
$links = '';
|
||||
foreach($files as $file) {
|
||||
$links .= '<link rel="stylesheet" type="text/css" href="'.$path.$file.'">'.PHP_EOL;
|
||||
$links .= '<link rel="stylesheet" type="text/css" href="'.DOMAIN_THEME.$file.'">'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
public static function javascript($files, $path=HTML_PATH_THEME)
|
||||
public static function javascript($files)
|
||||
{
|
||||
if( !is_array($files) ) {
|
||||
$files = array($files);
|
||||
|
@ -79,15 +79,15 @@ class Theme {
|
|||
|
||||
$scripts = '';
|
||||
foreach($files as $file) {
|
||||
$scripts .= '<script src="'.$path.$file.'"></script>'.PHP_EOL;
|
||||
$scripts .= '<script src="'.DOMAIN_THEME.$file.'"></script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $scripts;
|
||||
}
|
||||
|
||||
public static function js($files, $path=HTML_PATH_THEME)
|
||||
public static function js($files)
|
||||
{
|
||||
self::javascript($files, $path);
|
||||
return self::javascript($files);
|
||||
}
|
||||
|
||||
public static function plugins($type)
|
||||
|
@ -116,13 +116,6 @@ class Theme {
|
|||
return $tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function keywords($keywords, $echo=true)
|
||||
{
|
||||
if(is_array($keywords)) {
|
||||
|
@ -138,12 +131,6 @@ class Theme {
|
|||
return $tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function jquery($echo=true)
|
||||
{
|
||||
$tmp = '<script src="'.HTML_PATH_ADMIN_THEME_JS.'jquery.min.js'.'"></script>'.PHP_EOL;
|
||||
|
|
|
@ -149,7 +149,7 @@ class Page {
|
|||
|
||||
// Returns the permalink
|
||||
// (boolean) $absolute, TRUE returns the page link with the DOMAIN, FALSE without the DOMAIN
|
||||
public function permalink($absolute=false)
|
||||
public function permalink($absolute=true)
|
||||
{
|
||||
global $Url;
|
||||
global $Site;
|
||||
|
@ -366,6 +366,12 @@ class Page {
|
|||
return $this->getField('title');
|
||||
}
|
||||
|
||||
// Returns TRUE if the page has enabled the comments, FALSE otherwise
|
||||
public function allowComments()
|
||||
{
|
||||
return $this->getField('allowComments');
|
||||
}
|
||||
|
||||
// Returns the page position
|
||||
public function position()
|
||||
{
|
||||
|
|
|
@ -29,8 +29,8 @@ class pluginDisqus extends Plugin {
|
|||
$html = '<div id="disqus_thread"></div>';
|
||||
$html .= '<script type="text/javascript">
|
||||
var disqus_config = function () {
|
||||
this.page.url = '.$page->permalink().';
|
||||
this.page.identifier = '.$page->uuid().';
|
||||
this.page.url = "'.$page->permalink().'";
|
||||
this.page.identifier = "'.$page->uuid().'";
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
@ -43,14 +43,10 @@ class pluginDisqus extends Plugin {
|
|||
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
';
|
||||
return $html;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function siteHead()
|
||||
{
|
||||
return '<style>#disqus_thread { margin: 20px 0 }</style>';
|
||||
}
|
||||
|
||||
}
|
|
@ -53,3 +53,9 @@ div.plugin-menu span.category-name {
|
|||
div.plugin-menu a.page-title {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Plugin Disqus
|
||||
------------------------------------------------------------------------------ */
|
||||
#disqus_thread {
|
||||
margin-top: 60px;
|
||||
}
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
<!-- Header -->
|
||||
<header id="header">
|
||||
<a href="<?php echo $Site->url() ?>" class="logo"><strong><?php echo $Site->title() ?></strong> <?php echo $Site->slogan() ?></a>
|
||||
<a href="<?php echo $Site->url() ?>" class="logo">
|
||||
<strong><?php echo $Site->title() ?></strong> <?php echo $Site->slogan() ?>
|
||||
</a>
|
||||
<ul class="icons">
|
||||
<li><a href="<?php echo $Site->twitter() ?>" class="icon fa-twitter"><span class="label">Twitter</span></a></li>
|
||||
<li><a href="<?php echo $Site->facebook() ?>" class="icon fa-facebook"><span class="label">Facebook</span></a></li>
|
||||
|
@ -44,6 +46,7 @@
|
|||
<?php include(THEME_DIR_PHP.'sidebar.php') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
|
|
15
install.php
15
install.php
|
@ -324,7 +324,7 @@ function install($adminPassword, $email, $timezone)
|
|||
'status'=>'published',
|
||||
'date'=>$currentDate,
|
||||
'dateModified'=>'',
|
||||
'allowComments'=>false,
|
||||
'allowComments'=>true,
|
||||
'position'=>2,
|
||||
'coverImage'=>'',
|
||||
'md5file'=>'',
|
||||
|
@ -338,7 +338,7 @@ function install($adminPassword, $email, $timezone)
|
|||
'status'=>'published',
|
||||
'date'=>$currentDate,
|
||||
'dateModified'=>'',
|
||||
'allowComments'=>false,
|
||||
'allowComments'=>true,
|
||||
'position'=>1,
|
||||
'coverImage'=>'',
|
||||
'md5file'=>'',
|
||||
|
@ -350,6 +350,15 @@ function install($adminPassword, $email, $timezone)
|
|||
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File site.php
|
||||
|
||||
// If the website is not installed inside a folder the URL not need finish with /
|
||||
// Example (root): https://domain.com
|
||||
// Example (inside a folder): https://domain.com/folder/
|
||||
if(HTML_PATH_ROOT=='/') {
|
||||
$siteUrl = PROTOCOL.DOMAIN;
|
||||
} else {
|
||||
$siteUrl = PROTOCOL.DOMAIN.HTML_PATH_ROOT;
|
||||
}
|
||||
$data = array(
|
||||
'title'=>'BLUDIT',
|
||||
'slogan'=>'CMS',
|
||||
|
@ -365,7 +374,7 @@ function install($adminPassword, $email, $timezone)
|
|||
'uriPage'=>'/',
|
||||
'uriTag'=>'/tag/',
|
||||
'uriCategory'=>'/category/',
|
||||
'url'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT,
|
||||
'url'=>$siteUrl,
|
||||
'emailFrom'=>'no-reply@'.DOMAIN
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue