本文整理汇总了PHP中TikiLib::strtolower方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::strtolower方法的具体用法?PHP TikiLib::strtolower怎么用?PHP TikiLib::strtolower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiLib
的用法示例。
在下文中一共展示了TikiLib::strtolower方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public static function store($name, $data)
{
/*
Input data structure:
implementation: other plugin_name
description:
** Equivalent of plugin info function here **
body:
input: use|ignore
default: body content to use
params:
token_name:
input: token_name, default uses same name above
default: value to use if missing
encoding: none|html|url - default to none
params:
; Use input parameter directly
token_name: default value
; Custom input parameter replacement
token_name:
pattern: body content to use
params:
token_name:
input: token_name, default uses same name above
default: value to use if missing
encoding: none|html|url - default to none
*/
if (empty($name)) {
return;
}
$name = TikiLib::strtolower($name);
$data['plugin_name'] = $name;
$prefName = "pluginalias_{$name}";
$tikilib = TikiLib::lib('tiki');
$tikilib->set_preference($prefName, serialize($data));
global $prefs;
$list = array();
if (isset($prefs['pluginaliaslist'])) {
$list = unserialize($prefs['pluginaliaslist']);
}
if (!in_array($name, $list)) {
$list[] = $name;
$tikilib->set_preference('pluginaliaslist', serialize($list));
}
foreach (glob('temp/cache/wikiplugin_*') as $file) {
unlink($file);
}
$cachelib = TikiLib::lib('cache');
$cachelib->invalidate('plugindesc');
}
示例2: get_blog_by_title
/**
* Return a blog by its title
*
* @param string $blogTitle
* @return array or false if no blog is found
*/
function get_blog_by_title($blogTitle)
{
// Avoiding select by name so as to avoid SQL injection problems.
$query = "select `title`, `blogId` from `tiki_blogs`";
$result = $this->fetchAll($query);
if (!empty($result)) {
foreach ($result as $res) {
if (TikiLib::strtolower($res['title']) == TikiLib::strtolower($blogTitle)) {
return $this->get_blog($res['blogId']);
}
}
}
return false;
}
示例3: getValue
function getValue()
{
return TikiLib::strtolower($this->value);
}
示例4: rename_object
/**
* @param $type
* @param $old
* @param $new
*/
protected function rename_object($type, $old, $new, $user = '')
{
global $prefs;
// comments
$this->table('tiki_comments')->updateMultiple(array('object' => $new), array('object' => $old, 'objectType' => $type));
// Move email notifications
$oldId = str_replace($type, ' ', '') . $old;
$newId = str_replace($type, ' ', '') . $new;
$this->table('tiki_user_watches')->updateMultiple(array('object' => $newId), array('object' => $oldId));
$this->table('tiki_group_watches')->updateMultiple(array('object' => $newId), array('object' => $oldId));
// theme_control_objects(objId,name)
$oldId = md5($type . $old);
$newId = md5($type . $new);
$this->table('tiki_theme_control_objects')->updateMultiple(array('objId' => $newId, 'name' => $new), array('objId' => $oldId));
// polls
if ($prefs['feature_polls'] == 'y') {
$query = "update `tiki_polls` tp inner join `tiki_poll_objects` tpo on tp.`pollId` = tpo.`pollId` inner join `tiki_objects` tob on tpo.`catObjectId` = tob.`objectId` set tp.`title`=? where tp.`title`=? and tob.`type` = ?";
$this->query($query, array($new, $old, $type));
}
// Move custom permissions
$oldId = md5($type . TikiLib::strtolower($old));
$newId = md5($type . TikiLib::strtolower($new));
$this->table('users_objectpermissions')->updateMultiple(array('objectId' => $newId), array('objectId' => $oldId, 'objectType' => $type));
// Logs
if ($prefs['feature_actionlog'] == 'y') {
$logslib = TikiLib::lib('logs');
$logslib->add_action('Renamed', $new, 'wiki page', 'old=' . $old . '&new=' . $new, $user, '', '', '', '', array(array('rename' => $old)));
$logslib->rename($type, $old, $new);
}
// Attributes
$this->table('tiki_object_attributes')->updateMultiple(array('itemId' => $new), array('itemId' => $old, 'type' => $type));
$this->table('tiki_object_relations')->updateMultiple(array('source_itemId' => $new), array('source_itemId' => $old, 'source_type' => $type));
$this->table('tiki_object_relations')->updateMultiple(array('target_itemId' => $new), array('target_itemId' => $old, 'target_type' => $type));
$menulib = TikiLib::lib('menu');
$menulib->rename_wiki_page($old, $new);
}
示例5: object_has_one_permission
function object_has_one_permission($objectId, $objectType)
{
$objectId = md5($objectType . TikiLib::strtolower($objectId));
if (!isset($this->userobjectperm_cache) || !is_array($this->userobjectperm_cache)
|| !isset($this->userobjectperm_cache[$objectId])) {
// i think, we really dont need the "and `objectType`=?" because the objectId should be unique due to the md5()
$query = 'select count(*) from `users_objectpermissions` where `objectId`=? and `objectType`=?';
$this->userobjectperm_cache[$objectId]= $this->getOne($query, array($objectId, $objectType));
}
return $this->userobjectperm_cache[$objectId];
}
示例6: explode
$likepages = $wikilib->get_like_pages($page);
if ($prefs['feature_wiki_pagealias'] == 'y' && count($referencedPages) == 1) {
$newPage = $referencedPages[0];
} else {
if ($prefs['feature_wiki_1like_redirection'] == 'y' && count($likepages) == 1) {
$newPage = $likepages[0];
}
}
/* if we have exactly one match, redirect to it */
if (isset($newPage) && !$isUserPage) {
$url = $wikilib->sefurl($newPage);
// Process prefix alias with itemId append for pretty tracker pages
$prefixes = explode(',', $prefs['wiki_prefixalias_tokens']);
foreach ($prefixes as $p) {
$p = trim($p);
if (strlen($p) > 0 && TikiLib::strtolower(substr($page, 0, strlen($p))) == TikiLib::strtolower($p)) {
$suffix = trim(substr($page, strlen($p)));
if (!ctype_digit($suffix) && $suffix) {
// allow escaped numerics as text
$suffix = stripslashes($suffix);
global $semanticlib;
if (!is_object($semanticlib)) {
require_once 'lib/wiki/semanticlib.php';
}
$items = $semanticlib->getItemsFromTracker($newPage, $suffix);
if (count($items) > 1) {
$msg = tra('There is more than one item in the tracker with this title');
foreach ($items as $i) {
$msg .= '<br /><a href="tiki-index.php?page=' . urlencode($newPage) . '&itemId=' . $i . '">' . $i . '</a>';
}
$smarty->assign('msg', $msg);
示例7: normalize_tag
/**
* normalize_tag
*
* This is a utility function used to take a raw tag and convert it to normalized form.
* Normalized form is essentially lowercased alphanumeric characters only,
* with no spaces or special characters.
*
* Customize the normalized valid chars with your own set of special characters
* in regex format within the option 'normalized_valid_chars'. It acts as a filter
* to let a customized set of characters through.
*
* After the filter is applied, the function also lowercases the characters using strtolower
* in the current locale.
*
* The default for normalized_valid_chars is a-zA-Z0-9, or english alphanumeric.
*
* @param tag string An individual tag in raw form that should be normalized.
*
* @return string Returns the tag in normalized form.
*/
function normalize_tag($tag)
{
if (!empty($this->_normalized_valid_chars) && $this->_normalized_valid_chars != '*') {
$normalized_valid_chars = $this->_normalized_valid_chars;
$tag = preg_replace("/[^{$normalized_valid_chars}]/", '', $tag);
}
return $this->_normalize_in_lowercase ? TikiLib::strtolower($tag, 'UTF-8') : $tag;
}
示例8: cleanObject
private function cleanObject($name)
{
return TikiLib::strtolower(trim($name));
}
示例9: findWikiPage
function findWikiPage()
{
global $prefs;
$tikilib = TikiLib::lib('tiki');
$page_info = $tikilib->get_page_info($this->namespace . $this->namespaceSeparator . $this->page, false);
if ($page_info === false) {
$page_info = $tikilib->get_page_info($this->page, false);
$this->setDescription($this->renderPageName());
}
if ($page_info !== false) {
return $page_info;
}
// If page does not exist directly, attempt to find an alias
if ($prefs['feature_wiki_pagealias'] == 'y') {
$semanticlib = TikiLib::lib('semantic');
$toPage = $this->page;
$tokens = explode(',', $prefs['wiki_pagealias_tokens']);
$prefixes = explode(',', $prefs["wiki_prefixalias_tokens"]);
foreach ($prefixes as $p) {
$p = trim($p);
if (strlen($p) > 0 && TikiLib::strtolower(substr($this->page, 0, strlen($p))) == TikiLib::strtolower($p)) {
$toPage = $p;
$tokens = 'prefixalias';
}
}
$links = $semanticlib->getLinksUsing($tokens, array('toPage' => $toPage));
if (count($links) > 1) {
// There are multiple aliases for this page. Need to disambiguate.
//
// When feature_likePages is set, trying to display the alias itself will
// display an error page with the list of aliased pages in the "like pages" section.
// This allows the user to pick the appropriate alias.
// So, leave the $pageName to the alias.
//
// If feature_likePages is not set, then the user will only see that the page does not
// exist. So it's better to just pick the first one.
//
if ($prefs['feature_likePages'] == 'y' || $tokens == 'prefixalias') {
// Even if there is more then one match, if prefix is being redirected then better
// to fail than to show possibly wrong page
return true;
} else {
// If feature_likePages is NOT set, then trying to display the first one is fine
// $pageName is by ref so it does get replaced
$pageName = $links[0]['fromPage'];
return $tikilib->get_page_info($this->page, true);
}
} elseif (count($links)) {
// there is exactly one match
if ($prefs['feature_wiki_1like_redirection'] == 'y') {
return true;
} else {
$this->page = $links[0]['fromPage'];
return $tikilib->get_page_info($this->page, true);
}
}
}
}
示例10: run
function run($data, $params)
{
global $prefs, $page_regex;
// Grab and handle our Tiki parameters...
extract($params, EXTR_SKIP);
if (!isset($ignore)) {
$ignore = '';
}
if (!isset($splitby)) {
$splitby = '+';
}
if (!isset($skipext)) {
$skipext = false;
}
if (!isset($debug)) {
$debug = false;
}
if (!isset($collect)) {
$collect = 'from';
}
if (!isset($table)) {
$table = 'sep';
}
if (!isset($level)) {
$level = '';
}
// for regexes and external wiki details, see tikilib.php
if ($level == 'strict') {
$level_reg = '([A-Za-z0-9_])([\.: A-Za-z0-9_\-])*([A-Za-z0-9_])';
} elseif ($level == 'full') {
$level_reg = '([A-Za-z0-9_]|[\x80-\xFF])([\.: A-Za-z0-9_\-]|[\x80-\xFF])*([A-Za-z0-9_]|[\x80-\xFF])';
} elseif ($level == 'complete') {
$level_reg = '([^|\(\)])([^|\(\)](?!\)\)))*?([^|\(\)])';
} elseif (($level == 'custom') && ($data != '')) {
if (preg_ispreg($data)) { // custom regular expression
$level_reg = $data;
} elseif ($debug == 2) {
echo $data . ': ' . tra('non-valid custom regex') . '<br />';
}
} else { // default
$level_reg = $page_regex;
}
// define the separator
if ($table == 'br') {
$break = '<br />';
} elseif ($table == 'co') {
$break = tra(', ');
} else {
$break = 'sep';
}
// get array of fromPages to be ignored
$ignorepages = explode($splitby, $ignore);
// Currently we only look in wiki pages.
// Wiki links in articles, blogs, etc are ignored.
$query = 'select distinct tl.`toPage`, tl.`fromPage` from `tiki_links` tl';
$query .= ' left join `tiki_pages` tp on (tl.`toPage` = tp.`pageName`)';
$categories = $this->get_jail();
if ($categories)
$query .= ' inner join `tiki_objects` as tob on (tob.`itemId`= tl.`fromPage` and tob.`type`= ?) inner join `tiki_category_objects` as tc on (tc.`catObjectId`=tob.`objectId` and tc.`categId` IN(' . implode(', ', array_fill(0, count($categories), '?')) . '))';
$query .= ' where tp.`pageName` is null';
$result = $this->query($query, $categories ? array_merge(array('wiki page'), $categories) : array());
$tmp = array();
while ($row = $result->fetchRow()) {
foreach ($ignorepages as $ipage) {
// test whether a substring ignores this page, ignore case
if (fnmatch(TikiLib::strtolower($ipage), TikiLib::strtolower($row['fromPage'])) === true) {
if ($debug == 2) { // the "hardcore case"
echo $row['toPage'] . ' [from: ' . $row['fromPage'] . ']: ' . tra('ignored') . '<br />';
} elseif ($debug) { // add this page to the table
$tmp[] = array($row['toPage'], $row['fromPage'], 'ignored');
}
continue 2; // no need to test other ignorepages or toPages
}
} // foreach ignorepage
// if toPage contains colon, and exloding yields two parts => external Wiki
if (($skipext) && (strstr($row['toPage'], ':') !== false)) {
$parts = explode(':', $row['toPage']);
if (count($parts) == 2) {
if ($debug == 2) {
echo $row['toPage'] . ' [from: ' . $row['fromPage'] . ']: ' . tra('External Wiki') . '<br />';
} elseif ($debug) {
$tmp[] = array($row['toPage'], $row['fromPage'], 'External Wiki');
}
continue;
}
} // $skipext
$dashWikiWord = preg_match("/^(?<=[ \n\t\r\,\;]|^)([A-Z][a-z0-9_\-\x80-\xFF]+[A-Z][a-z0-9_\-\x80-\xFF]+[A-Za-z0-9\-_\x80-\xFF]*)(?=$|[ \n\t\r\,\;\.])$/", $row['toPage']);
$WikiWord = preg_match("/^(?<=[ \n\t\r\,\;]|^)([A-Z][a-z0-9\x80-\xFF]+[A-Z][a-z0-9\x80-\xFF]+[A-Za-z0-9\x80-\xFF]*)(?=$|[ \n\t\r\,\;\.])$/", $row['toPage']);
// test whether toPage is a valid wiki page under current syntax
if ($dashWikiWord && !$WikiWord) { // a Dashed-WikiWord, can we allow this?
if (($prefs['feature_wikiwords'] != 'y') || ($prefs['feature_wikiwords_usedash'] != 'y')) {
//.........这里部分代码省略.........
示例11: ask_ticket
if ($userlib->object_has_one_permission($p['pageName'], 'wiki page')) {
$p['perms_active'] = 'y';
} else {
$p['perms_active'] = 'n';
}
}
$smarty->assign_by_ref('listpages', $listpages['data']);
$smarty->assign_by_ref('cant', $listpages['cant']);
ask_ticket('list-pages');
include_once 'tiki-section_options.php';
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
// Exact match and single result, go to page directly
if (count($listpages['data']) == 1) {
$result = reset($listpages['data']);
if (TikiLib::strtolower($find) == TikiLib::strtolower($result['pageName'])) {
require_once 'lib/wiki/wikilib.php';
header('Location: ' . $wikilib->sefurl($result['pageName'], '', $all_langs));
exit;
}
}
if ($access->is_serializable_request()) {
if (isset($_REQUEST['listonly']) && ($prefs['feature_jquery'] == 'y' && $prefs['feature_jquery_autocomplete'] == 'y')) {
$pages = array();
foreach ($listpages['data'] as $page) {
$pages[] = $page['pageName'];
}
$access->output_serialized($pages);
} else {
$pages = array();
require_once 'lib/wiki/wikilib.php';
示例12: __construct
/**
* @param $objectType
* @param $objectId
*/
function __construct($objectType, $objectId)
{
global $Tiki_ShareObject__groups;
$this->objectHash = md5($objectType . TikiLib::strtolower($objectId));
$this->objectType = $objectType;
$this->objectId = $objectId;
$this->loadedPermission = array();
$this->validGroups = array();
if ($Tiki_ShareObject__groups == null) {
$this->loadGroups();
}
}
示例13: getAliasContaining
function getAliasContaining($query, $exact_match = false, $in_lang = NULL)
{
global $tikilib, $prefs;
$orig_query = $query;
if (!$exact_match) {
$query = "%{$query}%";
}
$mid = "((`target_type` = 'wiki page' AND `target_itemId` LIKE ?)";
$bindvars = array($query);
$prefixes = explode(',', $prefs["wiki_prefixalias_tokens"]);
$haveprefixes = false;
foreach ($prefixes as $p) {
$p = trim($p);
if (strlen($p) > 0 && TikiLib::strtolower(substr($query, 0, strlen($p))) == TikiLib::strtolower($p)) {
$mid .= " OR ( `target_type` = 'wiki page' AND `target_itemId` LIKE ?)";
$bindvars[] = "{$p}%";
$haveprefixes = true;
}
}
$mid .= ") AND ( `relation` = 'tiki.link.alias' ";
if ($haveprefixes) {
$mid .= " OR `relation` = 'tiki.link.prefixalias' ";
}
$mid .= ")";
$querystring = "SELECT `source_itemId` `fromPage`, `target_itemId` `toPage` FROM `tiki_object_relations` WHERE {$mid}";
$aliases = $tikilib->fetchAll($querystring, $bindvars);
$aliases = $this->onlyKeepAliasesFromPageInLanguage($in_lang, $aliases);
return $aliases;
}
示例14: get_pages_by_alias
/**
* Return the page names for a page alias, if any.
*
* Unfortunately there is no mechanism to prevent two
* different pages from sharing the same alias and that is
* why this method return an array of page names instead of a
* page name string.
*
* @param string $alias
* @return array page names
*/
public function get_pages_by_alias($alias)
{
global $prefs;
$semanticlib = TikiLib::lib('semantic');
$pages = array();
if ($prefs['feature_wiki_pagealias'] == 'n' && empty($prefs["wiki_prefixalias_tokens"])) {
return $pages;
}
$toPage = $alias;
$tokens = explode(',', $prefs['wiki_pagealias_tokens']);
$prefixes = explode(',', $prefs["wiki_prefixalias_tokens"]);
foreach ($prefixes as $p) {
$p = trim($p);
if (strlen($p) > 0 && TikiLib::strtolower(substr($alias, 0, strlen($p))) == TikiLib::strtolower($p)) {
$toPage = $p;
$tokens = 'prefixalias';
}
}
$links = $semanticlib->getLinksUsing($tokens, array('toPage' => $toPage));
if (count($links) > 0) {
foreach ($links as $row) {
$pages[] = $row['fromPage'];
}
}
return $pages;
}