search function

This commit is contained in:
Diego Najar 2018-10-01 16:34:28 +02:00
parent 130dbb22e8
commit 74687b0e65
31 changed files with 2987 additions and 16 deletions

View File

@ -91,6 +91,10 @@ body.login {
#dashboard ul.list-group.list-group-striped li { #dashboard ul.list-group.list-group-striped li {
border: none; border: none;
word-break: break-word;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
} }
#dashboard ul.list-group.list-group-striped li:nth-of-type(even) { #dashboard ul.list-group.list-group-striped li:nth-of-type(even) {
@ -112,6 +116,13 @@ body.login {
color: #4586d4; color: #4586d4;
} }
#good-message {
margin-bottom: 20px;
border: 1px solid #f1f1f1;
padding: 20px;
color: #777;
}
.ct-series-a .ct-line { .ct-series-a .ct-line {
/* Set the colour of this series line */ /* Set the colour of this series line */
stroke: #4a90e2; stroke: #4a90e2;

View File

@ -2,6 +2,25 @@
<div class="row"> <div class="row">
<div class="col-md-7 d-none d-sm-block"> <div class="col-md-7 d-none d-sm-block">
<!-- Good message -->
<div>
<h2 id="good-message">Hello!</h2>
<script>
$( document ).ready(function() {
var date = new Date()
var hours = date.getHours()
if (hours < 12) {
$("#good-message").html("<?php echo $L->g('good-morning') ?>");
} else if (hours < 18) {
$("#good-message").html("<?php echo $L->g('good-afternoon') ?>");
} else {
$("#good-message").html("<?php echo $L->g('good-evening') ?>");
}
});
</script>
</div>
<!-- Quick Links --> <!-- Quick Links -->
<div class="container border-bottom pb-4"> <div class="container border-bottom pb-4">
<h4 class="pb-3"><?php $L->p('Quick links') ?></h4> <h4 class="pb-3"><?php $L->p('Quick links') ?></h4>

View File

@ -24,10 +24,11 @@ $plugins = array(
'adminContentSidebar'=>array(), 'adminContentSidebar'=>array(),
'dashboard'=>array(), 'dashboard'=>array(),
'beforeRulesLoad'=>array(),
'beforeAll'=>array(), 'beforeAll'=>array(),
'afterAll'=>array(), 'afterAll'=>array(),
'paginator'=>array(),
'afterPageCreate'=>array(), 'afterPageCreate'=>array(),
'afterPageModify'=>array(), 'afterPageModify'=>array(),
'afterPageDelete'=>array(), 'afterPageDelete'=>array(),

View File

@ -4,25 +4,25 @@
$currentPage = $url->pageNumber(); $currentPage = $url->pageNumber();
Paginator::set('currentPage', $currentPage); Paginator::set('currentPage', $currentPage);
if($url->whereAmI()=='admin') { if ($url->whereAmI()=='admin') {
$itemsPerPage = ITEMS_PER_PAGE_ADMIN; $itemsPerPage = ITEMS_PER_PAGE_ADMIN;
$numberOfItems = $pages->count(true); $numberOfItems = $pages->count(true);
} } elseif ($url->whereAmI()=='tag') {
elseif($url->whereAmI()=='tag') {
$itemsPerPage = $site->itemsPerPage(); $itemsPerPage = $site->itemsPerPage();
$tagKey = $url->slug(); $tagKey = $url->slug();
$numberOfItems = $tags->numberOfPages($tagKey); $numberOfItems = $tags->numberOfPages($tagKey);
} } elseif ($url->whereAmI()=='category') {
elseif($url->whereAmI()=='category') {
$itemsPerPage = $site->itemsPerPage(); $itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug(); $categoryKey = $url->slug();
$numberOfItems = $categories->numberOfPages($categoryKey); $numberOfItems = $categories->numberOfPages($categoryKey);
} } else {
else {
$itemsPerPage = $site->itemsPerPage(); $itemsPerPage = $site->itemsPerPage();
$numberOfItems = $pages->count(true); $numberOfItems = $pages->count(true);
} }
// Execute hook from plugins
Theme::plugins('paginator');
// Items per page // Items per page
Paginator::set('itemsPerPage', $itemsPerPage); Paginator::set('itemsPerPage', $itemsPerPage);

View File

@ -33,4 +33,3 @@ Theme::plugins('afterSiteLoad');
// Plugins after all // Plugins after all
Theme::plugins('afterAll'); Theme::plugins('afterAll');

View File

@ -190,14 +190,18 @@ class Text {
} }
// Find position of first occurrence of substring in a string otherwise returns FALSE. // Find position of first occurrence of substring in a string otherwise returns FALSE.
public static function stringPosition($string, $substring) public static function stringPosition($string, $substring, $caseSensitive=true)
{ {
return mb_strpos($string, $substring, 0, CHARSET); if ($caseSensitive) {
return mb_strpos($string, $substring, 0, CHARSET);
}
return mb_stripos($string, $substring, 0, CHARSET);
} }
public static function stringContains($string, $substring) public static function stringContains($string, $substring, $caseSensitive=true)
{ {
return (self::stringPosition($string, $substring) !== false); return (self::stringPosition($string, $substring, $caseSensitive) !== false);
} }
// Returns the portion of string specified by the start and length parameters. // Returns the portion of string specified by the start and length parameters.

View File

@ -248,8 +248,6 @@ class Site extends dbJSON {
return $this->getField('url'); return $this->getField('url');
} }
// Returns the protocol and the domain, without the base url // Returns the protocol and the domain, without the base url
// For example, http://www.domain.com // For example, http://www.domain.com
public function domain() public function domain()

View File

@ -356,5 +356,8 @@
"last": "Last", "last": "Last",
"there-are-no-pages-at-this-moment": "There are no pages at this moment.", "there-are-no-pages-at-this-moment": "There are no pages at this moment.",
"there-are-no-static-pages-at-this-moment": "There are no static pages at this moment.", "there-are-no-static-pages-at-this-moment": "There are no static pages at this moment.",
"there-are-no-draft-pages-at-this-moment": "There are no draft pages at this moment." "there-are-no-draft-pages-at-this-moment": "There are no draft pages at this moment.",
"good-morning": "Good morning!",
"good-afternoon": "Good afternoon!",
"good-evening": "Good evening!"
} }

