当前位置: 首页>>代码示例>>PHP>>正文


PHP TikiLib::lib方法代码示例

本文整理汇总了PHP中TikiLib::lib方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::lib方法的具体用法?PHP TikiLib::lib怎么用?PHP TikiLib::lib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TikiLib的用法示例。


在下文中一共展示了TikiLib::lib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: __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

示例3: action_tracker_filter

 function action_tracker_filter(JitFilter $request)
 {
     $id = $request->ruleId->int();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $tracker = $request->tracker->int();
         $targetEvent = $request->targetEvent->attribute_type();
         $customArguments = $request->parameters->text();
         if (!$targetEvent) {
             throw new Services_Exception_MissingValue('targetEvent');
         }
         $id = $this->replaceRule($id, array('rule' => "\n(if (equals args.trackerId {$tracker}) (event-trigger {$targetEvent} (map\n{$customArguments}\n)))\n", 'ruleType' => 'tracker_filter', 'notes' => $request->notes->text(), 'eventType' => $request->sourceEvent->attribute_type()), 'parameters');
     }
     $rule = $this->getRule($id);
     $root = $rule['element'];
     $parameters = '';
     $targetTracker = null;
     $targetEvent = null;
     if ($root) {
         $targetTracker = (int) $root->equals[1];
         $targetEvent = $root->{'event-trigger'}[0];
         foreach ($root->{'event-trigger'}->map as $element) {
             $parameters .= '(' . $element->getType() . ' ' . $element[0] . ')' . PHP_EOL;
         }
     } else {
         $parameters = "(user args.user)\n(type args.type)\n(object args.object)\n(aggregate args.aggregate)\n";
     }
     return array('rule' => $rule, 'eventTypes' => $this->getEventTypes(), 'targetEvent' => $targetEvent, 'targetTracker' => $targetTracker, 'trackers' => TikiLib::lib('trk')->list_trackers(), 'parameters' => $parameters);
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:28,代码来源:ManageController.php

示例4: smarty_function_fileinfo

function smarty_function_fileinfo($params, $smarty)
{
    if (!is_array($params) || !isset($params['_id']) || !isset($params['_field'])) {
        return;
    }
    $filegallib = TikiLib::lib('filegal');
    $params['_id'] = (int) $params['_id'];
    $infos = $filegallib->get_file($params['_id']);
    if (isset($infos[$params['_field']]) && $infos[$params['_field']] != '') {
        $return = $infos[$params['_field']];
    } elseif ($params['_field'] == 'name') {
        // Fallback to filename if there is no name for the specified file
        $return = $infos['filename'];
    } else {
        $return = '';
    }
    if (isset($params['_link'])) {
        global $prefs, $filegals_manager, $url_path;
        $key_type = substr($infos['filetype'], 0, 9);
        $tmp = '<a href="' . $url_path . 'tiki-download_file.php?fileId=' . $params['_id'] . '&amp;display"';
        if ($prefs['feature_shadowbox'] == 'y') {
            $tmp .= ' rel="shadowbox[' . htmlentities($params['_link']) . '];type=' . (in_array($key_type, array('image/png', 'image/jpe', 'image/gif')) ? 'img' : 'iframe') . '"';
        }
        $return = $tmp . '>' . $return . '</a>';
        unset($tmp);
    }
    return $return;
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:28,代码来源:function.fileinfo.php

示例5: parse

 private function parse($content)
 {
     $content = "~np~{$content}~/np~";
     $parserlib = TikiLib::lib('parser');
     $options = array('protect_email' => false);
     return trim($parserlib->parse_data($content, $options));
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:7,代码来源:EmailAction.php

示例6: 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

示例7: smarty_function_var_dump

/**
 * \brief Smarty plugin to add variable dump to debug console log
 * Usage format {var_dump var="var_name_2_dump"}
 *
 * Adapted to do more than string for tiki 5
 */
function smarty_function_var_dump($params, $smarty)
{
    global $debugger;
    require_once 'lib/debug/debugger.php';
    $smarty = TikiLib::lib('smarty');
    $v = $params['var'];
    if (!empty($v)) {
        $tmp = $smarty->getTemplateVars();
        if (is_array($tmp) && isset($tmp["{$v}"])) {
            if (is_string($tmp[$v])) {
                $debugger->msg("Smarty var_dump(" . $v . ') = ' . print_r($tmp[$v], true));
            } else {
                ob_start();
                var_dump($tmp[$v]);
                $d = ob_get_clean();
                $debugger->msg("Smarty var_dump(" . $v . ') = ' . $d);
            }
        } else {
            $debugger->msg("Smarty var_dump(" . $v . "): Variable not found");
        }
    } else {
        $debugger->msg("Smarty var_dump: Parameter 'var' not specified");
    }
    return '<!-- var_dump(' . $v . ') -->';
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:31,代码来源:function.var_dump.php

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例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' ? "&amp;bl" : "";
            // $bestLang = $prefs['feature_best_language'] == 'y' ? "&amp;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: 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


注:本文中的TikiLib::lib方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。