本文整理汇总了PHP中TikiLib::parse_str方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::parse_str方法的具体用法?PHP TikiLib::parse_str怎么用?PHP TikiLib::parse_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiLib
的用法示例。
在下文中一共展示了TikiLib::parse_str方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
public static function export(Tiki_Profile_Writer $writer, $moduleId)
{
$modlib = TikiLib::lib('mod');
if (!($info = $modlib->get_assigned_module($moduleId))) {
return false;
}
$spec = $modlib->get_module_info($info['name']);
TikiLib::parse_str($info['params'], $module_params);
foreach ($module_params as $param => &$value) {
if (isset($spec['params'][$param])) {
$def = $spec['params'][$param];
if (isset($def['profile_reference'])) {
$value = self::handleValueExport($writer, $def, $value);
}
}
}
$info['params'] = $module_params;
$data = array('name' => $info['name'], 'position' => $info['position'], 'order' => $info['ord'], 'cache' => $info['cache_time'], 'rows' => $info['rows'], 'groups' => unserialize($info['groups']), 'params' => $info['params']);
if ($custom = $modlib->get_user_module($info['name'])) {
$data['custom'] = $custom['data'];
$data['parse'] = $custom['parse'];
}
$writer->addObject('module', $moduleId, $data);
return true;
}
示例2: module_shoutbox
/**
* @param $mod_reference
* @param $module_params
*/
function module_shoutbox($mod_reference, $module_params)
{
global $tikilib;
require_once 'lib/tikilib.php';
global $shoutboxlib, $prefs, $user, $tiki_p_view_shoutbox;
global $tiki_p_admin_shoutbox, $tiki_p_post_shoutbox, $base_url, $smarty, $access;
include_once 'lib/shoutbox/shoutboxlib.php';
if ($tiki_p_view_shoutbox == 'y') {
if (true || $prefs['feature_ajax'] !== 'y') {
$setup_parsed_uri = parse_url($_SERVER['REQUEST_URI']);
if (isset($setup_parsed_uri['query'])) {
TikiLib::parse_str($setup_parsed_uri['query'], $sht_query);
} else {
$sht_query = array();
}
$shout_father = $setup_parsed_uri['path'];
if (isset($sht_query) && count($sht_query) > 0) {
$sht = array();
foreach ($sht_query as $sht_name => $sht_val) {
$sht[] = $sht_name . '=' . $sht_val;
}
$shout_father .= '?' . implode('&', $sht) . '&';
} else {
$shout_father .= '?';
}
} else {
// $prefs['feature_ajax'] == 'y' // AJAX_TODO
$shout_father = 'tiki-shoutbox.php?';
}
$smarty->assign('shout_ownurl', $shout_father);
if (isset($_REQUEST['shout_remove'])) {
$info = $shoutboxlib->get_shoutbox($_REQUEST['shout_remove']);
if ($tiki_p_admin_shoutbox == 'y' || $info['user'] == $user) {
$access->check_authenticity();
$shoutboxlib->remove_shoutbox($_REQUEST["shout_remove"]);
}
}
if ($tiki_p_post_shoutbox == 'y') {
if (isset($_REQUEST['shout_send'])) {
doProcessShout($_REQUEST);
}
}
$maxrows = isset($module_params['maxrows']) ? $module_params['maxrows'] : 5;
$shout_msgs = $shoutboxlib->list_shoutbox(0, $maxrows, 'timestamp_desc', '');
$smarty->assign('shout_msgs', $shout_msgs['data']);
// Subst module parameters
$smarty->assign('tooltip', isset($module_params['tooltip']) ? $module_params['tooltip'] : 0);
$smarty->assign('buttontext', isset($module_params['buttontext']) ? $module_params['buttontext'] : tra('Post'));
$smarty->assign('waittext', isset($module_params['waittext']) ? $module_params['waittext'] : tra('Please wait...'));
$smarty->assign('tweet', isset($module_params['tweet']) && $tikilib->get_user_preference($user, 'twitter_token') != '' ? $module_params['tweet'] : '0');
$smarty->assign('facebook', isset($module_params['facebook']) && $tikilib->get_user_preference($user, 'facebook_token') != '' ? $module_params['facebook'] : '0');
}
}
示例3: action_execute
function action_execute($input)
{
$modlib = TikiLib::lib('mod');
$modname = $input->module->text();
if ($modname) {
$params = (array) $input->params->array();
$moduleId = $input->moduleId->int();
if ($moduleId) {
$module_reference = $modlib->get_assigned_module($moduleId);
TikiLib::parse_str($module_reference['params'], $module_reference['params']);
$module_reference['params'] = array_merge($params, $module_reference['params']);
} else {
$module_reference = array('name' => $modname, 'params' => $params);
}
$result = $modlib->execute_module($module_reference);
}
return array('html' => $result);
}
示例4: smarty_function_button
//.........这里部分代码省略.........
}
}
$disabled = false;
if (!empty($params['_disabled'])) {
// Filter the condition
if (preg_match('/[a-zA-Z0-9 =<>!]+/', $params['_disabled'])) {
$error_report = error_reporting(~E_ALL);
$return = eval('$disabled =' . $params['_disabled'] . ";");
error_reporting($error_report);
if ($return !== FALSE) {
if ($disabled) {
if (!empty($params['_disabled_class'])) {
$params['_class'] = $params['_disabled_class'];
} else {
$params['_class'] = 'disabled';
}
if (!empty($params['_disabled_text'])) {
$params['_text'] = $params['_disabled_text'];
}
if (!empty($params['_disabled_title'])) {
$params['_title'] = $params['_disabled_title'];
}
if (!empty($params['_disabled_icon'])) {
$params['_icon'] = $params['_disabled_icon'];
}
if (!empty($params['_disabled_icon_name'])) {
$params['_icon_name'] = $params['_disabled_icon_name'];
}
}
}
}
unset($params['_disabled']);
}
//apply class only to the button
if (!empty($params['_class'])) {
$class = $params['_class'];
}
if (!empty($params['_id'])) {
$id = ' id="' . $params['_id'] . '"';
} else {
$id = '';
}
unset($params['_class']);
if (!$disabled) {
$flip_id = '';
if (!empty($params['_flip_id'])) {
$params['_onclick'] = "javascript:flip('" . $params['_flip_id'] . "');flip('" . $params['_flip_id'] . "_close','inline');return false;";
if (!empty($params['_escape']) && $params['_escape'] === 'y') {
$params['_onclick'] = addslashes($params['_onclick']);
}
if (!isset($params['_flip_hide_text']) || $params['_flip_hide_text'] != 'n') {
$cookie_key = 'show_' . $params['_flip_id'];
$params['_text'] .= '<span id="' . $params['_flip_id'] . '_close" style="display:' . (isset($_SESSION['tiki_cookie_jar'][$cookie_key]) && $_SESSION['tiki_cookie_jar'][$cookie_key] == 'y' || isset($params['_flip_default_open']) && $params['_flip_default_open'] == 'y' ? 'inline' : 'none') . ';"> (' . tra('Hide') . ')</span>';
}
}
$auto_query_args_orig = $auto_query_args;
if (!empty($params['_auto_args'])) {
if ($params['_auto_args'] != '*') {
if (!isset($auto_query_args)) {
$auto_query_args = null;
}
$auto_query_args = explode(',', $params['_auto_args']);
}
} else {
$params['_noauto'] = 'y';
}
// Remove params that does not start with a '_', since we don't want them to modify the URL except when in auto_query_args
if (!isset($params['_keepall']) || $params['_keepall'] != 'y') {
foreach ($params as $k => $v) {
if ($k[0] != '_' && $k != 'href' && (empty($auto_query_args) || !in_array($k, $auto_query_args))) {
unset($params[$k]);
}
}
}
$url_args = array();
if (!empty($params['href'])) {
// Handle anchors
if (strpos($params['href'], '#')) {
list($params['href'], $params['_anchor']) = explode('#', $params['href'], 2);
}
// Handle script and URL arguments
if (($pos = strpos($params['href'], '?')) !== false) {
$params['_script'] = substr($params['href'], 0, $pos);
TikiLib::parse_str($tikilib->htmldecode(substr($params['href'], $pos + 1)), $url_args);
$params = array_merge($params, $url_args);
} else {
$params['_script'] = $params['href'];
}
unset($params['href']);
}
$html = smarty_block_self_link($params, $params['_text'], $smarty);
} else {
$params['_disabled'] = 'y';
$html = smarty_block_self_link($params, $params['_text'], $smarty);
}
$type = isset($params['_type']) ? $params['_type'] : 'default';
$auto_query_args = $auto_query_args_orig;
$html = preg_replace('/<a /', '<a class="btn btn-' . $type . ' ' . $class . '" data-role="button" data-inline="true" ' . $id . ' ', $html);
return $html;
}
示例5: getModulesForExport
/**
* @global TikiLib $tikilib
* @param bool $added shows current prefs not in defaults
* @return array (prefname => array( 'current' => current value, 'default' => default value ))
*/
function getModulesForExport()
{
$export = array();
$assigned_modules = $this->get_assigned_modules();
foreach ($assigned_modules as $zone => $modules) {
foreach ($modules as $pos => $module) {
$modtogo['type'] = 'module';
$modtogo['data'] = array();
$modtogo['data']['name'] = $module['name'];
TikiLib::parse_str($module['params'], $modtogo['data']['params']);
$modtogo['data']['groups'] = unserialize($module['groups']);
$modtogo['data']['order'] = $module['ord'];
$modtogo['data']['position'] = str_replace('_modules', '', $this->module_zones[$module['position']]);
if ($this->is_user_module($module['name'])) {
$um = $this->get_user_module($module['name']);
if (preg_match("/^\\!*\\{.*\\}\$/", trim($um['data']), $matches)) {
// start and end with { and } makes yaml parser think it's a serialized value
$um['data'] = $um['data'] . "\n";
// so force it to be a literal block
}
$modtogo['data']['custom'] = $um['data'];
// the yaml dumper copes with linefeeds etc as a literal block
$modtogo['data']['parse'] = empty($um['parse']) ? 'n' : $um['parse'];
}
$export[] = $modtogo;
}
}
return $export;
}
示例6: module_user_bookmarks
/**
* @param $mod_reference
* @param $module_params
*/
function module_user_bookmarks($mod_reference, $module_params)
{
$tikilib = TikiLib::lib('tiki');
$smarty = TikiLib::lib('smarty');
global $user, $prefs, $tiki_p_create_bookmarks;
global $bookmarklib;
include_once 'lib/bookmarks/bookmarklib.php';
$setup_parsed_uri = parse_url($_SERVER["REQUEST_URI"]);
if (isset($setup_parsed_uri["query"])) {
TikiLib::parse_str($setup_parsed_uri["query"], $setup_query_data);
} else {
$setup_query_data = array();
}
if ($user && $tiki_p_create_bookmarks == 'y') {
// check the session to get the directory or create directory =0
$smarty->assign('ownurl', $tikilib->httpPrefix() . $_SERVER["REQUEST_URI"]);
if (isset($_REQUEST["bookmarks_directory"])) {
$_SESSION["bookmarks_directory"] = $_REQUEST["bookmarks_directory"];
} elseif (!isset($_SESSION["bookmarks_directory"])) {
$_SESSION["bookmarks_directory"] = 0;
}
$ownurl = $tikilib->httpPrefix() . $_SERVER["REQUEST_URI"];
// Now build urls
if (strstr($ownurl, '?')) {
$modb_sep = '&';
} else {
$modb_sep = '?';
}
$smarty->assign('modb_sep', $modb_sep);
if (isset($_REQUEST["bookmark_removeurl"])) {
$bookmarklib->remove_url($_REQUEST["bookmark_removeurl"], $user);
}
if (isset($_REQUEST["bookmark_create_folder"])) {
$bookmarklib->add_folder($_SESSION["bookmarks_directory"], $_REQUEST['modb_name'], $user);
}
if (isset($_REQUEST["bookmark_mark"])) {
$name = $_REQUEST["modb_name"];
if (empty($name)) {
// Check if we are bookmarking a wiki-page
if (strstr($_SERVER["REQUEST_URI"], 'tiki-index')) {
// Get the page
if (isset($setup_query_data["page"])) {
$name = $setup_query_data["page"];
} else {
$name = $prefs['wikiHomePage'];
}
}
// Check if we are bookmarking an article
if (strstr($_SERVER["REQUEST_URI"], 'tiki-read_article')) {
$artlib = TikiLib::lib('art');
$info = $artlib->get_article($setup_query_data["articleId"]);
$name = $info["title"];
}
// Check if we are bookmarking a file gallery
if (strstr($_SERVER["REQUEST_URI"], 'tiki-list_file_gallery')) {
$filegallib = TikiLib::lib('filegal');
$info = $filegallib->get_file_gallery($setup_query_data["galleryId"]);
$name = $info["name"];
}
// Check if we are bookmarking an image gallery
if (strstr($_SERVER["REQUEST_URI"], 'tiki-browse_gallery') || strstr($_SERVER["REQUEST_URI"], 'tiki-list_gallery')) {
$imagegallib = TikiLib::lib('imagegal');
$info = $imagegallib->get_gallery($setup_query_data["galleryId"]);
$name = $info["name"];
}
// Check if we are bookmarking an image
if (strstr($_SERVER["REQUEST_URI"], 'tiki-browse_image')) {
$imagegallib = TikiLib::lib('imagegal');
$info = $imagegallib->get_image($setup_query_data["imageId"]);
$name = $info["name"];
}
// Check if we are bookmarking a forum
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_forum')) {
$info = TikiLib::lib('comments')->get_forum($setup_query_data["forumId"]);
$name = $info["name"];
}
// Check if we are bookmarking a faq
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_faq')) {
$info = TikiLib::lib('faq')->get_faq($setup_query_data["faqId"]);
$name = $info["title"];
}
// Check if we are bookmarking a weblog
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_blog')) {
$bloglib = TikiLib::lib('blog');
$info = $bloglib->get_blog($setup_query_data["blogId"]);
$name = $info["title"];
}
}
if (!empty($name)) {
$bookmarklib->replace_url(0, $_SESSION["bookmarks_directory"], $name, $ownurl, $user);
}
}
$modb_p_info = $bookmarklib->get_folder($_SESSION["bookmarks_directory"], $user);
$modb_father = $modb_p_info["parentId"];
// get urls
$modb_urls = $bookmarklib->list_folder($_SESSION["bookmarks_directory"], 0, -1, 'name_asc', '', $user);
//.........这里部分代码省略.........
示例7: _refererhi
function _refererhi()
{
$referer = parse_url($_SERVER['HTTP_REFERER']);
if (empty($referer['query'])) {
return '';
}
TikiLib::parse_str($referer['query'], $vars);
if (isset($vars['q'])) {
return $vars['q'];
} else {
if (isset($vars['p'])) {
return $vars['p'];
}
}
return '';
}
示例8: verif_url
/**
* @param $url
* @param bool $use_tidy
* @return array
*/
function verif_url($url, $use_tidy = TRUE)
{
global $cookies;
static $purifier;
static $loaded = false;
$smarty = TikiLib::lib('smarty');
$result = array();
$get = get_from_dom($url->getElementsByTagName('get')->item(0));
$post = get_from_dom($url->getElementsByTagName('post')->item(0));
$xpath = $url->getElementsByTagName('xpath')->item(0)->textContent;
$data = $url->getElementsByTagName('data')->item(0)->textContent;
$urlstr = $url->getAttribute('src');
if (extension_loaded('http')) {
$options['timeout'] = 2;
$options['connecttimeout'] = 2;
$options['url'] = $url->getAttribute('src');
$options['referer'] = $url->getAttribute('referer');
$options['redirect'] = 0;
$options['cookies'] = $cookies;
$options['cookiestore'] = tempnam('/tmp/', 'tiki-tests');
// Close the session to avoid timeout
session_write_close();
switch (strtolower($url->getAttribute('method'))) {
case 'get':
$buffer = http_get($urlstr, $options, $info);
break;
case 'post':
$buffer = http_post_fields($urlstr, $post, NULL, $options, $info);
}
$headers = http_parse_headers($buffer);
if (isset($headers['Set-Cookie'])) {
foreach ($headers['Set-Cookie'] as $c) {
TikiLib::parse_str($c, $cookies);
}
}
$buffer = http_parse_message($buffer)->body;
} elseif (extension_loaded('curl')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $urlstr);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_TIMEOUT, 2);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_REFERER, $url->getAttribute('referer'));
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl, CURLOPT_USERAGENT, 'TikiTest');
// We deal with the cookies
$cookies_string = '';
foreach ($cookies as $c => $v) {
$cookies_string .= "{$c}={$v}; path=/;";
}
curl_setopt($curl, CURLOPT_COOKIE, $cookies_string);
switch (strtolower($url->getAttribute('method'))) {
case 'get':
curl_setopt($curl, CURLOPT_HTTPGET, true);
break;
case 'post':
curl_setopt($curl, CURLOPT_POST, true);
$post_string = '';
foreach ($post as $p => $v) {
if ($post_string != '') {
$post_string .= '&';
}
$post_string .= "{$p}={$v}";
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_string);
}
// Close the session to avoid timeout
session_write_close();
$http_response = curl_exec($curl);
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = substr($http_response, 0, $header_size);
$body = substr($http_response, $header_size);
preg_match_all('|Set-Cookie: (.*);|U', $header, $cookies_array);
foreach ($cookies_array[1] as $c) {
$cookies_tmp .= "&{$c}";
}
TikiLib::parse_str($cookies_tmp, $cookies_titi);
if (!is_array($cookies)) {
$cookies = array();
}
$cookies = array_merge($cookies, $cookies_titi);
$buffer = $body;
curl_close($curl);
}
if (extension_loaded('tidy')) {
$data = tidy_parse_string($data, array(), 'utf8');
$buffer = tidy_parse_string($buffer, array(), 'utf8');
if ($use_tidy) {
tidy_diagnose($data);
$result['ref_error_count'] = tidy_error_count($data);
$result['ref_error_msg'] = tidy_get_error_buffer($data);
tidy_diagnose($buffer);
$result['replay_error_count'] = tidy_error_count($buffer);
//.........这里部分代码省略.........
示例9: elseif
} elseif (!strstr($orig_url, '.php')) {
$orig_url = preg_replace('#\\/([^\\/\\?]+)(\\?.*)?$#', '/tiki-index.php?page=$1', $orig_url);
$params = parse_url($orig_url);
if (empty($params['query'])) {
$orig_url = $prefs['tikiIndex'];
}
}
if (strstr($orig_url, 'tiki-index.php') || strstr($orig_url, 'tiki-read_article.php')) {
$multilinguallib = TikiLib::lib('multilingual');
$orig_url = urldecode($orig_url);
if (($txt = strstr($orig_url, '?')) == false) {
$txt = '';
} else {
$txt = substr($txt, 1);
}
TikiLib::parse_str($txt, $param);
if (!empty($param['page_id'])) {
$pageId = $param['page_id'];
$type = 'wiki page';
} else {
if (!empty($param['articleId'])) {
$pageId = $param['articleId'];
$type = 'article';
} else {
if (!empty($param['page'])) {
$page = $param['page'];
$info = $tikilib->get_page_info($page);
$pageId = $info['page_id'];
$type = 'wiki page';
} else {
$wikilib = TikiLib::lib('wiki');
示例10: parse_url
}
}
}
$smarty->assign('comments_request_data', $comments_aux);
if (!isset($_REQUEST['comments_threshold'])) {
$_REQUEST['comments_threshold'] = 0;
} else {
$smarty->assign('comments_threshold_param', '&comments_threshold=' . $_REQUEST['comments_threshold']);
}
$smarty->assign('comments_threshold', $_REQUEST['comments_threshold']);
// This sets up comments father as the father
$comments_parsed = parse_url($tikilib->httpPrefix() . $_SERVER["REQUEST_URI"]);
if (!isset($comments_parsed["query"])) {
$comments_parsed["query"] = '';
}
TikiLib::parse_str($comments_parsed["query"], $comments_query);
$comments_father = $comments_parsed["path"];
$comments_complete_father = $comments_father . $comments_t_query;
if (strstr($comments_complete_father, "?")) {
$comments_complete_father .= '&';
} else {
$comments_complete_father .= '?';
}
$smarty->assign('comments_father', $comments_father);
$smarty->assign('comments_complete_father', $comments_complete_father);
if (!isset($_REQUEST["comments_threadId"])) {
$_REQUEST["comments_threadId"] = 0;
}
$smarty->assign("comments_threadId", $_REQUEST["comments_threadId"]);
// The same for replies to comments threads
if (!isset($_REQUEST["comments_reply_threadId"])) {
示例11: dispatchValues
function dispatchValues($input, &$params)
{
if (is_string($input)) {
TikiLib::parse_str($input, $module_params);
} else {
$module_params = $input;
}
foreach ($params as $name => &$inner) {
if (isset($module_params[$name])) {
if (isset($inner['separator'])) {
$inner['value'] = implode($inner['separator'], (array) $module_params[$name]);
} else {
$inner['value'] = $module_params[$name];
}
} else {
$inner['value'] = null;
}
}
// resort params into sections
$reorderedparams = array();
foreach ($params as $k => $p) {
if (!isset($reorderedparams[$p['section']])) {
$reorderedparams[$p['section']] = array();
}
$reorderedparams[$p['section']][$k] = $p;
}
$params = $reorderedparams;
}
示例12: tra
if ($_REQUEST['moduleId'] > 0) {
foreach ($modinfo['params'] as $pname => $param) {
if ($param['required'] && empty($_REQUEST['assign_params'][$pname]))
$missing_params[] = $param['name'];
}
}
$smarty->assign('missing_params', $missing_params);
}
$smarty->assign('preview', 'n');
if (isset($_REQUEST['preview'])) {
check_ticket('admin-modules');
$smarty->assign('preview', 'y');
$smarty->assign_by_ref('assign_name', $_REQUEST['assign_name']);
if (!is_array($_REQUEST['assign_params'])) {
TikiLib::parse_str($_REQUEST['assign_params'], $module_params);
} else {
$module_params=$_REQUEST['assign_params'];
}
$smarty->assign_by_ref('module_params', $module_params);
if (isset($module_params['title'])) {
$smarty->assign('tpl_module_title', tra($module_params['title']));
}
if (isset($_REQUEST['assign_rows'])) {
$module_rows = $_REQUEST['assign_rows'];
$smarty->assign_by_ref('assign_rows', $_REQUEST['assign_rows']);
} elseif (isset($_REQUEST['assign_params']['rows']))
$module_rows = $_REQUEST['assign_params']['rows'];
else
$module_rows = 10;