View File

@ -0,0 +1,320 @@
/*
* easy-autocomplete
* jQuery plugin for autocompletion
*
* @author Łukasz Pawełczak (http://github.com/pawelczak)
* @version 1.3.5
* Copyright License:
*/
.easy-autocomplete {
position: relative;
}
.easy-autocomplete input {
border-color: #ccc;
border-radius: 4px;
border-style: solid;
border-width: 1px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
color: #555;
float: none;
padding: 6px 12px;
}
.easy-autocomplete input:hover, .easy-autocomplete input:focus {
box-shadow: none;
}
.easy-autocomplete a {
display: block;
}
.easy-autocomplete.eac-blue-light input:hover, .easy-autocomplete.eac-blue-light input:focus {
border-color: #66afe9;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
}
.easy-autocomplete.eac-blue-light ul {
border-color: #66afe9;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
}
.easy-autocomplete.eac-blue-light ul li, .easy-autocomplete.eac-blue-light ul .eac-category {
border-color: #66afe9;
}
.easy-autocomplete.eac-blue-light ul li.selected, .easy-autocomplete.eac-blue-light ul .eac-category.selected {
background-color: #ecf5fc;
}
.easy-autocomplete.eac-green-light input:hover, .easy-autocomplete.eac-green-light input:focus {
border-color: #41DB00;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(146, 237, 107, 0.6);
}
.easy-autocomplete.eac-green-light ul {
border-color: #41DB00;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(146, 237, 107, 0.6);
}
.easy-autocomplete.eac-green-light ul li, .easy-autocomplete.eac-green-light ul .eac-category {
border-color: #41DB00;
}
.easy-autocomplete.eac-green-light ul li.selected, .easy-autocomplete.eac-green-light ul .eac-category.selected {
background-color: #9eff75;
}
.easy-autocomplete.eac-red-light input:hover, .easy-autocomplete.eac-red-light input:focus {
border-color: #ff5b5b;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 90, 90, 0.6);
}
.easy-autocomplete.eac-red-light ul {
border-color: #ff5b5b;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 90, 90, 0.6);
}
.easy-autocomplete.eac-red-light ul li, .easy-autocomplete.eac-red-light ul .eac-category {
border-color: #ff5b5b;
}
.easy-autocomplete.eac-red-light ul li.selected, .easy-autocomplete.eac-red-light ul .eac-category.selected {
background-color: #ff8e8e;
}
.easy-autocomplete.eac-yellow-light input:hover, .easy-autocomplete.eac-yellow-light input:focus {
border-color: #ffdb00;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 231, 84, 0.6);
}
.easy-autocomplete.eac-yellow-light ul {
border-color: #ffdb00;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 231, 84, 0.6);
}
.easy-autocomplete.eac-yellow-light ul li, .easy-autocomplete.eac-yellow-light ul .eac-category {
border-color: #ffdb00;
}
.easy-autocomplete.eac-yellow-light ul li.selected, .easy-autocomplete.eac-yellow-light ul .eac-category.selected {
background-color: #ffe233;
}
.easy-autocomplete.eac-dark-light input:hover, .easy-autocomplete.eac-dark-light input:focus {
border-color: #333;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(55, 55, 55, 0.6);
}
.easy-autocomplete.eac-dark-light ul {
border-color: #333;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(55, 55, 55, 0.6);
}
.easy-autocomplete.eac-dark-light ul li, .easy-autocomplete.eac-dark-light ul .eac-category {
border-color: #333;
}
.easy-autocomplete.eac-dark-light ul li.selected, .easy-autocomplete.eac-dark-light ul .eac-category.selected {
background-color: #4d4d4d;
color: #fff;
}
.easy-autocomplete.eac-dark {
color: #fff;
}
.easy-autocomplete.eac-dark input {
background-color: #404040;
border-radius: 4px;
box-shadow: 0;
color: #f6f6f6;
}
.easy-autocomplete.eac-dark input:hover, .easy-autocomplete.eac-dark input:focus {
border-color: #333;
box-shadow: 0;
}
.easy-autocomplete.eac-dark ul {
border-color: #333;
}
.easy-autocomplete.eac-dark ul li, .easy-autocomplete.eac-dark ul .eac-category {
background-color: #404040;
border-color: #333;
}
.easy-autocomplete.eac-dark ul li.selected, .easy-autocomplete.eac-dark ul .eac-category.selected {
background-color: #737373;
color: #f6f6f6;
}
.easy-autocomplete.eac-dark-glass {
color: #fff;
}
.easy-autocomplete.eac-dark-glass input {
background-color: rgba(0, 0, 0, 0.8);
border-radius: 4px;
box-shadow: 0;
color: #f6f6f6;
}
.easy-autocomplete.eac-dark-glass input:hover, .easy-autocomplete.eac-dark-glass input:focus {
border-color: rgba(0, 0, 0, 0.8);
box-shadow: 0;
}
.easy-autocomplete.eac-dark-glass ul {
border-color: rgba(0, 0, 0, 0.8);
}
.easy-autocomplete.eac-dark-glass ul li, .easy-autocomplete.eac-dark-glass ul .eac-category {
background-color: rgba(0, 0, 0, 0.8);
border-color: rgba(0, 0, 0, 0.8);
}
.easy-autocomplete.eac-dark-glass ul li.selected, .easy-autocomplete.eac-dark-glass ul .eac-category.selected {
background-color: rgba(64, 64, 64, 0.8);
color: #f6f6f6;
}
.easy-autocomplete.eac-dark-glass ul li:last-child, .easy-autocomplete.eac-dark-glass ul .eac-category:last-child {
border-radius: 0 0 4px 4px;
}
.easy-autocomplete.eac-blue {
color: #fff;
}
.easy-autocomplete.eac-blue input {
background-color: #6d9ed1;
border-radius: 4px;
box-shadow: 0;
color: #f6f6f6;
}
.easy-autocomplete.eac-blue input::-webkit-input-placeholder {
color: #f6f6f6;
}
.easy-autocomplete.eac-blue input:-moz-placeholder {
color: #f6f6f6;
}
.easy-autocomplete.eac-blue input::-moz-placeholder {
color: #f6f6f6;
}
.easy-autocomplete.eac-blue input:-ms-input-placeholder {
color: #f6f6f6;
}
.easy-autocomplete.eac-blue input:hover, .easy-autocomplete.eac-blue input:focus {
border-color: #5A91CB;
box-shadow: 0;
}
.easy-autocomplete.eac-blue ul {
border-color: #5A91CB;
}
.easy-autocomplete.eac-blue ul li, .easy-autocomplete.eac-blue ul .eac-category {
background-color: #6d9ed1;
border-color: #5A91CB;
}
.easy-autocomplete.eac-blue ul li.selected, .easy-autocomplete.eac-blue ul .eac-category.selected {
background-color: #94b8dd;
color: #f6f6f6;
}
.easy-autocomplete.eac-yellow {
color: #333;
}
.easy-autocomplete.eac-yellow input {
background-color: #ffdb7e;
border-color: #333;
border-radius: 4px;
box-shadow: 0;
color: #333;
}
.easy-autocomplete.eac-yellow input:hover, .easy-autocomplete.eac-yellow input:focus {
border-color: #333;
box-shadow: 0;
}
.easy-autocomplete.eac-yellow ul {
border-color: #333;
}
.easy-autocomplete.eac-yellow ul li, .easy-autocomplete.eac-yellow ul .eac-category {
background-color: #ffdb7e;
border-color: #333;
}
.easy-autocomplete.eac-yellow ul li.selected, .easy-autocomplete.eac-yellow ul .eac-category.selected {
background-color: #ffe9b1;
color: #333;
}
.easy-autocomplete.eac-purple {
color: #333;
}
.easy-autocomplete.eac-purple input {
background-color: #d6d1e7;
border-color: #b8afd5;
box-shadow: 0;
color: #333;
}
.easy-autocomplete.eac-purple input:hover, .easy-autocomplete.eac-purple input:focus {
border-color: #333;
box-shadow: 0;
}
.easy-autocomplete.eac-purple ul {
border-color: #333;
}
.easy-autocomplete.eac-purple ul li, .easy-autocomplete.eac-purple ul .eac-category {
background-color: #d6d1e7;
border-color: #333;
}
.easy-autocomplete.eac-purple ul li.selected, .easy-autocomplete.eac-purple ul .eac-category.selected {
background-color: #ebe8f3;
color: #333;
}
.easy-autocomplete.eac-bootstrap input {
border-color: #ccc;
border-radius: 4px;
border-style: solid;
border-width: 1px;
color: #555;
padding: 6px 12px;
}
.easy-autocomplete-container {
left: 0;
position: absolute;
width: 100%;
z-index: 2;
}
.easy-autocomplete-container ul {
background: none repeat scroll 0 0 #ffffff;
border-top: 1px dotted #ccc;
display: none;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
position: relative;
top: -1px;
}
.easy-autocomplete-container ul li, .easy-autocomplete-container ul .eac-category {
background: inherit;
border-color: #ccc;
border-image: none;
border-style: solid;
border-width: 0 1px;
display: block;
font-size: 14px;
font-weight: normal;
padding: 4px 12px;
}
.easy-autocomplete-container ul li:last-child {
border-radius: 0 0 2px 2px;
border-width: 0 1px 1px;
}
.easy-autocomplete-container ul li.selected {
background: none repeat scroll 0 0 #ebebeb;
cursor: pointer;
}
.easy-autocomplete-container ul li.selected div {
font-weight: normal;
}
.easy-autocomplete-container ul li div {
display: block;
font-weight: normal;
word-break: break-all;
}
.easy-autocomplete-container ul li b {
font-weight: bold;
}
.easy-autocomplete-container ul .eac-category {
font-color: #aaa;
font-style: italic;
}
.eac-description .eac-item span {
color: #aaa;
font-style: italic;
font-size: 0.9em;
}
.eac-icon-left .eac-item img {
margin-right: 4px;
max-height: 30px;
}
.eac-icon-right .eac-item {
margin-top: 8px;
min-height: 24px;
position: relative;
}
.eac-icon-right .eac-item img {
margin-left: 4px;
max-height: 30px;
position: absolute;
right: -4px;
top: -8px;
}
/*# sourceMappingURL=easy-autocomplete.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,208 @@
/*
* easy-autocomplete
* jQuery plugin for autocompletion
*
* @author Łukasz Pawełczak (http://github.com/pawelczak)
* @version 1.3.5
* Copyright License:
*/
.easy-autocomplete {
/* Theme Square */
/* Round */
/* Funky */
/* Solid */
/* Plate */
}
.easy-autocomplete.eac-square {
font-family: "Roboto", "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.easy-autocomplete.eac-square input {
border: 1px solid #7f8c8d;
border-radius: 0;
color: #7f8c8d;
font-family: inherit;
font-size: 18px;
font-style: italic;
font-weight: 300;
margin: 0;
min-width: 350px;
padding: 12px 43px 12px 15px;
}
.easy-autocomplete.eac-square ul {
border-color: #7f8c8d;
border-top: 0;
box-shadow: none;
top: 0;
}
.easy-autocomplete.eac-square ul li, .easy-autocomplete.eac-square ul .eac-category {
border-color: #7f8c8d;
font-family: inherit;
font-size: 16px;
font-weight: 300;
padding: 6px 12px;
transition: all 0.4s ease 0s;
}
.easy-autocomplete.eac-square ul li *, .easy-autocomplete.eac-square ul .eac-category * {
font-weight: 300;
}
.easy-autocomplete.eac-square ul li.selected, .easy-autocomplete.eac-square ul .eac-category.selected {
background-color: #f1f1f1;
font-weight: 300;
}
.easy-autocomplete.eac-square ul li b, .easy-autocomplete.eac-square ul .eac-category b {
font-weight: 600;
}
.easy-autocomplete.eac-round {
font-family: "Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.easy-autocomplete.eac-round input {
border: 2px solid #888;
border-radius: 10px;
color: #888;
font-family: inherit;
font-size: 16px;
font-weight: 400;
margin: 0;
min-width: 300px;
padding: 10px;
}
.easy-autocomplete.eac-round input:hover, .easy-autocomplete.eac-round input:focus {
border-color: #3079ed;
}
.easy-autocomplete.eac-round ul {
background: none;
border-color: #888;
border-width: 0;
box-shadow: none;
min-width: 300px;
top: 20px;
}
.easy-autocomplete.eac-round ul li, .easy-autocomplete.eac-round ul .eac-category {
background: #fff;
border-color: #3079ed;
border-width: 0 2px;
font-size: 14px;
padding: 8px 12px;
transition: all 0.4s ease 0s;
}
.easy-autocomplete.eac-round ul li.selected, .easy-autocomplete.eac-round ul .eac-category.selected {
background-color: #d4e3fb;
}
.easy-autocomplete.eac-round ul li:first-child, .easy-autocomplete.eac-round ul .eac-category:first-child {
border-radius: 10px 10px 0 0;
border-width: 2px 2px 0;
}
.easy-autocomplete.eac-round ul li:last-child, .easy-autocomplete.eac-round ul .eac-category:last-child {
border-radius: 0 0 10px 10px;
border-width: 0 2px 2px;
}
.easy-autocomplete.eac-round ul li b, .easy-autocomplete.eac-round ul .eac-category b {
font-weight: 700;
}
.easy-autocomplete.eac-funky {
font-family: "Inconsolata", "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.easy-autocomplete.eac-funky input {
background: #07ED89;
border: 0;
border-radius: 0;
color: #ED076B;
font-family: inherit;
font-size: 18px;
min-width: 240px;
padding: 12px;
}
.easy-autocomplete.eac-funky ul {
background: transparent;
border: 0;
}
.easy-autocomplete.eac-funky ul li, .easy-autocomplete.eac-funky ul .eac-category {
background: transparent;
border: 0;
color: #ED076B;
font-size: 18px;
padding: 4px 12px;
transition: all 0.4s ease 0s;
}
.easy-autocomplete.eac-funky ul li.selected, .easy-autocomplete.eac-funky ul .eac-category.selected {
color: #8907ED;
}
.easy-autocomplete.eac-solid input {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) inset;
border-color: #ddd;
color: #666;
font-size: 13px;
min-height: 0;
padding: 6px 12px;
}
.easy-autocomplete.eac-solid ul li, .easy-autocomplete.eac-solid ul .eac-category {
transition: all 0.4s ease 0s;
}
.easy-autocomplete.eac-solid ul li.selected, .easy-autocomplete.eac-solid ul .eac-category.selected {
background-color: #f2f2f2;
}
.easy-autocomplete.eac-plate {
font-family: "Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.easy-autocomplete.eac-plate input {
font-size: 13px;
padding: 6px 12px;
}
.easy-autocomplete.eac-plate ul {
background: #b5b5b5;
border-radius: 6px;
border-width: 0;
top: 10px;
}
.easy-autocomplete.eac-plate ul li, .easy-autocomplete.eac-plate ul .eac-category {
background: #b5b5b5;
color: #FAFAFA;
font-size: 12px;
transition: all 0.4s ease 0s;
}
.easy-autocomplete.eac-plate ul li b, .easy-autocomplete.eac-plate ul .eac-category b {
color: #ffd464;
}
.easy-autocomplete.eac-plate ul li.selected, .easy-autocomplete.eac-plate ul .eac-category.selected {
background: #656565;
}
.easy-autocomplete.eac-plate ul li:first-child, .easy-autocomplete.eac-plate ul .eac-category:first-child {
border-radius: 6px 6px 0 0;
}
.easy-autocomplete.eac-plate ul li:last-child, .easy-autocomplete.eac-plate ul .eac-category:last-child {
border-radius: 0 0 6px 6px;
}
.easy-autocomplete.eac-plate-dark {
font-family: "Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.easy-autocomplete.eac-plate-dark input {
font-size: 13px;
padding: 6px 12px;
}
.easy-autocomplete.eac-plate-dark ul {
background: #212121;
border-radius: 6px;
border-width: 0;
top: 10px;
}
.easy-autocomplete.eac-plate-dark ul li, .easy-autocomplete.eac-plate-dark ul .eac-category {
background: #212121;
color: #FAFAFA;
font-size: 12px;
transition: all 0.4s ease 0s;
}
.easy-autocomplete.eac-plate-dark ul li b, .easy-autocomplete.eac-plate-dark ul .eac-category b {
color: #ffd464;
}
.easy-autocomplete.eac-plate-dark ul li.selected, .easy-autocomplete.eac-plate-dark ul .eac-category.selected {
background: #656565;
}
.easy-autocomplete.eac-plate-dark ul li:first-child, .easy-autocomplete.eac-plate-dark ul .eac-category:first-child {
border-radius: 6px 6px 0 0;
}
.easy-autocomplete.eac-plate-dark ul li:last-child, .easy-autocomplete.eac-plate-dark ul .eac-category:last-child {
border-radius: 0 0 6px 6px;
}
/*# sourceMappingURL=easy-autocomplete.themes.css.map */

