From 5cd7e6f4691ce5f56a5793f1e134b1d4bfd95207 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 21 Oct 2017 20:29:56 +0200 Subject: [PATCH 01/14] Remove parsedown extra --- bl-kernel/boot/init.php | 1 - bl-kernel/parsedownextra.class.php | 526 ----------------------------- 2 files changed, 527 deletions(-) delete mode 100644 bl-kernel/parsedownextra.class.php diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 879f825e..62e33a8d 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -178,7 +178,6 @@ include(PATH_KERNEL.'user.class.php'); include(PATH_KERNEL.'url.class.php'); include(PATH_KERNEL.'login.class.php'); include(PATH_KERNEL.'parsedown.class.php'); -include(PATH_KERNEL.'parsedownextra.class.php'); include(PATH_KERNEL.'security.class.php'); // Include functions diff --git a/bl-kernel/parsedownextra.class.php b/bl-kernel/parsedownextra.class.php deleted file mode 100644 index be6966d2..00000000 --- a/bl-kernel/parsedownextra.class.php +++ /dev/null @@ -1,526 +0,0 @@ -BlockTypes[':'] []= 'DefinitionList'; - $this->BlockTypes['*'] []= 'Abbreviation'; - - # identify footnote definitions before reference definitions - array_unshift($this->BlockTypes['['], 'Footnote'); - - # identify footnote markers before before links - array_unshift($this->InlineTypes['['], 'FootnoteMarker'); - } - - # - # ~ - - function text($text) - { - $markup = parent::text($text); - - # merge consecutive dl elements - - $markup = preg_replace('/<\/dl>\s+
\s+/', '', $markup); - - # add footnotes - - if (isset($this->DefinitionData['Footnote'])) - { - $Element = $this->buildFootnoteElement(); - - $markup .= "\n" . $this->element($Element); - } - - return $markup; - } - - # - # Blocks - # - - # - # Abbreviation - - protected function blockAbbreviation($Line) - { - if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches)) - { - $this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2]; - - $Block = array( - 'hidden' => true, - ); - - return $Block; - } - } - - # - # Footnote - - protected function blockFootnote($Line) - { - if (preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches)) - { - $Block = array( - 'label' => $matches[1], - 'text' => $matches[2], - 'hidden' => true, - ); - - return $Block; - } - } - - protected function blockFootnoteContinue($Line, $Block) - { - if ($Line['text'][0] === '[' and preg_match('/^\[\^(.+?)\]:/', $Line['text'])) - { - return; - } - - if (isset($Block['interrupted'])) - { - if ($Line['indent'] >= 4) - { - $Block['text'] .= "\n\n" . $Line['text']; - - return $Block; - } - } - else - { - $Block['text'] .= "\n" . $Line['text']; - - return $Block; - } - } - - protected function blockFootnoteComplete($Block) - { - $this->DefinitionData['Footnote'][$Block['label']] = array( - 'text' => $Block['text'], - 'count' => null, - 'number' => null, - ); - - return $Block; - } - - # - # Definition List - - protected function blockDefinitionList($Line, $Block) - { - if ( ! isset($Block) or isset($Block['type'])) - { - return; - } - - $Element = array( - 'name' => 'dl', - 'handler' => 'elements', - 'text' => array(), - ); - - $terms = explode("\n", $Block['element']['text']); - - foreach ($terms as $term) - { - $Element['text'] []= array( - 'name' => 'dt', - 'handler' => 'line', - 'text' => $term, - ); - } - - $Block['element'] = $Element; - - $Block = $this->addDdElement($Line, $Block); - - return $Block; - } - - protected function blockDefinitionListContinue($Line, array $Block) - { - if ($Line['text'][0] === ':') - { - $Block = $this->addDdElement($Line, $Block); - - return $Block; - } - else - { - if (isset($Block['interrupted']) and $Line['indent'] === 0) - { - return; - } - - if (isset($Block['interrupted'])) - { - $Block['dd']['handler'] = 'text'; - $Block['dd']['text'] .= "\n\n"; - - unset($Block['interrupted']); - } - - $text = substr($Line['body'], min($Line['indent'], 4)); - - $Block['dd']['text'] .= "\n" . $text; - - return $Block; - } - } - - # - # Header - - protected function blockHeader($Line) - { - $Block = parent::blockHeader($Line); - - if (preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) - { - $attributeString = $matches[1][0]; - - $Block['element']['attributes'] = $this->parseAttributeData($attributeString); - - $Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]); - } - - return $Block; - } - - # - # Markup - - protected function blockMarkupComplete($Block) - { - if ( ! isset($Block['void'])) - { - $Block['markup'] = $this->processTag($Block['markup']); - } - - return $Block; - } - - # - # Setext - - protected function blockSetextHeader($Line, array $Block = null) - { - $Block = parent::blockSetextHeader($Line, $Block); - - if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) - { - $attributeString = $matches[1][0]; - - $Block['element']['attributes'] = $this->parseAttributeData($attributeString); - - $Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]); - } - - return $Block; - } - - # - # Inline Elements - # - - # - # Footnote Marker - - protected function inlineFootnoteMarker($Excerpt) - { - if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches)) - { - $name = $matches[1]; - - if ( ! isset($this->DefinitionData['Footnote'][$name])) - { - return; - } - - $this->DefinitionData['Footnote'][$name]['count'] ++; - - if ( ! isset($this->DefinitionData['Footnote'][$name]['number'])) - { - $this->DefinitionData['Footnote'][$name]['number'] = ++ $this->footnoteCount; # ยป & - } - - $Element = array( - 'name' => 'sup', - 'attributes' => array('id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name), - 'handler' => 'element', - 'text' => array( - 'name' => 'a', - 'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'), - 'text' => $this->DefinitionData['Footnote'][$name]['number'], - ), - ); - - return array( - 'extent' => strlen($matches[0]), - 'element' => $Element, - ); - } - } - - private $footnoteCount = 0; - - # - # Link - - protected function inlineLink($Excerpt) - { - $Link = parent::inlineLink($Excerpt); - - $remainder = substr($Excerpt['text'], $Link['extent']); - - if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches)) - { - $Link['element']['attributes'] += $this->parseAttributeData($matches[1]); - - $Link['extent'] += strlen($matches[0]); - } - - return $Link; - } - - # - # ~ - # - - protected function unmarkedText($text) - { - $text = parent::unmarkedText($text); - - if (isset($this->DefinitionData['Abbreviation'])) - { - foreach ($this->DefinitionData['Abbreviation'] as $abbreviation => $meaning) - { - $pattern = '/\b'.preg_quote($abbreviation, '/').'\b/'; - - $text = preg_replace($pattern, ''.$abbreviation.'', $text); - } - } - - return $text; - } - - # - # Util Methods - # - - protected function addDdElement(array $Line, array $Block) - { - $text = substr($Line['text'], 1); - $text = trim($text); - - unset($Block['dd']); - - $Block['dd'] = array( - 'name' => 'dd', - 'handler' => 'line', - 'text' => $text, - ); - - if (isset($Block['interrupted'])) - { - $Block['dd']['handler'] = 'text'; - - unset($Block['interrupted']); - } - - $Block['element']['text'] []= & $Block['dd']; - - return $Block; - } - - protected function buildFootnoteElement() - { - $Element = array( - 'name' => 'div', - 'attributes' => array('class' => 'footnotes'), - 'handler' => 'elements', - 'text' => array( - array( - 'name' => 'hr', - ), - array( - 'name' => 'ol', - 'handler' => 'elements', - 'text' => array(), - ), - ), - ); - - uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes'); - - foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData) - { - if ( ! isset($DefinitionData['number'])) - { - continue; - } - - $text = $DefinitionData['text']; - - $text = parent::text($text); - - $numbers = range(1, $DefinitionData['count']); - - $backLinksMarkup = ''; - - foreach ($numbers as $number) - { - $backLinksMarkup .= ' '; - } - - $backLinksMarkup = substr($backLinksMarkup, 1); - - if (substr($text, - 4) === '

