Regex Rel to Abs img, improves on manage content

This commit is contained in:
Diego Najar 2017-08-02 01:11:57 +02:00
parent 3111c11ca3
commit 05c67fc473
4 changed files with 43 additions and 22 deletions

View File

@ -139,7 +139,7 @@
$keys = array_keys($scheduledPages);
foreach($keys as $key) {
$page = buildPage($key);
echo '<li><span class="label-draft">'.$Language->g('Page').'</span><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$page->key().'">'.($page->title()?$page->title():'['.$Language->g('Empty title').'] ').'</a></li>';
echo '<li><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$page->key().'">'.($page->title()?$page->title():'['.$Language->g('Empty title').'] ').'</a></li>';
}
}
?>

View File

@ -4,6 +4,7 @@ HTML::title(array('title'=>$L->g('Manage content'), 'icon'=>'folder'));
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'new-page"><i class="uk-icon-plus"></i> '.$L->g('Add new content').'</a>';
// Fixed page list
echo '
<table class="uk-table uk-table-striped">
<thead>
@ -20,13 +21,27 @@ echo '
<tbody>
';
foreach($pages as $page) {
$status = false;
if($page->status()!='published') {
$status = $Language->g( $page->status() );
function table($status, $icon='arrow-circle-o-down') {
global $pages;
global $Url;
$showLegend = true;
foreach ($pages as $key=>$page) {
if ($page->status()==$status) {
if ($showLegend) {
$showLegend = false;
echo '<tr>
<td style="color: #aaa; font-size: 0.9em; text-transform: uppercase;"><i class="fa fa-'.$icon.'" aria-hidden="true"></i> '.$status.'</td>
<td></td>
<td></td>
</tr>';
}
unset($pages[$key]);
echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$page->key().'">'.($status?'<span class="label-'.$page->status().'">'.$status.'</span>':'').($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a></td>';
echo '<td>
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$page->key().'">'
.($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.'</a>
</td>';
echo '<td class="uk-text-center">'.( (ORDER_BY=='date') ? $page->dateRaw() : $page->position() ).'</td>';
@ -34,6 +49,14 @@ foreach($pages as $page) {
echo '<td><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
}
}
}
table('draft', 'spinner');
table('scheduled', 'clock-o');
table('fixed', 'thumb-tack');
table('sticky', 'sticky-note-o');
table('published', 'check');
echo '
</tbody>
@ -47,7 +70,7 @@ echo '
<?php
// Show previus page link
if(Paginator::showPrev()) {
echo '<li class="first"><a href="'.Paginator::prevPageUrl().'" class="previous"><- Previous</a></li>';
echo '<li class="first"><a href="'.Paginator::prevPageUrl().'" class="previous"><i class="fa fa-arrow-circle-o-left"></i> Previous</a></li>';
}
for($i=1; $i<=Paginator::amountOfPages(); $i++) {
@ -56,7 +79,7 @@ echo '
// Show next page link
if(Paginator::showNext()) {
echo '<li class="next"><a href="'.Paginator::nextPageUrl().'" class="next">Next -></a></li>';
echo '<li class="next"><a href="'.Paginator::nextPageUrl().'" class="next">Next <i class="fa fa-arrow-circle-o-right"></i></a></li>';
}
?>
</ul>

View File

@ -215,7 +215,10 @@ class Text {
public static function imgRel2Abs($string, $base)
{
return preg_replace('/(src)="([^:"]*)(?:")/', "$1=\"$base$2\"", $string);
$pattern = "/<img([^>]*) src=\"([^http|https|ftp|\/\/][^\"]*)\"/";
$replace = "<img\${1} src=\"".$base. "\${2}\"";
return preg_replace($pattern, $replace, $string);
}
public static function pre2htmlentities($string)
@ -224,5 +227,4 @@ class Text {
create_function('$input', 'return "<pre><code $input[1]>".htmlentities($input[2])."</code></pre>";'),
$string);
}
}

View File

@ -18,14 +18,10 @@
<!-- Section -->
<section>
<header class="major">
<h2>Pages</h2>
</header>
<div class="posts">
<?php foreach ($pages as $page): ?>
<article>
<a href="#" class="image"><img src="<?php echo $page->coverImage() ?>" alt="" /></a>
<a href="<?php echo $page->permalink() ?>" class="image"><img src="<?php echo $page->coverImage() ?>" alt="" /></a>
<h3><?php echo $page->title() ?></h3>
<p><?php echo $page->description() ?></p>
<ul class="actions">