PATH:
home
/
centosnipponia
/
public_html
/
nipponiacom2
/
libraries
/
regularlabs
/
src
<?php /** * @package Regular Labs Library * @version 19.2.10100 * * @author Peter van Westen <info@regularlabs.com> * @link http://www.regularlabs.com * @copyright Copyright © 2019 Regular Labs All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ namespace RegularLabs\Library; defined('_JEXEC') or die; /** * Class ConditionContent * @package RegularLabs\Library */ trait ConditionContent { public function passContentId() { if (empty($this->selection)) { return null; } return in_array($this->request->id, $this->selection); } public function passContentKeyword($fields = ['title', 'introtext', 'fulltext'], $text = '') { if (empty($this->params->content_keywords)) { return null; } if ( ! $text) { $item = $this->getItem($fields); foreach ($fields as $field) { if ( ! isset($item->{$field})) { return false; } $text = trim($text . ' ' . $item->{$field}); } } if (empty($text)) { return false; } $this->params->content_keywords = $this->makeArray($this->params->content_keywords); foreach ($this->params->content_keywords as $keyword) { if ( ! RegEx::match('\b' . RegEx::quote($keyword) . '\b', $text)) { continue; } return true; } return false; } public function passMetaKeyword($field = 'metakey', $keywords = '') { if (empty($this->params->meta_keywords)) { return null; } if ( ! $keywords) { $item = $this->getItem($field); if ( ! isset($item->metakey) || empty($item->metakey)) { return false; } $keywords = $item->metakey; } if (empty($keywords)) { return false; } if (is_string($keywords)) { $keywords = str_replace(' ', ',', $keywords); } $keywords = $this->makeArray($keywords); $this->params->meta_keywords = $this->makeArray($this->params->meta_keywords); foreach ($this->params->meta_keywords as $keyword) { if ( ! $keyword || ! in_array(trim($keyword), $keywords)) { continue; } return true; } return false; } public function passAuthor($field = 'created_by', $author = '') { if (empty($this->params->authors)) { return null; } if ( ! $author) { $item = $this->getItem($field); if ( ! isset($item->{$field})) { return false; } $author = $item->{$field}; } if (empty($author)) { return false; } $this->params->authors = $this->makeArray($this->params->authors); return in_array($author, $this->params->authors); } abstract public function getItem($fields = []); }
[+]
..
[-] ActionLogPlugin.php
[edit]
[-] Alias.php
[edit]
[+]
Api
[-] ArrayHelper.php
[edit]
[-] Article.php
[edit]
[-] Cache.php
[edit]
[+]
Condition
[-] Condition.php
[edit]
[-] ConditionContent.php
[edit]
[-] Conditions.php
[edit]
[-] Database.php
[edit]
[-] Date.php
[edit]
[-] DB.php
[edit]
[-] Document.php
[edit]
[-] EditorButton.php
[edit]
[-] EditorButtonHelper.php
[edit]
[-] EditorButtonPlugin.php
[edit]
[-] EditorButtonPopup.php
[edit]
[-] Extension.php
[edit]
[-] Field.php
[edit]
[-] FieldGroup.php
[edit]
[-] File.php
[edit]
[-] Form.php
[edit]
[-] Html.php
[edit]
[-] HtmlTag.php
[edit]
[-] Http.php
[edit]
[-] Image.php
[edit]
[-] Language.php
[edit]
[-] License.php
[edit]
[-] Log.php
[edit]
[-] MobileDetect.php
[edit]
[-] Parameters.php
[edit]
[-] PluginTag.php
[edit]
[-] Protect.php
[edit]
[-] RegEx.php
[edit]
[-] ShowOn.php
[edit]
[-] StringHelper.php
[edit]
[-] Title.php
[edit]
[-] Uri.php
[edit]
[-] Version.php
[edit]
[-] Xml.php
[edit]
[-] .htaccess.disabled
[edit]