') - { - $backLinksMarkup = ' '.$backLinksMarkup; - - $text = substr_replace($text, $backLinksMarkup.'

', - 4); - } - else - { - $text .= "\n".'

'.$backLinksMarkup.'

'; - } - - $Element['text'][1]['text'] []= array( - 'name' => 'li', - 'attributes' => array('id' => 'fn:'.$definitionId), - 'text' => "\n".$text."\n", - ); - } - - return $Element; - } - - # ~ - - protected function parseAttributeData($attributeString) - { - $Data = array(); - - $attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY); - - foreach ($attributes as $attribute) - { - if ($attribute[0] === '#') - { - $Data['id'] = substr($attribute, 1); - } - else # "." - { - $classes []= substr($attribute, 1); - } - } - - if (isset($classes)) - { - $Data['class'] = implode(' ', $classes); - } - - return $Data; - } - - # ~ - - protected function processTag($elementMarkup) # recursive - { - # http://stackoverflow.com/q/1148928/200145 - libxml_use_internal_errors(true); - - $DOMDocument = new DOMDocument; - - # http://stackoverflow.com/q/11309194/200145 - $elementMarkup = mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8'); - - # http://stackoverflow.com/q/4879946/200145 - $DOMDocument->loadHTML($elementMarkup); - $DOMDocument->removeChild($DOMDocument->doctype); - $DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild); - - $elementText = ''; - - if ($DOMDocument->documentElement->getAttribute('markdown') === '1') - { - foreach ($DOMDocument->documentElement->childNodes as $Node) - { - $elementText .= $DOMDocument->saveHTML($Node); - } - - $DOMDocument->documentElement->removeAttribute('markdown'); - - $elementText = "\n".$this->text($elementText)."\n"; - } - else - { - foreach ($DOMDocument->documentElement->childNodes as $Node) - { - $nodeMarkup = $DOMDocument->saveHTML($Node); - - if ($Node instanceof DOMElement and ! in_array($Node->nodeName, $this->textLevelElements)) - { - $elementText .= $this->processTag($nodeMarkup); - } - else - { - $elementText .= $nodeMarkup; - } - } - } - - # because we don't want for markup to get encoded - $DOMDocument->documentElement->nodeValue = 'placeholder\x1A'; - - $markup = $DOMDocument->saveHTML($DOMDocument->documentElement); - $markup = str_replace('placeholder\x1A', $elementText, $markup); - - return $markup; - } - - # ~ - - protected function sortFootnotes($A, $B) # callback - { - return $A['number'] - $B['number']; - } - - # - # Fields - # - - protected $regexAttribute = '(?:[#.][-\w]+[ ]*)'; -} From 20151c7f05afd33e189384d3bf00cc2be2c65b85 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 21 Oct 2017 20:30:20 +0200 Subject: [PATCH 02/14] Added comments about station content variable --- bl-kernel/boot/rules/69.pages.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bl-kernel/boot/rules/69.pages.php b/bl-kernel/boot/rules/69.pages.php index c40da023..e1ee3cf2 100644 --- a/bl-kernel/boot/rules/69.pages.php +++ b/bl-kernel/boot/rules/69.pages.php @@ -68,6 +68,16 @@ $pagesByParent = array(PARENT=>array()); */ $pagesByParentByKey = array(PARENT=>array()); +// Array with static content, each item is a Page Object +// Order by position +/* + array( + 0 => Page Object, + 1 => Page Object, + ... + N => Page Object + ) +*/ $staticContent = $staticPages = buildStaticPages(); // ============================================================================ From df978c0a75e07ebde72a64a48e490276bdb8c2de Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 21 Oct 2017 20:30:59 +0200 Subject: [PATCH 03/14] DOM helper on plugins --- bl-kernel/helpers/dom.class.php | 2 ++ bl-plugins/opengraph/plugin.php | 22 +--------------------- bl-plugins/twitter-cards/plugin.php | 23 +---------------------- 3 files changed, 4 insertions(+), 43 deletions(-) diff --git a/bl-kernel/helpers/dom.class.php b/bl-kernel/helpers/dom.class.php index d655fb8a..3917035a 100644 --- a/bl-kernel/helpers/dom.class.php +++ b/bl-kernel/helpers/dom.class.php @@ -4,6 +4,8 @@ class DOM { public static function getFirstImage($content) { + // Disable warning + libxml_use_internal_errors(); $dom = new DOMDocument(); $dom->loadHTML(''.$content); $finder = new DomXPath($dom); diff --git a/bl-plugins/opengraph/plugin.php b/bl-plugins/opengraph/plugin.php index ed8b357c..0642bc4c 100644 --- a/bl-plugins/opengraph/plugin.php +++ b/bl-plugins/opengraph/plugin.php @@ -89,7 +89,7 @@ class pluginOpenGraph extends Plugin { // If the page doesn't have a coverImage try to get an image from the HTML content if (empty($og['image'])) { // Get the image from the content - $src = $this->getImage($content); + $src = DOM::getFirstImage($content); if ($src!==false) { $og['image'] = $src; } else { @@ -103,24 +103,4 @@ class pluginOpenGraph extends Plugin { return $html; } - // Returns the first image from the HTML content - private function getImage($content) - { - $dom = new DOMDocument(); - $dom->loadHTML(''.$content); - $finder = new DomXPath($dom); - - $images = $finder->query("//img"); - - if($images->length>0) { - // First image from the list - $image = $images->item(0); - // Get value from attribute src - $imgSrc = $image->getAttribute('src'); - // Returns the image src - return $imgSrc; - } - - return false; - } } \ No newline at end of file diff --git a/bl-plugins/twitter-cards/plugin.php b/bl-plugins/twitter-cards/plugin.php index 2456406c..8a9e0def 100644 --- a/bl-plugins/twitter-cards/plugin.php +++ b/bl-plugins/twitter-cards/plugin.php @@ -83,7 +83,7 @@ class pluginTwitterCards extends Plugin { // If the page doesn't have a coverImage try to get an image from the HTML content if( empty($data['image']) ) { // Get the image from the content - $src = $this->getImage($content); + $src = DOM::getFirstImage($content); if ($src!==false) { $data['image'] = $src; } else { @@ -96,25 +96,4 @@ class pluginTwitterCards extends Plugin { $html .= ''.PHP_EOL; return $html; } - - // Returns the first image from the HTML content - private function getImage($content) - { - $dom = new DOMDocument(); - $dom->loadHTML(''.$content); - $finder = new DomXPath($dom); - - $images = $finder->query("//img"); - - if($images->length>0) { - // First image from the list - $image = $images->item(0); - // Get value from attribute src - $imgSrc = $image->getAttribute('src'); - // Returns the image src - return $imgSrc; - } - - return false; - } } \ No newline at end of file From 4ccd4ae24ddee1f65c2c777c608fa662e280f8b4 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 21 Oct 2017 20:35:45 +0200 Subject: [PATCH 04/14] Keep errors internal --- bl-kernel/helpers/dom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bl-kernel/helpers/dom.class.php b/bl-kernel/helpers/dom.class.php index 3917035a..6cbc9252 100644 --- a/bl-kernel/helpers/dom.class.php +++ b/bl-kernel/helpers/dom.class.php @@ -5,7 +5,7 @@ class DOM { public static function getFirstImage($content) { // Disable warning - libxml_use_internal_errors(); + libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML(''.$content); $finder = new DomXPath($dom); From 047afee2e807da6a71e50cad4d567d910e9f9257 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 22 Oct 2017 14:36:16 +0200 Subject: [PATCH 05/14] Bug fixes with static content https://github.com/bludit/bludit/issues/533 --- .../admin/controllers/settings-advanced.php | 4 +- bl-kernel/admin/views/edit-content.php | 6 +-- bl-kernel/boot/rules/69.pages.php | 2 +- bl-kernel/dbpages.class.php | 15 ++++-- bl-kernel/functions.php | 48 ++++++++++++------- 5 files changed, 48 insertions(+), 27 deletions(-) diff --git a/bl-kernel/admin/controllers/settings-advanced.php b/bl-kernel/admin/controllers/settings-advanced.php index 7b70a5c2..f789a6a5 100644 --- a/bl-kernel/admin/controllers/settings-advanced.php +++ b/bl-kernel/admin/controllers/settings-advanced.php @@ -29,11 +29,11 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // ============================================================================ // Main after POST // ============================================================================ -$allPublishedPages = buildAllpages(true); +$allPages = buildAllpages($publishedPages=true, $staticPages=true, $draftPages=false, $scheduledPages=false); // Homepage select options $homepageOptions = array(' '=>'- '.$L->g('Latest content').' -'); -foreach($allPublishedPages as $key=>$page) { +foreach ($allPages as $key=>$page) { $parentKey = $page->parentKey(); if ($parentKey) { $homepageOptions[$key] = $pagesByParentByKey[PARENT][$parentKey]->title() .'->'. $page->title(); diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index 105cbb7e..a1745a68 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -162,7 +162,7 @@ echo '
'; // Parent input // Check if the page has children - if(count($page->children())==0) { + if (count($page->children())==0) { $options = array(' '=>'- '.$L->g('No parent').' -'); $parentsList = $dbPages->getParents(); $parentsKey = array_keys($parentsList); @@ -180,9 +180,9 @@ echo '
'; 'selected'=>$page->parentKey(), 'tip'=>'' )); - } - echo '
'; + echo '
'; + } // Position input HTML::formInputText(array( diff --git a/bl-kernel/boot/rules/69.pages.php b/bl-kernel/boot/rules/69.pages.php index e1ee3cf2..f9d50445 100644 --- a/bl-kernel/boot/rules/69.pages.php +++ b/bl-kernel/boot/rules/69.pages.php @@ -100,7 +100,7 @@ if ($dbPages->scheduler()) { } // Generate pages parent tree, only published pages -buildPagesByParent(true); +buildPagesByParent(true, true); // Set home page is the user defined one if ($Site->homepage() && $Url->whereAmI()==='home') { diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/dbpages.class.php index 05355898..942f4910 100644 --- a/bl-kernel/dbpages.class.php +++ b/bl-kernel/dbpages.class.php @@ -264,7 +264,7 @@ class dbPages extends dbJSON } // Returns a database with published pages - public function getPublishedDB() + public function getPublishedDB($onlyKeys=false) { $tmp = $this->db; foreach ($tmp as $key=>$fields) { @@ -272,6 +272,9 @@ class dbPages extends dbJSON unset($tmp[$key]); } } + if ($onlyKeys) { + return array_keys($tmp); + } return $tmp; } @@ -293,7 +296,7 @@ class dbPages extends dbJSON } // Returns an array with a list of keys/database of draft pages - public function getDraftDB() + public function getDraftDB($onlyKeys=false) { $tmp = $this->db; foreach ($tmp as $key=>$fields) { @@ -301,11 +304,14 @@ class dbPages extends dbJSON unset($tmp[$key]); } } + if ($onlyKeys) { + return array_keys($tmp); + } return $tmp; } // Returns an array with a list of keys/database of scheduled pages - public function getScheduledDB() + public function getScheduledDB($onlyKeys=false) { $tmp = $this->db; foreach($tmp as $key=>$fields) { @@ -313,6 +319,9 @@ class dbPages extends dbJSON unset($tmp[$key]); } } + if ($onlyKeys) { + return array_keys($tmp); + } return $tmp; } diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index 6b9e1399..886bc153 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -168,28 +168,30 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) { // Generate the global variable $pagesByParent, defined on 69.pages.php // (boolean) $allPages, TRUE include all status, FALSE only include published status -function buildPagesByParent($onlyPublished=true) { +function buildPagesByParent($publishedPages=true, $staticPages=true) { global $dbPages; global $pagesByParent; global $pagesByParentByKey; - // Get DB - $pageNumber = 1; - $amountOfItems = -1; - $db = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished); + $onlyKeys = true; + $keys = array(); + if ($publishedPages) { + $keys = array_merge($keys, $dbPages->getPublishedDB($onlyKeys)); + } + if ($staticPages) { + $keys = array_merge($keys, $dbPages->getStaticDB($onlyKeys)); + } - // Get Keys - $keys = array_keys($db); - foreach($keys as $pageKey) { + foreach ($keys as $pageKey) { $page = buildPage($pageKey); - if($page!==false) { + if ($page!==false) { $parentKey = $page->parentKey(); // FALSE if the page is parent - if($parentKey===false) { + if ($parentKey===false) { array_push($pagesByParent[PARENT], $page); $pagesByParentByKey[PARENT][$page->key()] = $page; } else { - if( !isset($pagesByParent[$parentKey]) ) { + if (!isset($pagesByParent[$parentKey])) { $pagesByParent[$parentKey] = array(); } array_push($pagesByParent[$parentKey], $page); @@ -221,19 +223,29 @@ function buildStaticPages() { pageKeyN => Page object, ) */ -function buildAllpages($onlyPublished=true) { +function buildAllpages($publishedPages=true, $staticPages=true, $draftPages=true, $scheduledPages=true) { global $dbPages; // Get DB - $pageNumber = 1; - $amountOfItems = -1; - $db = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished); + $onlyKeys = true; + $keys = array(); + if ($publishedPages) { + $keys = array_merge($keys, $dbPages->getPublishedDB($onlyKeys)); + } + if ($staticPages) { + $keys = array_merge($keys, $dbPages->getStaticDB($onlyKeys)); + } + if ($draftPages) { + $keys = array_merge($keys, $dbPages->getDraftDB($onlyKeys)); + } + if ($scheduledPages) { + $keys = array_merge($keys, $dbPages->getScheduledDB($onlyKeys)); + } $tmp = array(); - $keys = array_keys($db); - foreach($keys as $pageKey) { + foreach ($keys as $pageKey) { $page = buildPage($pageKey); - if($page!==false) { + if ($page!==false) { $tmp[$page->key()] = $page; } } From 25d2a113fd8b01ffc1c3f2d28f041a5da251acef Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 22 Oct 2017 15:40:24 +0200 Subject: [PATCH 06/14] Google Analytics on head --- bl-plugins/google/plugin.php | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/bl-plugins/google/plugin.php b/bl-plugins/google/plugin.php index 1ac7ce82..124ac535 100644 --- a/bl-plugins/google/plugin.php +++ b/bl-plugins/google/plugin.php @@ -60,6 +60,20 @@ class pluginGoogle extends Plugin { $html .= "".PHP_EOL; } + // Google Analytics + if ($this->getValue('google-analytics-tracking-id')) { + $html = PHP_EOL.''.PHP_EOL; + $html .= ' + + '.PHP_EOL; + } + return $html; } @@ -75,22 +89,4 @@ class pluginGoogle extends Plugin { return false; } - public function siteBodyEnd() - { - // Google Analytics - if ($this->getValue('google-analytics-tracking-id')) { - $html = PHP_EOL.''.PHP_EOL; - $html .= ' - - '.PHP_EOL; - return $html; - } - return false; - } } \ No newline at end of file From c94c919f940d8cab71e7a548e88d80f1064df91f Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 22 Oct 2017 21:28:44 +0200 Subject: [PATCH 07/14] cleaning code --- bl-kernel/boot/site.php | 7 +++---- index.php | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bl-kernel/boot/site.php b/bl-kernel/boot/site.php index c021e1a4..87eef209 100644 --- a/bl-kernel/boot/site.php +++ b/bl-kernel/boot/site.php @@ -16,15 +16,14 @@ include(PATH_RULES.'99.themes.php'); Theme::plugins('beforeSiteLoad'); // Theme init.php -if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'init.php') ) { +if (Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'init.php')) { include(PATH_THEMES.$Site->theme().DS.'init.php'); } // Theme HTML -if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'index.php') ) { +if (Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'index.php')) { include(PATH_THEMES.$Site->theme().DS.'index.php'); -} -else { +} else { $Language->p('Please check your theme configuration'); } diff --git a/index.php b/index.php index 1a6457d2..cd288a5c 100644 --- a/index.php +++ b/index.php @@ -8,8 +8,7 @@ */ // Check if Bludit is installed -if( !file_exists('bl-content/databases/site.php') ) -{ +if (!file_exists('bl-content/databases/site.php')) { header('Location:./install.php'); exit('Install Bludit first.'); } From dce50dcff9fa3c386f09b6d74a572b6b897a079e Mon Sep 17 00:00:00 2001 From: Edi Date: Mon, 23 Oct 2017 12:24:51 +0200 Subject: [PATCH 08/14] Correction of typo --- bl-themes/clean-blog/php/home.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-themes/clean-blog/php/home.php b/bl-themes/clean-blog/php/home.php index 0015c96d..e090cf94 100644 --- a/bl-themes/clean-blog/php/home.php +++ b/bl-themes/clean-blog/php/home.php @@ -39,7 +39,7 @@
← '.$Language->get('Previuos page').''; + echo '← '.$Language->get('Previous page').''; } if(Paginator::showNext()) { @@ -52,4 +52,4 @@
-
\ No newline at end of file +
From 9aac2de4d8851c795f09d25248108324fef2e645 Mon Sep 17 00:00:00 2001 From: Edi Date: Mon, 23 Oct 2017 12:27:02 +0200 Subject: [PATCH 09/14] Update home.php --- bl-themes/micro/php/home.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-themes/micro/php/home.php b/bl-themes/micro/php/home.php index d2664f16..11784af5 100644 --- a/bl-themes/micro/php/home.php +++ b/bl-themes/micro/php/home.php @@ -29,7 +29,7 @@ } if (Paginator::showNext()) { - echo '
  • '.$L->get('Previuos').'
  • '; + echo '
  • '.$L->get('Previous').'
  • '; } ?> - \ No newline at end of file + From d2908144370e7bdb523dadf761d6eff634fe1c6e Mon Sep 17 00:00:00 2001 From: Edi Date: Mon, 23 Oct 2017 18:23:26 +0200 Subject: [PATCH 10/14] Fix pagination --- bl-themes/micro/php/home.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-themes/micro/php/home.php b/bl-themes/micro/php/home.php index 11784af5..8b127652 100644 --- a/bl-themes/micro/php/home.php +++ b/bl-themes/micro/php/home.php @@ -25,11 +25,11 @@ From 98a1a8f34b81560a516a8cdf4da48f2d567408b8 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Mon, 23 Oct 2017 22:11:56 +0200 Subject: [PATCH 11/14] Bug fixes home link enable disable --- bl-plugins/latest-content/plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-plugins/latest-content/plugin.php b/bl-plugins/latest-content/plugin.php index 4878009f..b2f62d79 100644 --- a/bl-plugins/latest-content/plugin.php +++ b/bl-plugins/latest-content/plugin.php @@ -26,8 +26,8 @@ class pluginLatestContent extends Plugin { $html .= '
    '; $html .= ''; $html .= ''; $html .= ''.$Language->get('Show the home link on the sidebar').''; $html .= '
    '; From 73678629d350a5e7339ab5b2c88946ae379d6282 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Mon, 23 Oct 2017 22:50:22 +0200 Subject: [PATCH 12/14] Bludit v2.0.1 --- bl-kernel/boot/init.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 62e33a8d..00f6890f 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -1,10 +1,10 @@ Date: Tue, 24 Oct 2017 12:03:43 +0200 Subject: [PATCH 13/14] Pagination --- bl-themes/kernel-panic/php/home.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bl-themes/kernel-panic/php/home.php b/bl-themes/kernel-panic/php/home.php index f0ca152a..4847120d 100644 --- a/bl-themes/kernel-panic/php/home.php +++ b/bl-themes/kernel-panic/php/home.php @@ -25,4 +25,16 @@ - \ No newline at end of file + + + + From a82a28bd756fe9bdfd834bc2b11c2d1c08eef508 Mon Sep 17 00:00:00 2001 From: Edi Date: Tue, 24 Oct 2017 12:04:38 +0200 Subject: [PATCH 14/14] Float for pagination --- bl-themes/kernel-panic/css/bludit.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bl-themes/kernel-panic/css/bludit.css b/bl-themes/kernel-panic/css/bludit.css index 338f701c..c73054bc 100755 --- a/bl-themes/kernel-panic/css/bludit.css +++ b/bl-themes/kernel-panic/css/bludit.css @@ -57,6 +57,16 @@ article.page footer { text-align: right; } +/* PAGINATION */ + +.pagination { + width: 100%; +} + +.pagination > li > a.float-right { + float: right; +} + /* PLUGINS */ div.plugin:not(:last-child) { @@ -102,4 +112,4 @@ div.plugin-pages li.parent h3 { div.plugin-pages ul.child { margin-left: 5px; -} \ No newline at end of file +}