New features

This commit is contained in:
Diego Najar 2015-06-02 22:17:09 -03:00
parent 199bf97541
commit 678eb853d7
9 changed files with 118 additions and 50 deletions

View File

@ -5,12 +5,13 @@ Diego Najar
Implementar
- Links a Google+, Facebook y Twitter
- Plugins
- Plugins SEO, description, opengaph, etc..
- Plugins SEO, description, opengraph, etc..
- Comentarios
- Notificaciones
- Dashboard, parecido a Nibbleblog, me gusta.
- iPhone app
- Cloud
- ver casos de errores, filtros url iguales, con una /
- No permitir en filtros url iguales, agregar / al comienzo y final
- Usuarios de lectura ?, no vale la pena, y hay que hacer mas controles a nivel de administracion.
- Implementar algun limpiador**
@ -27,14 +28,6 @@ AllowOverride All
————
Objetos tipo estáticos, que empiecen con la letra h o la palabra helper.
hText::
hUrl::
helperText::
helperUrl::
find . -type f -name "*.php" -print0 | xargs -0 sed -i 's/Text/helperText/g'
find . -type f -name "*.php" -print0 | xargs -0 sed -i 's/Url/helperUrl/g'
@ -52,17 +45,13 @@ Si cambia el parent
verificar parent
mover directorio adentro del parent
Editar usuario
1- Usuario logueado
2- Ver si el usuario es administrador o si es el mismo usuario que se esta editando.
—————————
- Las Friendly URL son Case sensitive.
- Friendly URL son Case sensitive.
—————————
Editando a mano

View File

@ -115,6 +115,16 @@ class Plugin {
return false;
}
public function onAdminHead()
{
return false;
}
public function onAdminBody()
{
return false;
}
public function onSidebar()
{
return false;

View File

@ -163,5 +163,11 @@ if($Url->notFound()===false)
}
}
if($Url->notFound())
{
$Url->setWhereAmI('page');
$Page = new Page('error');
}
// Build all pages
build_all_pages();
build_all_pages();

View File

@ -3,7 +3,9 @@
$plugins = array(
'onSiteHead'=>array(),
'onSiteBody'=>array(),
'onSidebar'=>array()
'onSidebar'=>array(),
'onAdminHead'=>array(),
'onAdminBody'=>array()
);
function build_plugins()
@ -13,12 +15,13 @@ function build_plugins()
// List plugins directories
$list = Filesystem::listDirectories(PATH_PLUGINS);
// Get declared clasess before load plugins clasess
// Get declared clasess before load plugins clasess, this list doesn't have the plugins clasess.
$currentDeclaredClasess = get_declared_classes();
// Load each clasess
foreach($list as $pluginPath)
// Load each plugin clasess
foreach($list as $pluginPath) {
include($pluginPath.'/plugin.php');
}
// Get plugins clasess loaded
$pluginsDeclaredClasess = array_diff(get_declared_classes(), $currentDeclaredClasess);
@ -35,9 +38,13 @@ function build_plugins()
if($Plugin->onSidebar()!==false)
array_push($plugins['onSidebar'], $Plugin);
if($Plugin->onAdminHead()!==false)
array_push($plugins['onAdminHead'], $Plugin);
if($Plugin->onAdminBody()!==false)
array_push($plugins['onAdminBody'], $Plugin);
}
}
build_plugins();
?>

View File

@ -6,12 +6,6 @@ include(PATH_RULES.'70.build_pages.php');
include(PATH_RULES.'80.plugins.php');
include(PATH_RULES.'99.header.php');
if($Url->notFound())
{
$Url->setWhereAmI('page');
$Page = new Page('error');
}
// Theme init.php
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().'/init.php') )
include(PATH_THEMES.$Site->theme().'/init.php');

View File

@ -109,27 +109,28 @@ class Page extends fileContent
}
// Returns the page permalink.
public function permalink()
public function permalink($absolute=false)
{
global $Url;
global $Site;
$path = '';
$slug = $this->slug();
$parent = $this->parent();
$filter = ltrim($Url->filters('page'), '/');
$url = trim($Site->url(),'/');
$key = $this->key();
$filter = trim($Url->filters('page'), '/');
$htmlPath = trim(HTML_PATH_ROOT,'/');
if($Url->filters('page')==HTML_PATH_ROOT) {
$path = HTML_PATH_ROOT;
if(empty($filter)) {
$tmp = $key;
}
else {
$path = HTML_PATH_ROOT.$filter.'/';
$tmp = $filter.'/'.$key;
}
if($parent===false) {
return $path.$slug;
if($absolute) {
return $url.'/'.$tmp;
}
return $path.$parent.'/'.$slug;
return $htmlPath.'/'.$tmp;
}
public function parentKey()

View File

@ -99,16 +99,28 @@ class Post extends fileContent
return $this->getField('key');
}
public function permalink()
public function permalink($absolute=false)
{
global $Url;
global $Site;
$filter = ltrim($Url->filters('post'), '/');
$url = trim($Site->url(),'/');
$key = $this->key();
$filter = trim($Url->filters('post'), '/');
$htmlPath = trim(HTML_PATH_ROOT,'/');
if($Url->filters('post')==HTML_PATH_ROOT)
return HTML_PATH_ROOT.$this->slug();
if(empty($filter)) {
$tmp = $key;
}
else {
$tmp = $filter.'/'.$key;
}
return HTML_PATH_ROOT.$filter.$this->slug();
if($absolute) {
return $url.'/'.$tmp;
}
return $htmlPath.'/'.$tmp;
}
}

View File

@ -8,12 +8,6 @@ class pluginAbout extends Plugin {
'title'=>'',
'description'=>''
);
}
public function onSiteHead()
{
$html = '<title>Blog &ndash; Layout Examples &ndash; Pure</title>';
return $html;
}

View File

@ -0,0 +1,55 @@
<?php
class pluginOpenGraph extends Plugin {
public function init()
{
$this->dbFields = array(
'title'=>'Open Graph',
'description'=>''
);
}
public function onSiteHead()
{
global $Url, $Site;
global $Post, $Page;
$og = array(
'locale' =>$Site->locale(),
'type' =>'website',
'title' =>$Site->title(),
'description' =>$Site->description(),
'url' =>$Site->url(),
'image' =>'',
'site_name' =>$Site->title()
);
switch($Url->whereAmI())
{
case 'post':
$og['type'] = 'article';
$og['title'] = $Post->title().' | '.$og['title'];
$og['description'] = $Post->description();
$og['url'] = $Post->permalink(true);
break;
case 'page':
$og['type'] = 'article';
$og['title'] = $Page->title().' | '.$og['title'];
$og['description'] = $Page->description();
$og['url'] = $Page->permalink(true);
break;
}
$html = PHP_EOL.'<!-- Open Graph -->'.PHP_EOL;
$html .= '<meta property="og:locale" content="'.$og['locale'].'">'.PHP_EOL;
$html .= '<meta property="og:type" content="'.$og['type'].'">'.PHP_EOL;
$html .= '<meta property="og:title" content="'.$og['title'].'">'.PHP_EOL;
$html .= '<meta property="og:description" content="'.$og['description'].'">'.PHP_EOL;
$html .= '<meta property="og:image" content="'.$og['image'].'">'.PHP_EOL;
$html .= '<meta property="og:url" content="'.$og['url'].'">'.PHP_EOL;
$html .= '<meta property="og:site_name" content="'.$og['site_name'].'">'.PHP_EOL;
return $html;
}
}