本文整理汇总了PHP中TikiLib类的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib类的具体用法?PHP TikiLib怎么用?PHP TikiLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TikiLib类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleSave
function handleSave($value, $oldValue)
{
global $prefs, $user;
$tikilib = TikiLib::lib('tiki');
$trackerId = $this->getConfiguration('trackerId');
$file_name = $this->getConfiguration('file_name');
$file_size = $this->getConfiguration('file_size');
$file_type = $this->getConfiguration('file_type');
$perms = Perms::get('tracker', $trackerId);
if ($perms->attach_trackers && $file_name) {
if ($prefs['t_use_db'] == 'n') {
$fhash = md5($file_name . $tikilib->now);
if (file_put_contents($prefs['t_use_dir'] . $fhash, $value) === false) {
$smarty = TikiLib::lib('smarty');
$smarty->assign('msg', tra('Cannot write to this file:') . $fhash);
$smarty->display("error.tpl");
die;
}
$value = '';
} else {
$fhash = 0;
}
$trklib = TikiLib::lib('trk');
$value = $trklib->replace_item_attachment($oldValue, $file_name, $file_type, $file_size, $value, '', $user, $fhash, '', '', $trackerId, $this->getItemId(), '', false);
}
return array('value' => $value);
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:27,代码来源:File.php
示例2: testWikiParser
/**
* @covers TikiLib::parse_data
* @dataProvider provider
*/
public function testWikiParser($input, $output, $options = array())
{
global $prefs;
$prefs['feature_page_title'] = 'y';
$prefs['feature_wiki_paragraph_formatting'] = 'n';
$prefs['pass_chr_special'] = 'n';
$o = new TikiLib();
$this->assertEquals($output, $o->parse_data($input, $options));
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:13,代码来源:WikiParserTest.php
示例3: getSubGraph
function getSubGraph($params)
{
global $wikilib, $dbTiki;
$nodeName = $params->getParam(0);
$nodeName = $nodeName->scalarVal();
$depth = $params->getParam(1);
$depth = $depth->scalarVal();
$nodes = array();
$passed = array($nodeName => true);
$queue = array($nodeName);
$i = 0;
$tikilib = new TikiLib($dbTiki);
$existing_color = $tikilib->get_preference("wiki_3d_existing_page_color", '#00BB88');
$missing_color = $tikilib->get_preference("wiki_3d_missing_page_color", '#FF6666');
while ($i <= $depth && sizeof($queue) > 0) {
$nextQueue = array();
foreach ($queue as $nodeName) {
$neighbours = $wikilib->wiki_get_neighbours($nodeName);
$temp_max = sizeof($neighbours);
for ($j = 0; $j < $temp_max; $j++) {
if (!isset($passed[$neighbours[$j]])) {
$nextQueue[] = $neighbours[$j];
$passed[$neighbours[$j]] = true;
}
$neighbours[$j] = new XML_RPC_Value($neighbours[$j]);
}
$node = array();
$base_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$base_url = preg_replace('/\\/tiki-wiki3d_xmlrpc.php.*$/', '', $base_url);
if ($wikilib->page_exists($nodeName)) {
$color = $existing_color;
$actionUrl = "{$base_url}/tiki-index.php?page={$nodeName}";
} else {
$color = $missing_color;
$actionUrl = "{$base_url}/tiki-editpage.php?page={$nodeName}";
}
$node['neighbours'] = new XML_RPC_Value($neighbours, "array");
if (!empty($color)) {
$node['color'] = new XML_RPC_Value($color, "string");
}
$node['actionUrl'] = new XML_RPC_Value($actionUrl, "string");
$nodes[$nodeName] = new XML_RPC_Value($node, "struct");
}
$i++;
$queue = $nextQueue;
}
$response = array("graph" => new XML_RPC_Value($nodes, "struct"));
return new XML_RPC_Response(new XML_RPC_Value($response, "struct"));
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:49,代码来源:tiki-wiki3d_xmlrpc.php
示例4: wikiplugin_flash
function wikiplugin_flash($data, $params)
{
global $prefs, $user;
$userlib = TikiLib::lib('user');
$tikilib = TikiLib::lib('tiki');
// Handle file from a podcast file gallery
if (isset($params['fileId']) && !isset($params['movie'])) {
$filegallib = TikiLib::lib('filegal');
$file_info = $filegallib->get_file_info($params['fileId']);
if (!$userlib->user_has_perm_on_object($user, $file_info['galleryId'], 'file gallery', 'tiki_p_view_file_gallery')) {
return tra('Permission denied');
}
$params['movie'] = $prefs['fgal_podcast_dir'] . $file_info['path'];
}
// Handle Youtube video
if (isset($params['youtube']) && preg_match('|http(s)?://(\\w+\\.)?youtube\\.com/watch\\?v=([\\w-]+)|', $params['youtube'], $matches)) {
$params['movie'] = "//www.youtube.com/v/" . $matches[3];
}
// Handle Vimeo video
if (isset($params['vimeo']) && preg_match('|http(s)?://(www\\.)?vimeo\\.com/(clip:)?(\\d+)|', $params['vimeo'], $matches)) {
$params['movie'] = '//vimeo.com/moogaloop.swf?clip_id=' . $matches[4];
}
if ((isset($params['youtube']) || isset($params['vimeo'])) && !isset($params['movie'])) {
return tra('Invalid URL');
}
unset($params['type']);
$code = $tikilib->embed_flash($params);
if ($code === false) {
return tra('Missing parameter movie to the plugin flash');
}
return $code;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:32,代码来源:wikiplugin_flash.php
示例5: get_url
/**
* @param $url
* @param bool $use_tidy
* @return array
*/
function get_url($url, $use_tidy = TRUE)
{
global $cookies;
$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");
$referer = $url->getAttribute("referer");
$result['data'] = $data;
if (extension_loaded("tidy")) {
$data = tidy_parse_string($data, array(), 'utf8');
tidy_diagnose($data);
if ($use_tidy) {
$result['ref_error_count'] = tidy_error_count($data);
$result['ref_error_msg'] = tidy_get_error_buffer($data);
}
} else {
$result['ref_error_msg'] = tra("Tidy Extension not present");
}
$result['url'] = $urlstr;
$result['xpath'] = $xpath;
$result['method'] = $url->getAttribute("method");
$result['post'] = $post;
$result['get'] = $get;
$result['referer'] = $referer;
return $result;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:35,代码来源:tiki-tests_edit.php
示例6: renderOutput
function renderOutput($context = array())
{
$smarty = TikiLib::lib('smarty');
$url = $this->getConfiguration('value');
if (empty($url) || $context['list_mode'] == 'csv' || $this->getOption('linkToURL') == 1) {
return $url;
} elseif ($this->getOption('linkToURL') == 2) {
// Site title as link
$smarty->loadPlugin('smarty_function_object_link');
return smarty_function_object_link(array('type' => 'external', 'id' => $url), $smarty);
} elseif ($this->getOption('linkToURL') == 0) {
// URL as link
$parsedUrl = trim(str_replace('<br />', '', TikiLib::lib('tiki')->parse_data($url)));
if ($parsedUrl != $url) {
return $parsedUrl;
}
$smarty->loadPlugin('smarty_function_object_link');
return smarty_function_object_link(array('type' => 'external', 'id' => $url, 'title' => $url), $smarty);
} elseif ($this->getOption('linkToURL') == 3) {
// URL + site title
$smarty->loadPlugin('smarty_function_object_link');
return smarty_function_object_link(array('type' => 'external_extended', 'id' => $url), $smarty);
} elseif ($this->getOption('linkToURL') == 4) {
// URL as link
$smarty->loadPlugin('smarty_function_object_link');
return smarty_function_object_link(array('type' => 'external', 'id' => $url, 'title' => tr($this->getOption('other'))), $smarty);
} else {
return $url;
}
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:30,代码来源:Url.php
示例7: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$profileName = $input->getArgument('profile');
$repository = $input->getArgument('repository');
$force = $input->getOption('force');
$profile = \Tiki_Profile::fromNames($repository, $profileName);
if (!$profile) {
$output->writeln('<error>Profile not found.</error>');
return;
}
$tikilib = \TikiLib::lib('tiki');
$installer = new \Tiki_Profile_Installer();
$isInstalled = $installer->isInstalled($profile);
if ($isInstalled && $force) {
$installer->forget($profile);
$isInstalled = false;
}
if (!$isInstalled) {
$transaction = $tikilib->begin();
if ($installer->install($profile)) {
$transaction->commit();
$output->writeln('Profile applied.');
} else {
$output->writeln("<error>Installation failed:</error>");
foreach ($installer->getFeedback() as $error) {
$output->writeln("<error>{$error}</error>");
}
}
} else {
$output->writeln('<info>Profile was already applied. Nothing happened.</info>');
}
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:32,代码来源:ProfileInstallCommand.php
示例8: smarty_function_favorite
function smarty_function_favorite($params, $smarty)
{
global $prefs, $user;
// Disabled, do nothing
if (empty($user) || $prefs['user_favorites'] != 'y') {
return;
}
$servicelib = TikiLib::lib('service');
$smarty = TikiLib::lib('smarty');
$smarty->loadPlugin('smarty_modifier_escape');
$url = $servicelib->getUrl(array('controller' => 'favorite', 'action' => 'toggle', 'type' => $params['type'], 'object' => $params['object']));
$url = smarty_modifier_escape($url, 'url');
$e_user = smarty_modifier_escape($user);
if (isset($params['label'])) {
$label = $params['label'];
} else {
$label = tr('Favorite');
}
if (isset($params['button_classes'])) {
$button_classes = $params['button_classes'];
} else {
$button_classes = "btn btn-default";
}
return '<a class="' . $button_classes . ' favorite-toggle" href="' . $url . '" data-key="favorite_' . $e_user . '"> ' . $label . '</a>';
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:25,代码来源:function.favorite.php
示例9: wikiplugin_shopperinfo
function wikiplugin_shopperinfo($data, $params)
{
global $user;
$smarty = TikiLib::lib('smarty');
if ($user && $params['showifloggedin'] != 'y' || empty($params['values'])) {
return '';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['shopperinfo'])) {
foreach ($params['values'] as $v) {
// Check all filled in
if (empty($_POST[$v])) {
$access = TikiLib::lib('access');
$access->redirect($_SERVER['REQUEST_URI'], tr('Please fill in all fields'));
die;
}
}
foreach ($params['values'] as $v) {
$_SESSION['shopperinfo'][$v] = $_POST[$v];
}
}
$values = array();
foreach ($params['values'] as $k => $v) {
$t['name'] = $v;
if (!empty($_SESSION['shopperinfo'][$v])) {
$t['current'] = $_SESSION['shopperinfo'][$v];
}
if (!empty($params['labels'][$k])) {
$t['label'] = $params['labels'][$k];
}
$values[] = $t;
}
$smarty->assign('values', $values);
$form = $smarty->fetch('wiki-plugins/wikiplugin_shopperinfo.tpl');
return $form;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:35,代码来源:wikiplugin_shopperinfo.php
示例10: module_top_quizzes
/**
* @param $mod_reference
* @param $module_params
*/
function module_top_quizzes($mod_reference, $module_params)
{
$smarty = TikiLib::lib('smarty');
$quizlib = TikiLib::lib('quiz');
$ranking = $quizlib->list_quiz_sum_stats(0, $mod_reference["rows"], 'timesTaken_desc', '');
$smarty->assign('modTopQuizzes', $ranking["data"]);
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:11,代码来源:mod-func-top_quizzes.php
示例11: module_top_active_blogs
/**
* @param $mod_reference
* @param $module_params
*/
function module_top_active_blogs($mod_reference, $module_params)
{
$smarty = TikiLib::lib('smarty');
$bloglib = TikiLib::lib('blog');
$ranking = $bloglib->list_blogs(0, $mod_reference["rows"], 'activity_desc', '');
$smarty->assign('modTopActiveBlogs', $ranking["data"]);
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:11,代码来源:mod-func-top_active_blogs.php
示例12: execute
function execute($params)
{
$userlib = TikiLib::lib('user');
$smarty = TikiLib::lib('smarty');
$this->set_result_type(TPL_RESULT);
$this->set_result_tpl('debug/tiki-debug_permissions.tpl');
// Is regex to match against var name given?
$p = explode(' ', trim($params));
$mask = count($p) > 0 ? str_replace('$', '', trim($p[0])) : '';
// Get list of all vars
$tpl_vars = $smarty->getTemplateVars();
// Get descriptions for all permissions
$pd = $userlib->get_permissions();
$descriptions = array();
foreach ($pd['data'] as $p) {
$descriptions[$p['permName']] = $p['permDesc'];
}
// convert to vector of names, filter permissions only
$perms = array();
$len = strlen($mask);
foreach ($tpl_vars as $key => $val) {
if ((!$len || $len && preg_match('/' . $mask . '/', $key)) && preg_match('/tiki_p_/', $key)) {
$perms[] = array('name' => $key, 'value' => $val, 'description' => isset($descriptions[$key]) ? $descriptions[$key] : 'No description');
}
}
return $perms;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:27,代码来源:debug-command_perm.php
示例13: wikiplugin_alink
function wikiplugin_alink($data, $params)
{
global $prefs;
$multilinguallib = TikiLib::lib('multilingual');
$tikilib = TikiLib::lib('tiki');
extract($params, EXTR_SKIP);
if (!isset($aname)) {
return "<b>missing parameter for aname</b><br />";
}
// the following replace is necessary to maintain compliance with XHTML 1.0 Transitional
// and the same behavior as tikilib.php. This will change when the world arrives at XHTML 1.0 Strict.
$aname = preg_replace('/[^a-zA-Z0-9]+/', '_', $aname);
if (isset($pagename) && $pagename) {
// Stolen, with some modifications, from tikilib.php line 4717-4723
if ($desc = $tikilib->page_exists_desc($pagename)) {
// to choose the best page language
$bestLang = $prefs['feature_multilingual'] == 'y' && $prefs['feature_best_language'] == 'y' ? "&bl" : "";
// $bestLang = $prefs['feature_best_language'] == 'y' ? "&bl" : "";
return "<a title=\"{$desc}\" href='tiki-index.php?page=" . urlencode($pagename) . $bestLang . "#" . $aname . "' class='wiki'>{$data}</a>";
} else {
return $data . '<a href="tiki-editpage.php?page=' . urlencode($pagename) . '" title="' . tra("Create page:") . ' ' . urlencode($pagename) . '" class="wiki wikinew">?</a>';
}
} elseif (isset($_REQUEST['page'])) {
$urlPrefix = "tiki-index.php?page=";
if ($prefs['feature_sefurl'] == 'y') {
$urlPrefix = "";
}
return "<a href=\"" . $urlPrefix . $_REQUEST["page"] . "#{$aname}\">{$data}</a>";
} else {
return "<a href=\"#{$aname}\">{$data}</a>";
}
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:32,代码来源:wikiplugin_alink.php
示例14: export
public static function export(Tiki_Profile_Writer $writer, $categId, $deep, $includeObjectCallback)
{
$categlib = TikiLib::lib('categ');
if (!($info = $categlib->get_category($categId))) {
return false;
}
$items = array();
foreach ($categlib->get_category_objects($categId) as $row) {
if ($includeObjectCallback($row['type'], $row['itemId'])) {
$items[] = array($row['type'], $writer->getReference($row['type'], $row['itemId']));
}
}
$data = array('name' => $info['name']);
if (!empty($info['parentId'])) {
$data['parent'] = $writer->getReference('category', $info['parentId']);
}
if (!empty($items)) {
$data['items'] = $items;
}
$writer->addObject('category', $categId, $data);
if ($deep) {
$descendants = $categlib->get_category_descendants($categId);
array_shift($descendants);
foreach ($descendants as $children) {
self::export($writer, $children, $deep, $includeObjectCallback);
}
}
return true;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:29,代码来源:Category.php
示例15: __toString
function __toString()
{
$this->applyOptions();
$smarty = \TikiLib::lib('smarty');
$smarty->assign('control', ['field' => $this->fieldName, 'options' => $this->options, 'values' => array_fill_keys($this->values, true)]);
return $smarty->fetch('filter_control/inline_checkboxes.tpl');
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:7,代码来源:InlineCheckboxes.php
示例16: wikiplugin_wysiwyg
function wikiplugin_wysiwyg($data, $params)
{
global $wysiwyglib;
include_once 'lib/ckeditor_tiki/wysiwyglib.php';
// TODO refactor: defaults for plugins?
$defaults = array();
$plugininfo = wikiplugin_wysiwyg_info();
foreach ($plugininfo['params'] as $key => $param) {
$defaults["{$key}"] = $param['default'];
}
$params = array_merge($defaults, $params);
$html = TikiLib::lib('tiki')->parse_data($data, array('is_html' => true));
global $tiki_p_edit, $page, $prefs;
static $execution = 0;
if ($tiki_p_edit === 'y') {
$class = "wp_wysiwyg";
$exec_key = $class . '_' . ++$execution;
$style = " style='min-width:{$params['width']};min-height:{$params['height']}'";
$params['section'] = empty($params['section']) ? 'wysiwyg_plugin' : $params['section'];
$params['_wysiwyg'] = 'y';
$params['is_html'] = true;
//$params['comments'] = true;
$ckoption = $wysiwyglib->setUpEditor(true, $exec_key, $params, '', false);
$html = "<div id='{$exec_key}' class='{$class}'{$style}>" . $html . '</div>';
$js = '$("#' . $exec_key . '").wysiwygPlugin("' . $execution . '", "' . $page . '", ' . $ckoption . ')';
TikiLib::lib('header')->add_jq_onready($js);
}
return $html;
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:29,代码来源:wikiplugin_wysiwyg.php
示例17: export
public static function export(Tiki_Profile_Writer $writer, $id, $withTopic = false, $withType = false)
{
$artlib = TikiLib::lib('art');
$info = $artlib->get_article($id, false);
if (!$info) {
return false;
}
$bodypage = "article_{$id}_body";
$writer->writeExternal($bodypage, $writer->getReference('wiki_content', $info['body']));
$out = array('title' => $info['title'], 'author' => $info['authorName'], 'body' => "wikicontent:{$bodypage}", 'type' => $writer->getReference('article_type', $info['type']), 'publication_date' => $info['publishDate'], 'expiration_date' => $info['expireDate'], 'topline' => $info['topline'], 'subtitle' => $info['subtitle'], 'link_to' => $info['linkto'], 'language' => $info['lang']);
if ($info['topicId']) {
if ($withTopic) {
Tiki_Profile_InstallHandler_ArticleTopic::export($writer, $info['topicId']);
}
$out['topic'] = $writer->getReference('article_topic', $info['topicId']);
}
if ($info['heading']) {
$headerpage = "article_{$id}_heading";
$writer->writeExternal($headerpage, $writer->getReference('wiki_content', $info['heading']));
$out['heading'] = "wikicontent:{$headerpage}";
}
$out = array_filter($out);
$writer->addObject('article', $id, $out);
if ($withType) {
Tiki_Profile_InstallHandler_ArticleType::export($writer, $info['type']);
}
return true;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:28,代码来源:Article.php
示例18: render
private function render($controller, $action, $output)
{
if (isset($output['FORWARD'])) {
$loc = $_SERVER['PHP_SELF'];
$arguments = $output['FORWARD'];
header("Location: {$loc}?" . http_build_query($arguments, '', '&'));
exit;
}
$smarty = TikiLib::lib('smarty');
$template = "{$controller}/{$action}.tpl";
//if template doesn't exists, simply return the array given from the action
if ($smarty->templateExists($template) == false) {
return json_encode($output);
}
$access = TikiLib::lib('access');
foreach ($output as $key => $value) {
$smarty->assign($key, $value);
}
if ($access->is_xml_http_request()) {
$headerlib = TikiLib::lib('header');
$content = $smarty->fetch($template);
$content .= $headerlib->output_js();
return $content;
} else {
$smarty->assign('mid', $template);
return $smarty->fetch('tiki.tpl');
}
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:28,代码来源:Broker.php
示例19: module_top_files
/**
* @param $mod_reference
* @param $module_params
*/
function module_top_files($mod_reference, $module_params)
{
$smarty = TikiLib::lib('smarty');
$filegallib = TikiLib::lib('filegal');
$ranking = $filegallib->list_files(0, $mod_reference["rows"], 'hits_desc', '');
$smarty->assign('modTopFiles', $ranking["data"]);
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:11,代码来源:mod-func-top_files.php
示例20: wikiplugin_cclite
function wikiplugin_cclite($data, $params)
{
global $prefs, $user;
$userlib = TikiLib::lib('user');
$smarty = TikiLib::lib('smarty');
$headerlib = TikiLib::lib('header');
global $cclitelib;
require_once 'lib/payment/cclitelib.php';
if (empty($user)) {
return '{REMARKSBOX(type=note, title=Cclite)}' . tra('You need to be logged in to view this information.') . '{REMARKSBOX}';
}
$default = array('mode' => 'summary', 'registry' => '');
if (is_array($default['registry']) && !empty($default['registry'])) {
$default['registry'] = $default['registry'][0];
}
$params = array_merge($default, $params);
switch ($params['mode']) {
case 'recent':
$result = $cclitelib->cclite_send_request('recent');
break;
case 'summary':
default:
$result = $cclitelib->cclite_send_request('summary');
break;
}
//$r = $cclitelib->cclite_send_request('logoff');
$result = '<em>In development...</em><br />' . $result;
$smarty->assign('wp_cclite_result', $result);
return '~np~' . $smarty->fetch('wiki-plugins/wikiplugin_cclite.tpl') . '~/np~';
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:30,代码来源:wikiplugin_cclite.php
注:本文中的TikiLib类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论