File diff suppressed because one or more lines are too long

1
bl-plugins/search/css/jquery.modal.min.css vendored Executable file
View File

@ -0,0 +1 @@
.blocker{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;overflow:auto;z-index:1;padding:20px;box-sizing:border-box;background-color:#000;background-color:rgba(0,0,0,0.75);text-align:center}.blocker:before{content:"";display:inline-block;height:100%;vertical-align:middle;margin-right:-0.05em}.blocker.behind{background-color:transparent}.modal{display:none;vertical-align:middle;position:relative;z-index:2;max-width:500px;box-sizing:border-box;width:90%;background:#fff;padding:15px 30px;-webkit-border-radius:8px;-moz-border-radius:8px;-o-border-radius:8px;-ms-border-radius:8px;border-radius:8px;-webkit-box-shadow:0 0 10px #000;-moz-box-shadow:0 0 10px #000;-o-box-shadow:0 0 10px #000;-ms-box-shadow:0 0 10px #000;box-shadow:0 0 10px #000;text-align:left}.modal a.close-modal{position:absolute;top:-12.5px;right:-12.5px;display:block;width:30px;height:30px;text-indent:-9999px;background-size:contain;background-repeat:no-repeat;background-position:center center;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAA3hJREFUaAXlm8+K00Acx7MiCIJH/yw+gA9g25O49SL4AO3Bp1jw5NvktC+wF88qevK4BU97EmzxUBCEolK/n5gp3W6TTJPfpNPNF37MNsl85/vN/DaTmU6PknC4K+pniqeKJ3k8UnkvDxXJzzy+q/yaxxeVHxW/FNHjgRSeKt4rFoplzaAuHHDBGR2eS9G54reirsmienDCTRt7xwsp+KAoEmt9nLaGitZxrBbPFNaGfPloGw2t4JVamSt8xYW6Dg1oCYo3Yv+rCGViV160oMkcd8SYKnYV1Nb1aEOjCe6L5ZOiLfF120EjWhuBu3YIZt1NQmujnk5F4MgOpURzLfAwOBSTmzp3fpDxuI/pabxpqOoz2r2HLAb0GMbZKlNV5/Hg9XJypguryA7lPF5KMdTZQzHjqxNPhWhzIuAruOl1eNqKEx1tSh5rfbxdw7mOxCq4qS68ZTjKS1YVvilu559vWvFHhh4rZrdyZ69Vmpgdj8fJbDZLJpNJ0uv1cnr/gjrUhQMuI+ANjyuwftQ0bbL6Erp0mM/ny8Fg4M3LtdRxgMtKl3jwmIHVxYXChFy94/Rmpa/pTbNUhstKV+4Rr8lLQ9KlUvJKLyG8yvQ2s9SBy1Jb7jV5a0yapfF6apaZLjLLcWtd4sNrmJUMHyM+1xibTjH82Zh01TNlhsrOhdKTe00uAzZQmN6+KW+sDa/JD2PSVQ873m29yf+1Q9VDzfEYlHi1G5LKBBWZbtEsHbFwb1oYDwr1ZiF/2bnCSg1OBE/pfr9/bWx26UxJL3ONPISOLKUvQza0LZUxSKyjpdTGa/vDEr25rddbMM0Q3O6Lx3rqFvU+x6UrRKQY7tyrZecmD9FODy8uLizTmilwNj0kraNcAJhOp5aGVwsAGD5VmJBrWWbJSgWT9zrzWepQF47RaGSiKfeGx6Szi3gzmX/HHbihwBser4B9UJYpFBNX4R6vTn3VQnez0SymnrHQMsRYGTr1dSk34ljRqS/EMd2pLQ8YBp3a1PLfcqCpo8gtHkZFHKkTX6fs3MY0blKnth66rKCnU0VRGu37ONrQaA4eZDFtWAu2fXj9zjFkxTBOo8F7t926gTp/83Kyzzcy2kZD6xiqxTYnHLRFm3vHiRSwNSjkz3hoIzo8lCKWUlg/YtGs7tObunDAZfpDLbfEI15zsEIY3U/x/gHHc/G1zltnAgAAAABJRU5ErkJggg==')}.modal-spinner{display:none;position:fixed;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);padding:12px 16px;border-radius:5px;background-color:#111;height:20px}.modal-spinner>div{border-radius:100px;background-color:#fff;height:20px;width:2px;margin:0 1px;display:inline-block;-webkit-animation:sk-stretchdelay 1.2s infinite ease-in-out;animation:sk-stretchdelay 1.2s infinite ease-in-out}.modal-spinner .rect2{-webkit-animation-delay:-1.1s;animation-delay:-1.1s}.modal-spinner .rect3{-webkit-animation-delay:-1.0s;animation-delay:-1.0s}.modal-spinner .rect4{-webkit-animation-delay:-0.9s;animation-delay:-0.9s}@-webkit-keyframes sk-stretchdelay{0%,40%,100%{-webkit-transform:scaleY(0.5)}20%{-webkit-transform:scaleY(1.0)}}@keyframes sk-stretchdelay{0%,40%,100%{transform:scaleY(0.5);-webkit-transform:scaleY(0.5)}20%{transform:scaleY(1.0);-webkit-transform:scaleY(1.0)}}

View File

@ -0,0 +1,323 @@
/*
* Remodal - v1.1.1
* Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking.
* http://vodkabears.github.io/remodal/
*
* Made by Ilya Makarov
* Under MIT License
*/
/* ==========================================================================
Remodal's default mobile first theme
========================================================================== */
/* Default theme styles for the background */
.remodal-bg.remodal-is-opening,
.remodal-bg.remodal-is-opened {
-webkit-filter: blur(3px);
filter: blur(3px);
}
/* Default theme styles of the overlay */
.remodal-overlay {
background: rgba(43, 46, 56, 0.9);
}
.remodal-overlay.remodal-is-opening,
.remodal-overlay.remodal-is-closing {
-webkit-animation-duration: 0.3s;
animation-duration: 0.3s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.remodal-overlay.remodal-is-opening {
-webkit-animation-name: remodal-overlay-opening-keyframes;
animation-name: remodal-overlay-opening-keyframes;
}
.remodal-overlay.remodal-is-closing {
-webkit-animation-name: remodal-overlay-closing-keyframes;
animation-name: remodal-overlay-closing-keyframes;
}
/* Default theme styles of the wrapper */
.remodal-wrapper {
padding: 10px 10px 0;
}
/* Default theme styles of the modal dialog */
.remodal {
box-sizing: border-box;
width: 100%;
margin-bottom: 10px;
padding: 35px;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
color: #2b2e38;
background: #fff;
}
.remodal.remodal-is-opening,
.remodal.remodal-is-closing {
-webkit-animation-duration: 0.3s;
animation-duration: 0.3s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.remodal.remodal-is-opening {
-webkit-animation-name: remodal-opening-keyframes;
animation-name: remodal-opening-keyframes;
}
.remodal.remodal-is-closing {
-webkit-animation-name: remodal-closing-keyframes;
animation-name: remodal-closing-keyframes;
}
/* Vertical align of the modal dialog */
.remodal,
.remodal-wrapper:after {
vertical-align: middle;
}
/* Close button */
.remodal-close {
position: absolute;
top: 0;
left: 0;
display: block;
overflow: visible;
width: 35px;
height: 35px;
margin: 0;
padding: 0;
cursor: pointer;
-webkit-transition: color 0.2s;
transition: color 0.2s;
text-decoration: none;
color: #95979c;
border: 0;
outline: 0;
background: transparent;
}
.remodal-close:hover,
.remodal-close:focus {
color: #2b2e38;
}
.remodal-close:before {
font-family: Arial, "Helvetica CY", "Nimbus Sans L", sans-serif !important;
font-size: 25px;
line-height: 35px;
position: absolute;
top: 0;
left: 0;
display: block;
width: 35px;
content: "\00d7";
text-align: center;
}
/* Dialog buttons */
.remodal-confirm,
.remodal-cancel {
font: inherit;
display: inline-block;
overflow: visible;
min-width: 110px;
margin: 0;
padding: 12px 0;
cursor: pointer;
-webkit-transition: background 0.2s;
transition: background 0.2s;
text-align: center;
vertical-align: middle;
text-decoration: none;
border: 0;
outline: 0;
}
.remodal-confirm {
color: #fff;
background: #81c784;
}
.remodal-confirm:hover,
.remodal-confirm:focus {
background: #66bb6a;
}
.remodal-cancel {
color: #fff;
background: #e57373;
}
.remodal-cancel:hover,
.remodal-cancel:focus {
background: #ef5350;
}
/* Remove inner padding and border in Firefox 4+ for the button tag. */
.remodal-confirm::-moz-focus-inner,
.remodal-cancel::-moz-focus-inner,
.remodal-close::-moz-focus-inner {
padding: 0;
border: 0;
}
/* Keyframes
========================================================================== */
@-webkit-keyframes remodal-opening-keyframes {
from {
-webkit-transform: scale(1.05);
transform: scale(1.05);
opacity: 0;
}
to {
-webkit-transform: none;
transform: none;
opacity: 1;
-webkit-filter: blur(0);
filter: blur(0);
}
}
@keyframes remodal-opening-keyframes {
from {
-webkit-transform: scale(1.05);
transform: scale(1.05);
opacity: 0;
}
to {
-webkit-transform: none;
transform: none;
opacity: 1;
-webkit-filter: blur(0);
filter: blur(0);
}
}
@-webkit-keyframes remodal-closing-keyframes {
from {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
to {
-webkit-transform: scale(0.95);
transform: scale(0.95);
opacity: 0;
-webkit-filter: blur(0);
filter: blur(0);
}
}
@keyframes remodal-closing-keyframes {
from {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
to {
-webkit-transform: scale(0.95);
transform: scale(0.95);
opacity: 0;
-webkit-filter: blur(0);
filter: blur(0);
}
}
@-webkit-keyframes remodal-overlay-opening-keyframes {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes remodal-overlay-opening-keyframes {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes remodal-overlay-closing-keyframes {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes remodal-overlay-closing-keyframes {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
/* Media queries
========================================================================== */
@media only screen and (min-width: 641px) {
.remodal {
max-width: 700px;
}
}
/* IE8
========================================================================== */
.lt-ie9 .remodal-overlay {
background: #2b2e38;
}
.lt-ie9 .remodal {
width: 700px;
}

View File

@ -0,0 +1,93 @@
/*
* Remodal - v1.1.1
* Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking.
* http://vodkabears.github.io/remodal/
*
* Made by Ilya Makarov
* Under MIT License
*/
/* ==========================================================================
Remodal's necessary styles
========================================================================== */
/* Hide scroll bar */
html.remodal-is-locked {
overflow: hidden;
-ms-touch-action: none;
touch-action: none;
}
/* Anti FOUC */
.remodal,
[data-remodal-id] {
display: none;
}
/* Necessary styles of the overlay */
.remodal-overlay {
position: fixed;
z-index: 9999;
top: -5000px;
right: -5000px;
bottom: -5000px;
left: -5000px;
display: none;
}
/* Necessary styles of the wrapper */
.remodal-wrapper {
position: fixed;
z-index: 10000;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: none;
overflow: auto;
text-align: center;
-webkit-overflow-scrolling: touch;
}
.remodal-wrapper:after {
display: inline-block;
height: 100%;
margin-left: -0.05em;
content: "";
}
/* Fix iPad, iPhone glitches */
.remodal-overlay,
.remodal-wrapper {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
/* Necessary styles of the modal dialog */
.remodal {
position: relative;
outline: none;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
text-size-adjust: 100%;
}
.remodal-is-initialized {
/* Disable Anti-FOUC */
display: inline-block;
}

View File

@ -0,0 +1,8 @@
.easy-autocomplete {
width: 100% !important;
text-align: left;
}
#plugin-search-input {
width: 100% !important;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

5
bl-plugins/search/js/jquery.modal.min.js vendored Executable file
View File

@ -0,0 +1,5 @@
/*
A simple jQuery modal (http://github.com/kylefox/jquery-modal)
Version 0.9.1
*/
!function(o){"object"==typeof module&&"object"==typeof module.exports?o(require("jquery"),window,document):o(jQuery,window,document)}(function(o,t,i,e){var s=[],l=function(){return s.length?s[s.length-1]:null},n=function(){var o,t=!1;for(o=s.length-1;o>=0;o--)s[o].$blocker&&(s[o].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};o.modal=function(t,i){var e,n;if(this.$body=o("body"),this.options=o.extend({},o.modal.defaults,i),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;o.modal.isActive();)o.modal.close();if(s.push(this),t.is("a"))if(n=t.attr("href"),this.anchor=t,/^#/.test(n)){if(this.$elm=o(n),1!==this.$elm.length)return null;this.$body.append(this.$elm),this.open()}else this.$elm=o("<div>"),this.$body.append(this.$elm),e=function(o,t){t.elm.remove()},this.showSpinner(),t.trigger(o.modal.AJAX_SEND),o.get(n).done(function(i){if(o.modal.isActive()){t.trigger(o.modal.AJAX_SUCCESS);var s=l();s.$elm.empty().append(i).on(o.modal.CLOSE,e),s.hideSpinner(),s.open(),t.trigger(o.modal.AJAX_COMPLETE)}}).fail(function(){t.trigger(o.modal.AJAX_FAIL);var i=l();i.hideSpinner(),s.pop(),t.trigger(o.modal.AJAX_COMPLETE)});else this.$elm=t,this.anchor=t,this.$body.append(this.$elm),this.open()},o.modal.prototype={constructor:o.modal,open:function(){var t=this;this.block(),this.anchor.blur(),this.options.doFade?setTimeout(function(){t.show()},this.options.fadeDuration*this.options.fadeDelay):this.show(),o(i).off("keydown.modal").on("keydown.modal",function(o){var t=l();27===o.which&&t.options.escapeClose&&t.close()}),this.options.clickClose&&this.$blocker.click(function(t){t.target===this&&o.modal.close()})},close:function(){s.pop(),this.unblock(),this.hide(),o.modal.isActive()||o(i).off("keydown.modal")},block:function(){this.$elm.trigger(o.modal.BEFORE_BLOCK,[this._ctx()]),this.$body.css("overflow","hidden"),this.$blocker=o('<div class="'+this.options.blockerClass+' blocker current"></div>').appendTo(this.$body),n(),this.options.doFade&&this.$blocker.css("opacity",0).animate({opacity:1},this.options.fadeDuration),this.$elm.trigger(o.modal.BLOCK,[this._ctx()])},unblock:function(t){!t&&this.options.doFade?this.$blocker.fadeOut(this.options.fadeDuration,this.unblock.bind(this,!0)):(this.$blocker.children().appendTo(this.$body),this.$blocker.remove(),this.$blocker=null,n(),o.modal.isActive()||this.$body.css("overflow",""))},show:function(){this.$elm.trigger(o.modal.BEFORE_OPEN,[this._ctx()]),this.options.showClose&&(this.closeButton=o('<a href="#close-modal" rel="modal:close" class="close-modal '+this.options.closeClass+'">'+this.options.closeText+"</a>"),this.$elm.append(this.closeButton)),this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker),this.options.doFade?this.$elm.css({opacity:0,display:"inline-block"}).animate({opacity:1},this.options.fadeDuration):this.$elm.css("display","inline-block"),this.$elm.trigger(o.modal.OPEN,[this._ctx()])},hide:function(){this.$elm.trigger(o.modal.BEFORE_CLOSE,[this._ctx()]),this.closeButton&&this.closeButton.remove();var t=this;this.options.doFade?this.$elm.fadeOut(this.options.fadeDuration,function(){t.$elm.trigger(o.modal.AFTER_CLOSE,[t._ctx()])}):this.$elm.hide(0,function(){t.$elm.trigger(o.modal.AFTER_CLOSE,[t._ctx()])}),this.$elm.trigger(o.modal.CLOSE,[this._ctx()])},showSpinner:function(){this.options.showSpinner&&(this.spinner=this.spinner||o('<div class="'+this.options.modalClass+'-spinner"></div>').append(this.options.spinnerHtml),this.$body.append(this.spinner),this.spinner.show())},hideSpinner:function(){this.spinner&&this.spinner.remove()},_ctx:function(){return{elm:this.$elm,$elm:this.$elm,$blocker:this.$blocker,options:this.options}}},o.modal.close=function(t){if(o.modal.isActive()){t&&t.preventDefault();var i=l();return i.close(),i.$elm}},o.modal.isActive=function(){return s.length>0},o.modal.getCurrent=l,o.modal.defaults={closeExisting:!0,escapeClose:!0,clickClose:!0,closeText:"Close",closeClass:"",modalClass:"modal",blockerClass:"jquery-modal",spinnerHtml:'<div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div>',showSpinner:!0,showClose:!0,fadeDuration:null,fadeDelay:1},o.modal.BEFORE_BLOCK="modal:before-block",o.modal.BLOCK="modal:block",o.modal.BEFORE_OPEN="modal:before-open",o.modal.OPEN="modal:open",o.modal.BEFORE_CLOSE="modal:before-close",o.modal.CLOSE="modal:close",o.modal.AFTER_CLOSE="modal:after-close",o.modal.AJAX_SEND="modal:ajax:send",o.modal.AJAX_SUCCESS="modal:ajax:success",o.modal.AJAX_FAIL="modal:ajax:fail",o.modal.AJAX_COMPLETE="modal:ajax:complete",o.fn.modal=function(t){return 1===this.length&&new o.modal(this,t),this},o(i).on("click.modal",'a[rel~="modal:close"]',o.modal.close),o(i).on("click.modal",'a[rel~="modal:open"]',function(t){t.preventDefault(),o(this).modal()})});

10
bl-plugins/search/js/remodal.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
var options = {
url: "http://localhost:8000/search",
getValue: "title",
template: {
type: "custom",
method: function(value, item) {
return '<a href="'+item.permalink+'">'+value+'</a>'+item.content;
}
}
};
$( document ).ready(function() {
$("#plugin-search-input").easyAutocomplete(options);
});

View File

@ -0,0 +1,8 @@
{
"plugin-data":
{
"name": "RSS Feed",
"description": "Das Plugin erstellt erstellt einen RSS Feed der Inhalte."
},
"amount-of-items-to-show-on-the-feed": "Anzahl der gezeigten Inhalte."
}

View File

@ -0,0 +1,8 @@
{
"plugin-data":
{
"name": "RSS Feed",
"description": "Das Plugin erstellt erstellt einen RSS Feed der Inhalte."
},
"amount-of-items-to-show-on-the-feed": "Anzahl der gezeigten Inhalte."
}

View File

@ -0,0 +1,7 @@
{
"plugin-data":
{
"name": "Search",
"description": ""
}
}

View File

@ -0,0 +1,9 @@
{
"plugin-data":
{
"name": "RSS Feed",
"description": "Este plugin genera contenido dinamico en formato RSS de tu sitio.<br>El plugin genera la URL https://example.com/rss.xml"
},
"amount-of-items-to-show-on-the-feed": "Cantidad de artículos para mostrar.",
"rss-url": "URL del RSS"
}

View File

@ -0,0 +1,9 @@
{
"plugin-data":
{
"name": "Flux RSS",
"description": "Ce plugin génère un flux RSS de votre site.<br/>Le flux est accessible a l'URL de ce genre : https://example.com/rss.xml"
},
"amount-of-items-to-show-on-the-feed": "Nombre d'éléments à afficher sur le flux.",
"rss-url": "URL RSS"
}

View File

@ -0,0 +1,9 @@
{
"plugin-data":
{
"name": "Feed RSS",
"description": "Questo plugin genera un feed RSS del tuo sito.<br>Il feed si trova all' URL https://esempio.com/rss.xml"
},
"amount-of-items-to-show-on-the-feed": "Quantità di voci da mostrare nel feed.",
"rss-url": "URL RSS"
}

View File

@ -0,0 +1,9 @@
{
"plugin-data":
{
"name": "RSS трансляция",
"description": "Этот плагин создаёт RSS канал для вашего сайта<br>Трансляция доступна по URL https://example.com/rss.xml"
},
"amount-of-items-to-show-on-the-feed": "Количество позиций в трансляции.",
"rss-url": "RSS URL"
}

View File

@ -0,0 +1,9 @@
{
"plugin-data":
{
"name": "RSS Beslemesi",
"description": "Bu eklenti, sitenizin RSS beslemesini üretir.<br>Besleme URL'si https://example.com/rss.xml gibi görünür."
},
"amount-of-items-to-show-on-the-feed": "Özet akışında gösterilecek öğe miktarı.",
"rss-url": "RSS URL"
}

View File

@ -0,0 +1,10 @@
{
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.0",
"releaseDate": "2018-01-23",
"license": "MIT",
"compatible": "3.0",
"notes": ""
}

View File

@ -0,0 +1,220 @@
<?php
class pluginSearch extends Plugin {
private $pagesFound = array();
private $numberOfItems = 0;
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'search',
'numberOfItems'=>5
);
}
// Method called for settings
public function form()
{
global $L;
$html = '<div class="alert alert-primary" role="alert">';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('RSS URL').'</label>';
$html .= '<a href="'.Theme::rssUrl().'">'.Theme::rssUrl().'</a>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Amount of items').'</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" value="'.$this->getValue('numberOfItems').'">';
$html .= '<span class="tip">'.$L->get('Amount of items to show on the feed').'</span>';
$html .= '</div>';
return $html;
}
// HTML for sidebar
public function siteSidebar()
{
$html = '<div class="plugin plugin-search">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<div class="plugin-content">';
$html .= '<input type="text" id="plugin-search-input" />';
$html .= '<input type="button" value="Submit" onClick="javascript: window.open(\'http://localhost:8000/search/\' + document.getElementById(\'plugin-search-input\').value);" />';
$html .= '</div>';
$html .= '</div>';
return $html;
}
public function install($position=0)
{
parent::install($position);
return $this->createCache();
}
public function post()
{
// Call the method
parent::post();
// After POST request
$this->createCache();
}
public function afterPageCreate()
{
$this->createCache();
}
public function afterPageModify()
{
$this->createCache();
}
public function afterPageDelete()
{
$this->createCache();
}
public function beforeAll()
{
// Check if the URL match with the webhook
$webhook = 'search';
if ($this->webhook($webhook, false, false)) {
global $site;
global $url;
// Change the whereAmI to avoid load pages in the rule 69.pages
// This is only for performance propose
$url->setWhereAmI('search');
// Get the string to search from the URL
$stringToSearch = $this->webhook($webhook, true, false);
$stringToSearch = trim($stringToSearch, '/');
// Search the string in the cache and get all pages with matches
$list = $this->search($stringToSearch);
$this->numberOfItems = count($list);
// Split the content in pages
// The first page number is 1, so the real is 0
$realPageNumber = $url->pageNumber() - 1;
$itemsPerPage = $site->itemsPerPage();
$chunks = array_chunk($list, $itemsPerPage);
if (isset($chunks[$realPageNumber])) {
$this->pagesFound = $chunks[$realPageNumber];
}
}
}
public function paginator()
{
$webhook = 'search';
if ($this->webhook($webhook, false, false)) {
// Get the pre-defined variable from the rule 99.paginator.php
// Is necessary to change this variable to fit the paginator with the result from the search
global $numberOfItems;
$numberOfItems = $this->numberOfItems;
}
}
public function beforeSiteLoad()
{
$webhook = 'search';
if ($this->webhook($webhook, false, false)) {
global $url;
// Get the pre-defined variable from the rule 69.pages.php
// We change the content to show in the website
global $content;
$content = array();
foreach ($this->pagesFound as $pageKey) {
try {
$page = new Page($pageKey);
array_push($content, $page);
} catch (Exception $e) {
// continue
}
}
}
}
// Generate the cache file
private function createCache()
{
// Include Pages-Object to manage the database of pages
global $pages;
// Number of items to retrive from the database
// -1 means all of them
$numberOfItems = -1;
// Page number is not take in count because we retrive all the pages
$pageNumber = 1;
// Only published pages
$onlyPublished = true;
// Get the list of pages
$list = $pages->getList($pageNumber, $numberOfItems, $onlyPublished);
$cache = array();
foreach ($list as $pageKey) {
$page = buildPage($pageKey);
// Process content
$content = $page->content();
$content = Text::removeHTMLTags($content);
$content = Text::truncate($content, 1200, '');
// Include page to the cache
$cache[$pageKey]['title'] = $page->title();
$cache[$pageKey]['permalink'] = $page->permalink();
$cache[$pageKey]['content'] = $content;
$cache[$pageKey]['key'] = $pageKey;
}
// Generate JSON file with the cache
$json = json_encode($cache);
return file_put_contents($this->cacheFile(), $json, LOCK_EX);
}
// Returns the absolute path where is the cache file stored
private function cacheFile()
{
return $this->workspace().'cache.json';
}
// Search text inside the cache
// Returns an array with the pages related to the text
// The array is order by score
private function search($text)
{
$json = file_get_contents($this->cacheFile());
$cache = json_decode($json, true);
$found = array();
foreach ($cache as $page) {
$score = 0;
if (Text::stringContains($page['title'], $text, false)) {
$score += 10;
}
if (Text::stringContains($page['content'], $text, false)) {
$score += rand(1,5);
}
if ($score>0) {
$found[$score] = $page['key'];
}
}
//arsort($found);
return $found;
}
}