本文整理汇总了PHP中TikiFilter类的典型用法代码示例。如果您正苦于以下问题:PHP TikiFilter类的具体用法?PHP TikiFilter怎么用?PHP TikiFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TikiFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fromInput
public static function fromInput(JitFilter $input, array $typeInfo)
{
$options = new Tracker_Options();
$options->info = $typeInfo;
foreach ($typeInfo['params'] as $key => $info) {
$filter = $info['filter'];
if (isset($info['count']) && $info['count'] === '*') {
$rawValue = $input->{$key}->none();
if ($rawValue !== '') {
$values = explode(',', $rawValue);
$filter = TikiFilter::get($filter);
$values = array_map(array($filter, 'filter'), $values);
} else {
$values = '';
}
$options->setParam($key, $values);
} elseif (isset($info['separator'])) {
$input->replaceFilter($key, $filter);
$values = $input->asArray($key, $info['separator']);
$options->setParam($key, $values);
} else {
$options->setParam($key, $input->{$key}->{$filter}());
}
}
return $options;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:26,代码来源:Options.php
示例2: filter
function filter($value)
{
$parserlib = TikiLib::lib('parser');
$noparsed = array();
$parserlib->plugins_remove($value, $noparsed);
$value = TikiFilter::get('xss')->filter($value);
$parserlib->isEditMode = true;
$parserlib->plugins_replace($value, $noparsed, true);
$parserlib->isEditMode = false;
return $value;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:11,代码来源:WikiContent.php
示例3: action_attach
function action_attach($input)
{
$type = $input->type->text();
$objectFilter = $this->getObjectFilter($type);
if (!$objectFilter) {
throw new Services_Exception(tr('Translation not supported for the specified object type'), 400);
}
$source = $input->source->{$objectFilter}();
$target = $input->target->none();
$target = end(explode(':', $target, 2));
$target = TikiFilter::get($objectFilter)->filter($target);
if (!$source || !$target) {
throw new Services_Exception(tr('No source or target provided'), 400);
}
if (!$this->canAttach($type, $source) || !$this->canAttach($type, $target)) {
throw new Services_Exception(tr('You do not have permission to attach the selected translations'), 403);
}
$succeeded = $this->utilities->insertTranslation($type, $source, $target);
if (!$succeeded) {
throw new Services_Exception(tr('Could not attach the translations.'), 409);
}
return array('FORWARD' => array('action' => 'manage', 'type' => $type, 'source' => $source));
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:23,代码来源:TranslationController.php
示例4: update_feed
private function update_feed($rssId, $url, $actions)
{
global $tikilib;
$filter = new DeclFilter();
$filter->addStaticKeyFilters(array('url' => 'url', 'title' => 'striptags', 'author' => 'striptags', 'description' => 'striptags', 'content' => 'purifier'));
$guidFilter = TikiFilter::get('url');
try {
$content = $tikilib->httprequest($url);
$feed = Zend_Feed_Reader::importString($content);
} catch (Zend_Exception $e) {
$this->modules->update(array('lastUpdated' => $tikilib->now, 'sitetitle' => 'N/A', 'siteurl' => '#'), array('rssId' => $rssId));
return;
}
$siteTitle = TikiFilter::get('striptags')->filter($feed->getTitle());
$siteUrl = TikiFilter::get('url')->filter($feed->getLink());
$this->modules->update(array('lastUpdated' => $tikilib->now, 'sitetitle' => $siteTitle, 'siteurl' => $siteUrl), array('rssId' => $rssId));
foreach ($feed as $entry) {
// TODO: optimize. Atom entries have an 'updated' element which can be used to only update updated entries
$guid = $guidFilter->filter($entry->getId());
$authors = $entry->getAuthors();
$data = $filter->filter(array('title' => $entry->getTitle(), 'url' => $entry->getLink(), 'description' => $entry->getDescription(), 'content' => $entry->getContent(), 'author' => $authors ? implode(', ', $authors->getValues()) : ''));
$data['guid'] = $guid;
if (method_exists($entry, 'getDateCreated') && ($createdDate = $entry->getDateCreated())) {
$data['publication_date'] = $createdDate->get(Zend_Date::TIMESTAMP);
} else {
global $tikilib;
$data['publication_date'] = $tikilib->now;
}
$count = $this->items->fetchCount(array('rssId' => $rssId, 'guid' => $guid));
if (0 == $count) {
$this->insert_item($rssId, $data, $actions);
} else {
$this->update_item($rssId, $data['guid'], $data);
}
}
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:36,代码来源:rsslib.php
示例5: isset
} else {
if ($blog_data['always_owner'] == 'y') {
$author = $blog_data['user'];
} else {
$author = $user;
}
$postId = $bloglib->blog_post($_REQUEST["blogId"], $edit_data, $_REQUEST['excerpt'], $author, $title, isset($_REQUEST['contributions']) ? $_REQUEST['contributions'] : '', $blogpriv, $publishDate, $is_wysiwyg);
$smarty->assign('postId', $postId);
}
if ($prefs['geo_locate_blogpost'] == 'y' && !empty($_REQUEST['geolocation'])) {
TikiLib::lib('geo')->set_coordinates('blog post', $postId, $_REQUEST['geolocation']);
}
// TAG Stuff
$cat_type = 'blog post';
$cat_objid = $postId;
$cat_desc = TikiFilter::get('purifier')->filter(substr($edit_data, 0, 200));
$cat_name = $title;
$cat_href = "tiki-view_blog_post.php?postId=" . urlencode($postId);
$cat_lang = $_REQUEST['lang'];
include_once "freetag_apply.php";
include_once "categorize.php";
require_once 'tiki-sefurl.php';
$smarty->loadPlugin('smarty_modifier_sefurl');
$url = smarty_modifier_sefurl($postId, 'blogpost');
header("location: {$url}");
exit;
}
if ($contribution_needed) {
$smarty->assign('title', $_REQUEST["title"]);
$smarty->assign('parsed_data', $tikilib->parse_data($_REQUEST['data'], array('is_html' => $is_wysiwyg)));
$smarty->assign('data', $_REQUEST['data']);
开发者ID:jkimdon,项目名称:cohomeals,代码行数:31,代码来源:tiki-blog_post.php
示例6: dir_replace_site
/**
* @param $siteId
* @param $name
* @param $description
* @param $url
* @param $country
* @param $isValid
* @return mixed
*/
function dir_replace_site($siteId, $name, $description, $url, $country, $isValid)
{
global $prefs;
$name = TikiFilter::get('striptags')->filter($name);
$description = TikiFilter::get('striptags')->filter($description);
$url = TikiFilter::get('url')->filter($url);
$country = TikiFilter::get('word')->filter($country);
if ($siteId) {
$query = "update `tiki_directory_sites` set `name`=?, `description`=?, `url`=?, `country`=?, `isValid`=?, `lastModif`=? where `siteId`=?";
$this->query($query, array($name, $description, $url, $country, $isValid, (int) $this->now, (int) $siteId));
} else {
$query = "insert into `tiki_directory_sites`(`name`,`description`,`url`,`country`,`isValid`,`hits`,`created`,`lastModif`) values(?,?,?,?,?,?,?,?)";
$this->query($query, array($name, $description, $url, $country, $isValid, 0, (int) $this->now, (int) $this->now));
$siteId = $this->getOne("select max(siteId) from `tiki_directory_sites` where `created`=? and `name`=?", array((int) $this->now, $name));
if ($prefs['cachepages'] == 'y') {
$this->cache_url($url);
}
}
require_once 'lib/search/refresh-functions.php';
refresh_index('directory_sites', $siteId);
return $siteId;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:31,代码来源:dirlib.php
示例7: smarty_function_object_link_external
function smarty_function_object_link_external($smarty, $link_orig, $title = null, $type = null)
{
$cachelib = TikiLib::lib('cache');
$tikilib = TikiLib::lib('tiki');
if (substr($link_orig, 0, 4) === 'www.') {
$link = 'http://' . $link_orig;
} else {
$link = $link_orig;
}
if (!$title) {
if (!($title = $cachelib->getCached($link, 'object_link_ext_title'))) {
$body = $tikilib->httprequest($link);
if (preg_match('|<title>(.+)</title>|', $body, $parts)) {
$title = TikiFilter::get('text')->filter($parts[1]);
} else {
$title = $link_orig;
}
$cachelib->cacheItem($link, $title, 'object_link_ext_title');
}
}
$smarty->loadPlugin('smarty_modifier_escape');
$escapedHref = smarty_modifier_escape($link);
$escapedLink = smarty_modifier_escape($link_orig);
$escapedTitle = smarty_modifier_escape($title);
if ($type == 'external_extended' && "{$link_orig}" != "{$title}") {
$data = '<a rel="external" href="' . $escapedHref . '">' . $escapedLink . '</a>' . "<div class='link_extend_title'><em>" . $escapedTitle . "</em></div>";
} else {
$data = '<a rel="external" href="' . $escapedHref . '">' . $escapedTitle . '</a>';
}
return $data;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:31,代码来源:function.object_link.php
示例8: header
/*
* This is included in the html generated for each wiki page. It is included for each plugin used on a wiki page.
* The include is of the form <script type="text/javascript" src="tiki-jsplugin.php?plugin=googledoc"></script>
* If no plugin name is given, a list of all the plugins is used instead
* The java script generated defines tiki_plugins["pluginname"] with meta data for the parameters of the plugin.
* This is then used to allow a nice way for the editor of the page to use a form to edit the plug-in when they
* click the little edit icon next to the plug-ins generated html.
*
* Cached by language to allow translations (tiki 5)
*/
header('content-type: application/x-javascript');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600 * 24 * 365 * 10) . ' GMT');
require_once 'tiki-filter-base.php';
$filter = TikiFilter::get('xss');
$_REQUEST['plugin'] = isset($_GET['plugin']) ? $_GET['plugin'] = $filter->filter($_GET['plugin']) : '';
$filter = TikiFilter::get('alpha');
$_REQUEST['language'] = isset($_GET['language']) ? $_GET['language'] = $filter->filter($_GET['language']) : '';
$all = empty($_REQUEST['plugin']);
$files = array();
if ($all) {
$cache = "temp/cache/wikiplugin_ALL_" . $_REQUEST['language'];
if (file_exists($cache)) {
readfile($cache);
exit;
}
include 'tiki-setup.php';
$parserlib = TikiLib::lib('parser');
$plugins = $parserlib->plugin_get_list();
} else {
$plugin = basename($_REQUEST['plugin']);
$cache = 'temp/cache/wikiplugin_' . $plugin . '_' . $_REQUEST['language'];
开发者ID:hurcane,项目名称:tiki-azure,代码行数:31,代码来源:tiki-jsplugin.php
示例9: __construct
function __construct($filter)
{
$this->filter = TikiFilter::get($filter);
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:4,代码来源:CatchAllFilterRule.php
示例10: add_article_type_attribute
function add_article_type_attribute($artType, $attributeName)
{
$relationlib = TikiLib::lib('relation');
$attributelib = TikiLib::lib('attribute');
$fullAttributeName = TikiFilter::get('attribute_type')->filter(trim('tiki.article.' . $attributeName));
$relationId = $relationlib->add_relation('tiki.article.attribute', 'articletype', $artType, 'attribute', $fullAttributeName);
if (!$relationId) {
return 0;
} else {
$attributelib->set_attribute('relation', $relationId, 'tiki.relation.target', $attributeName);
return $relationId;
}
}
开发者ID:ameoba32,项目名称:tiki,代码行数:13,代码来源:artlib.php
示例11: get_valid
/**
* @param $name
* @return mixed
*/
private function get_valid($name)
{
$filter = TikiFilter::get('attribute_type');
return $filter->filter($name);
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:9,代码来源:attributelib.php
示例12: parseOptions
function parseOptions($raw, $typeInfo)
{
$out = array();
foreach ($typeInfo['params'] as $key => $info) {
if (isset($info['count']) && $info['count'] === '*') {
// There is a possibility that * does not mean all of the remaining, to apply reasonable heuristic
$filter = TikiFilter::get($info['filter']);
$outarray = array();
foreach ($raw as $r) {
$filtered = $filter->filter($r);
if (strcmp($filtered, $r) == 0) {
$outarray[] = array_shift($raw);
} else {
break;
}
}
$out[$key] = implode(',', $outarray);
} else {
$out[$key] = array_shift($raw);
}
}
return $out;
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:23,代码来源:Utilities.php
示例13: getFilter
function getFilter($key)
{
return TikiFilter::get($this->rules[$key]);
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:4,代码来源:StaticKeyFilterRule.php
示例14: _getTextareaValue
private function _getTextareaValue($info, $data)
{
$name = $info['preference'];
if (isset($info['filter']) && ($filter = TikiFilter::get($info['filter']))) {
$value = $filter->filter($data[$name]);
} else {
$value = $data[$name];
}
$value = str_replace("\r", "", $value);
if (isset($info['unserialize'])) {
$fnc = $info['unserialize'];
return $fnc($value);
} else {
return $value;
}
}
开发者ID:ameoba32,项目名称:tiki,代码行数:16,代码来源:prefslib.php
示例15: plugin_apply_filters
private function plugin_apply_filters($name, &$data, &$args, $parseOptions)
{
global $tikilib;
$info = $this->plugin_info($name);
$default = TikiFilter::get(isset($info['defaultfilter']) ? $info['defaultfilter'] : 'xss');
// Apply filters on the body
$filter = isset($info['filter']) ? TikiFilter::get($info['filter']) : $default;
//$data = TikiLib::htmldecode($data); // jb 9.0 commented out in fix for html entitles
$data = $filter->filter($data);
if (isset($parseOptions) && (!empty($parseOptions['is_html']) && !$parseOptions['is_html'])) {
$noparsed = array('data' => array(), 'key' => array());
$this->strip_unparsed_block($data, $noparsed);
$data = str_replace(array('<', '>'), array('<', '>'), $data);
foreach ($noparsed['data'] as &$instance) {
$instance = '~np~' . $instance . '~/np~';
}
unset($instance);
$data = str_replace($noparsed['key'], $noparsed['data'], $data);
}
// Make sure all arguments are declared
$params = $info['params'];
if (!isset($info['extraparams']) && is_array($params)) {
$args = array_intersect_key($args, $params);
}
// Apply filters on values individually
if (!empty($args)) {
foreach ($args as $argKey => &$argValue) {
if (!isset($params[$argKey])) {
continue;
// extra params
}
$paramInfo = $params[$argKey];
$filter = isset($paramInfo['filter']) ? TikiFilter::get($paramInfo['filter']) : $default;
$argValue = TikiLib::htmldecode($argValue);
if (isset($paramInfo['separator'])) {
$vals = array();
$vals = $tikilib->array_apply_filter($tikilib->multi_explode($paramInfo['separator'], $argValue), $filter);
$argValue = array_values($vals);
} else {
$argValue = $filter->filter($argValue);
}
}
}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:44,代码来源:parserlib.php
示例16: tra
$msg = '';
if (isset($_REQUEST['save']) && $prefs['feature_contribution'] === 'y' && $prefs['feature_contribution_mandatory'] === 'y' && (empty($_REQUEST['contributions']) || count($_REQUEST['contributions']) <= 0)) {
$contribution_needed = true;
$smarty->assign('contribution_needed', 'y');
} else {
$contribution_needed = false;
}
if (isset($_REQUEST['save']) && $prefs['feature_categories'] === 'y' && $prefs['feature_wiki_mandatory_category'] >= 0 && (empty($_REQUEST['cat_categories']) || count($_REQUEST['cat_categories']) <= 0)) {
$category_needed = true;
$smarty->assign('category_needed', 'y');
} else {
$category_needed = false;
}
if (isset($_REQUEST["save"]) && !$category_needed && !$contribution_needed) {
if (strtolower($pagename) !== 'sandbox' || $tiki_p_admin === 'y') {
$description = TikiFilter::get('striptags')->filter($description);
if ($tikilib->page_exists($pagename)) {
if ($prefs['feature_multilingual'] === 'y') {
$info = $tikilib->get_page_info($pagename);
if ($info['lang'] !== $pageLang) {
include_once "lib/multilingual/multilinguallib.php";
if ($multilinguallib->updateObjectLang('wiki page', $info['page_id'], $pageLang, true)) {
$pageLang = $info['lang'];
$smarty->assign('msg', tra("The language can't be changed as its set of translations has already this language"));
$smarty->display("error.tpl");
die;
}
}
}
$tikilib->update_page($pagename, $part["body"], tra('page imported'), $author, $authorid, $description, 0, $pageLang, false, $hash);
} else {
开发者ID:hurcane,项目名称:tiki-azure,代码行数:31,代码来源:tiki-editpage.php
示例17: replaceReferences
public function replaceReferences(&$data, $suppliedUserData = false)
{
if ($suppliedUserData === false) {
$suppliedUserData = $this->getRequiredInput();
}
if (is_array($data)) {
foreach ($data as &$sub) {
$this->replaceReferences($sub, $suppliedUserData);
}
$toReplace = array();
foreach (array_keys($data) as $key) {
$newKey = $key;
$this->replaceReferences($newKey, $suppliedUserData);
if ($newKey != $key) {
$toReplace[$key] = $newKey;
}
}
foreach ($toReplace as $old => $new) {
$data[$new] = $data[$old];
unset($data[$old]);
}
} else {
if (preg_match(self::SHORT_PATTERN, $data, $parts)) {
$object = $this->convertReference($parts);
$data = self::getObjectReference($object);
return;
}
$needles = array();
$replacements = array();
if (preg_match_all(self::LONG_PATTERN, $data, $parts, PREG_SET_ORDER)) {
foreach ($parts as $row) {
$object = $this->convertReference($row);
$needles[] = $row[0];
$replacements[] = self::getObjectReference($object);
}
}
if (preg_match_all(self::INFO_REQUEST, $data, $parts, PREG_SET_ORDER)) {
foreach ($parts as $row) {
list($full, $label, $junk, $filter, $default) = $row;
if (!array_key_exists($label, $suppliedUserData)) {
$value = $default;
} else {
$value = $suppliedUserData[$label];
}
if ($filter) {
$value = TikiFilter::get($filter)->filter($value);
} else {
$value = TikiFilter::get('xss')->filter($value);
}
if (empty($value)) {
$value = $default;
}
$needles[] = $full;
$replacements[] = $value;
}
}
if (count($needles)) {
$data = str_replace($needles, $replacements, $data);
}
$needles = array();
$replacements = array();
// Replace date formats D(...) to unix timestamps
if (preg_match_all("/D\\(([^\\)]+)\\)/", $data, $parts, PREG_SET_ORDER)) {
foreach ($parts as $row) {
list($full, $date) = $row;
if (false !== ($conv = strtotime($date))) {
$needles[] = $full;
$replacements = $conv;
}
}
}
if (count($needles)) {
$data = str_replace($needles, $replacements, $data);
}
}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:76,代码来源:profilelib.php
示例18: applyFilters
private function applyFilters()
{
global $tikilib;
$default = TikiFilter::get(isset($this->info['defaultfilter']) ? $this->info['defaultfilter'] : 'xss');
// Apply filters on the body
$filter = isset($this->info['filter']) ? TikiFilter::get($this->info['filter']) : $default;
$this->body = $filter->filter($this->body);
if (!$this->parser->getOption('is_html')) {
$noparsed = array('data' => array(), 'key' => array());
//$this->striUnparsedBlock($this->body, $noparsed);
$body = str_replace(array('<', '>'), array('<', '>'), $this->body);
foreach ($noparsed['data'] as &$instance) {
$instance = '~np~' . $instance . '~/np~';
}
unset($instance);
$this->body = str_replace($noparsed['key'], $noparsed['data'], $body);
}
// Make sure all arguments are declared
$params =& $this->info['params'];
if (!isset($this->info['extraparams']) && is_array($params)) {
$this->args = array_intersect_key($this->args, $params);
}
// Apply filters on values individually
if (!empty($this->args)) {
foreach ($this->args as $argKey => &$argValue) {
$paramInfo = $params[$argKey];
$filter = isset($paramInfo['filter']) ? TikiFilter::get($paramInfo['filter']) : $default;
$argValue = TikiLib::htmldecode($argValue);
if (isset($paramInfo['separator'])) {
$vals = $tikilib->array_apply_filter($tikilib->multi_explode($paramInfo['separator'], $argValue), $filter);
$argValue = array_values($vals);
} else {
$argValue = $filter->filter($argValue);
}
}
}
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:37,代码来源:Wiki.php
示例19: get_assign_permissions
}
}
$newPermissions = get_assign_permissions();
$permissionApplier->apply($newPermissions);
if (isset($_REQUEST['group'])) {
$smarty->assign('groupName', $_REQUEST['group']);
}
}
if (isset($_REQUEST['remove'])) {
$access->check_authenticity(tra('Are you sure you want to remove the direct permissions from this object?'));
$newPermissions = new Perms_Reflection_PermissionSet();
$permissionApplier->apply($newPermissions);
}
if (isset($_REQUEST['copy'])) {
$newPermissions = get_assign_permissions();
$filter = TikiFilter::get('text');
$to_copy = array('perms' => $newPermissions->getPermissionArray(), 'object' => $filter->filter($_REQUEST['objectId']), 'type' => $filter->filter($_REQUEST['objectType']));
$_SESSION['perms_clipboard'] = $to_copy;
}
if (!empty($_SESSION['perms_clipboard'])) {
$perms_clipboard = $_SESSION['perms_clipboard'];
$smarty->assign('perms_clipboard_source', $perms_clipboard['type'] . (empty($perms_clipboard['object']) ? '' : ' : ') . $perms_clipboard['object']);
if (isset($_REQUEST['paste'])) {
$access->check_authenticity(tra('Are you sure you want paste the copied permissions onto this object?'));
unset($_SESSION['perms_clipboard']);
$set = new Perms_Reflection_PermissionSet();
if (isset($perms_clipboard['perms'])) {
foreach ($perms_clipboard['perms'] as $group => $gperms) {
foreach ($gperms as $perm) {
$set->add($group, $perm);
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:31,代码来源:tiki-objectpermissions.php
示例20: apply_relation_condition
/**
* @param $relation
* @param $cond
* @param $vars
*/
private function apply_relation_condition($relation, &$cond, &$vars)
{
$relation = TikiFilter::get('attribute_type')->filter($relation);
if ($relation) {
if (substr($relation, -1) == '.') {
$relation .= '%';
}
$cond[] = 'relation LIKE ?';
$vars[] = $relation;
}
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:16,代码来源:relationlib.php
注:本文中的TikiFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论