From 9f6e717f9d30b5971ce2ff52e6df6935858ab5e3 Mon Sep 17 00:00:00 2001 From: Cloud User <centos@marcus.oyvindg.no> Date: Thu, 29 Oct 2020 21:34:30 +0100 Subject: [PATCH] add extension Striptags to loader --- classes/Utils.php | 3 ++- classes/modules/serviceModule.php | 2 +- classes/modules/uriModule.php | 4 ++-- lib/Haanga/lib/Haanga.php | 2 +- lib/Haanga/lib/Haanga/Compiler/Tokenizer.php | 4 ++-- lib/Haanga/lib/Haanga/Loader.php | 1 + 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/classes/Utils.php b/classes/Utils.php index 0899f134..c0dc1d68 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -84,7 +84,8 @@ class Utils{ $row[$k]['value'] = $v['value']; if($v['type'] == 'uri'){ $row[$k]['curie'] = Utils::uri2curie($v['value']); - $row[$k]['localname'] = array_pop(explode(":",$row[$k]['curie'])); + $exploded = explode(":",$row[$k]['curie']); + $row[$k]['localname'] = array_pop($exploded); $row[$k]['uri'] = 1; }elseif($v['type'] == 'bnode'){ $row[$k]['curie'] = 'blankNode'; diff --git a/classes/modules/serviceModule.php b/classes/modules/serviceModule.php index 044ef11a..abee954d 100644 --- a/classes/modules/serviceModule.php +++ b/classes/modules/serviceModule.php @@ -50,7 +50,7 @@ class ServiceModule extends abstractModule{ $lodspk['model'] = $conf['home'].$conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'; $lodspk['view'] = $conf['home'].$conf['view']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$extension.'.template'; }else{ - if($lodspk['model'] == null && $lodspk['view'] == null){ + if(is_null($lodspk['model']) && is_null($lodspk['view'])){ //checking other components if(sizeof($conf['components']['services'])>0){ foreach($conf['components']['services'] as $service){ diff --git a/classes/modules/uriModule.php b/classes/modules/uriModule.php index 520a044d..ffdc7f3a 100644 --- a/classes/modules/uriModule.php +++ b/classes/modules/uriModule.php @@ -21,8 +21,8 @@ class UriModule extends abstractModule{ $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); #Stripping html to look up and write correct url in database if not exists #Fix to handle pages that have not been loaded after cleaning out database - $localUri_stripped = preg_replace("^(.+)\.html", "\\1", $localUri); - $uri_stripped = preg_replace("^(.+)\.html", "\\1", $uri); + $localUri_stripped = preg_replace("^(.+)\.html$", "\\1", $localUri); + $uri_stripped = preg_replace("^(.+)\.html$", "\\1", $uri); if($pair == NULL){ // Original URI is not in metadata if(Queries::uriExist($uri_stripped, $endpoints['local'])){ $page = Queries::createPage($uri_stripped, $localUri_stripped, $acceptContentType, $metaDb); diff --git a/lib/Haanga/lib/Haanga.php b/lib/Haanga/lib/Haanga.php index bc52e3c7..6232fa13 100644 --- a/lib/Haanga/lib/Haanga.php +++ b/lib/Haanga/lib/Haanga.php @@ -136,7 +136,7 @@ class Haanga } break; default: - continue; + continue 2; } } } diff --git a/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php b/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php index 3448562c..5dad9f1a 100644 --- a/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php +++ b/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php @@ -435,7 +435,7 @@ class Haanga_Compiler_Tokenizer case 0: // match if (isset($data[$len]) && !$this->is_token_end($data[$len])) { /* probably a variable name TRUEfoo (and not TRUE) */ - continue; + continue 2; } $this->token = $token; $this->value = $value; @@ -558,7 +558,7 @@ class Haanga_Compiler_Tokenizer static function init($template, $compiler, $file='') { $lexer = new Haanga_Compiler_Tokenizer($template, $compiler, $file); - file_put_contents('/var/www/sites/katalogskeivtarkiv/tmp/foo.php', $file . "\n", FILE_APPEND); + file_put_contents('/var/www/html/marcus-prod/cache/foo.php', $file . "\n", FILE_APPEND); $parser = new Haanga_Compiler_Parser($lexer, $file); $parser->compiler = $compiler; diff --git a/lib/Haanga/lib/Haanga/Loader.php b/lib/Haanga/lib/Haanga/Loader.php index d95d5aa8..43416211 100644 --- a/lib/Haanga/lib/Haanga/Loader.php +++ b/lib/Haanga/lib/Haanga/Loader.php @@ -62,6 +62,7 @@ spl_autoload_register(function ($class) { 'haanga_extension_filter_slugify' => '/Extension/Filter/Slugify.php', 'haanga_extension_filter_decodedescription' => '/Extension/Filter/Decodedescription.php', 'haanga_extension_filter_deurifier' => '/Extension/Filter/Deurifier.php', + 'haanga_extension_filter_striptags' => '/Extension/Filter/Striptags.php', 'haanga_extension_tag' => '/Extension/Tag.php', -- GitLab