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


PHP tra函数代码示例

本文整理汇总了PHP中tra函数的典型用法代码示例。如果您正苦于以下问题:PHP tra函数的具体用法?PHP tra怎么用?PHP tra使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了tra函数的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: smarty_function_memusage

function smarty_function_memusage($params, $smarty)
{
    if (function_exists('memory_get_peak_usage')) {
        // PHP 5.2+
        $memusage = memory_get_peak_usage();
    } elseif (function_exists('memory_get_usage')) {
        //PHP 4 >= 4.3.2, PHP 5
        $memusage = memory_get_usage();
    } else {
        $memusage = 0;
    }
    if ($memusage > 0) {
        $memunit = "B";
        if ($memusage > 1024) {
            $memusage = $memusage / 1024;
            $memunit = "kB";
        }
        if ($memusage > 1024) {
            $memusage = $memusage / 1024;
            $memunit = "MB";
        }
        if ($memusage > 1024) {
            $memusage = $memusage / 1024;
            $memunit = "GB";
        }
        print number_format($memusage, 2) . $memunit;
    } else {
        print tra("Unknown");
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:30,代码来源:function.memusage.php

示例3: get_global_watch_types

 /**
  * Returns an array of notification types
  *
  * @param boolean $checkPermission If enabled, only return types for which the user has the permission needed so that they are effective.
  * @return A string-indexed bidimensional array of watch types. The first index is the watch event name.
  *   Second-level array are also string-indexed with elements label (description of the event),
  *   type (usually the type of watched objects) and url (a relevant script to access when an event happens, if any).   
  */
 function get_global_watch_types($checkPermission = false)
 {
     global $prefs, $tiki_p_admin, $tiki_p_admin_file_galleries;
     $watches['user_registers'] = array('label' => tra('A user registers'), 'type' => 'users', 'url' => 'tiki-adminusers.php', 'available' => $prefs['allowRegister'] == 'y', 'permission' => $tiki_p_admin == 'y');
     $watches['article_submitted'] = array('label' => tra('A user submits an article'), 'type' => 'article', 'url' => 'tiki-list_submissions.php', 'available' => $prefs['feature_articles'] == 'y');
     $watches['article_edited'] = array('label' => tra('A user edits an article'), 'type' => 'article', 'url' => 'tiki-list_articles.php', 'available' => $prefs['feature_articles'] == 'y');
     $watches['article_deleted'] = array('label' => tra('A user deletes an article'), 'type' => 'article', 'url' => 'tiki-list_submissions.php', 'available' => $prefs['feature_articles'] == 'y');
     $watches['article_*'] = array('label' => tra('An article is submitted, edited, deleted or commented on.'), 'type' => 'article', 'url' => '', 'available' => $prefs['feature_articles'] == 'y');
     $watches['blog_post'] = array('label' => tra('A new blog post is published'), 'type' => 'blog', 'url' => '', 'available' => $prefs['feature_blogs'] == 'y', 'object' => '*');
     $watches['wiki_page_changes'] = array('label' => tra('A wiki page is created, deleted or edited, except for minor changes.'), 'type' => 'wiki page', 'url' => 'tiki-lastchanges.php', 'available' => $prefs['feature_wiki'] == 'y');
     $watches['wiki_page_changes_incl_minor'] = array('label' => tra('A wiki page is created, deleted or edited, even for minor changes.'), 'type' => 'wiki page', 'url' => 'tiki-lastchanges.php', 'available' => $prefs['feature_wiki'] == 'y');
     $watches['wiki_comment_changes'] = array('label' => tra('A comment in a wiki page is posted or edited'), 'type' => 'wiki page', 'url' => '', 'available' => $prefs['feature_wiki'] == 'y' && $prefs['feature_wiki_comments'] == 'y');
     $watches['article_commented'] = array('label' => tra('A comment in an article is posted or edited'), 'type' => 'article', 'url' => '', 'available' => $prefs['feature_articles'] == 'y' && $prefs['feature_article_comments'] == 'y');
     $watches['fgal_quota_exceeded'] = array('label' => tra('File gallery quota exceeded'), 'type' => 'file gallery', 'url' => '', 'available' => $prefs['feature_file_galleries'] == 'y', 'permission' => $tiki_p_admin == 'y');
     $watches['auth_token_called'] = array('label' => tra('Token is called'), 'type' => 'security', 'url' => '', 'object' => '*');
     $watches['user_joins_group'] = array('label' => tra('User joins a group'), 'type' => 'users', 'url' => '', 'object' => '*');
     foreach ($watches as $key => $watch) {
         if (array_key_exists('available', $watch) && !$watch['available']) {
             unset($watches[$key]);
         } else {
             $watches[$key]['object'] = '*';
             unset($watches['available']);
             if ($checkPermission && array_key_exists('permission', $watch) && !$watch['permission']) {
                 unset($watches[$key]);
             }
         }
     }
     return $watches;
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:37,代码来源:notificationlib.php

示例4: smarty_function_show_sort

function smarty_function_show_sort($params, $smarty)
{
    global $url_path;
    if (isset($_REQUEST[$params['sort']])) {
        $p = $_REQUEST[$params['sort']];
    } elseif ($s = $smarty->getTemplateVars($params['sort'])) {
        $p = $s;
    }
    if (isset($params['sort']) and isset($params['var']) and isset($p)) {
        $prop = substr($p, 0, strrpos($p, '_'));
        $order = substr($p, strrpos($p, '_') + 1);
        if (strtolower($prop) == strtolower(trim($params['var']))) {
            $smarty->loadPlugin('smarty_function_icon');
            $icon_params = array('alt' => tra('Invert Sort'), 'style' => 'vertical-align:middle');
            switch ($order) {
                case 'asc':
                case 'nasc':
                    $icon_params['_id'] = 'resultset_up';
                    return smarty_function_icon($icon_params, $smarty);
                    break;
                case 'desc':
                case 'ndesc':
                    $icon_params['_id'] = 'resultset_down';
                    return smarty_function_icon($icon_params, $smarty);
                    break;
            }
        }
    }
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:29,代码来源:function.show_sort.php

示例5: scrambleEmail

function scrambleEmail($email, $method='unicode')
{
	switch ($method) {
	case 'strtr':
		$trans = array(	"@" => tra("(AT)"),
						"." => tra("(DOT)")
		);
		return strtr($email, $trans);
	case 'x' :
		$encoded = $email;
		for ($i = strpos($email, "@") + 1, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) {
			if ($encoded[$i]  != ".") $encoded[$i] = 'x';
		}
		return $encoded;
	case 'unicode':
	case 'y':// for previous compatibility
		$encoded = '';
		for ($i = 0, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) {
			$encoded .= '&#' . ord($email[$i]). ';';
		}
		return $encoded;
	case 'n':
	default:
		return $email;
	}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:26,代码来源:scrambleEmail.php

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

示例7: getDirContent

function getDirContent($sub) 
{
	global $allowed_types;
	global $a_img;
	global $a_path;
	global $imgdir, $smarty;
	$allimg = array();
	$tmp = $imgdir;
	if ($sub <> "") $tmp.= '/' . $sub;
	if (!@($dimg = opendir($tmp))) {
		$msg = tra("Invalid directory name");
		$smarty->assign('msg', $msg);
		$smarty->display("error.tpl");
		die;
	}
	while ((false !== ($imgf = readdir($dimg)))) {
		if ($imgf != "." && $imgf != ".." && substr($imgf, 0, 1) != ".") {
			$allimg[] = $imgf;
		}
	}
	sort($allimg);
	foreach ($allimg as $imgfile) {
		if (is_dir($tmp . "/" . $imgfile)) {
			if ((substr($sub, -1) <> "/") && (substr($sub, -1) <> "\\")) {
				$sub.= '/';
			}
			getDirContent($sub . $imgfile);
		} elseif (in_array(strtolower(substr($imgfile, -(strlen($imgfile) - strrpos($imgfile, ".")))), $allowed_types)) {
			$a_img[] = $imgfile;
			$a_path[] = $sub;
		}
	}
	closedir($dimg);
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:34,代码来源:tiki-batch_upload.php

示例8: wikiplugin_showpages

function wikiplugin_showpages($data, $params)
{
    global $tikilib, $prefs;
    extract($params, EXTR_SKIP);
    if (!isset($find)) {
        return "<b>missing find parameter for plugin SHOWPAGES</b><br />";
    }
    if (!isset($max)) {
        $max = -1;
    }
    if (!isset($display) || strpos($display, 'name') === false && strpos($display, 'desc') === false) {
        $display = 'name|desc';
    }
    $data = $tikilib->list_pages(0, $max, 'pageName_asc', $find);
    $text = '';
    foreach ($data["data"] as $page) {
        if (isset($prefs['feature_wiki_description']) && $prefs['feature_wiki_description'] == 'y' && strpos($display, 'desc') !== false) {
            $desc = $tikilib->page_exists_desc($page["pageName"]);
        } else {
            $desc = '';
        }
        $text .= "<a href=\"tiki-index.php?page=" . $page["pageName"] . "\" title=\"" . tra("Last modified by") . " " . $page["user"] . "\" class=\"wiki\">";
        $text .= strpos($display, 'name') !== false || strlen($desc) == 0 ? $page["pageName"] : $desc;
        $text .= "</a>";
        $text .= strpos($display, 'name') !== false && $desc !== $page["pageName"] && strlen($desc) > 0 ? " - {$desc}" : "";
        $text .= "<br />";
    }
    return $text;
}
开发者ID:rodin,项目名称:mcskb,代码行数:29,代码来源:wikiplugin_showpages.php

示例9: wikiplugin_jq_info

function wikiplugin_jq_info()
{
	return array(
		'name' => tra('jQuery'),
		'documentation' => 'PluginJQ',
		'description' => tra('Add JavaScript code'),
		'prefs' => array( 'wikiplugin_jq' ),
		'body' => tra('JavaScript code'),
		'validate' => 'all',
		'filter' => 'none',
		'icon' => 'img/icons/script_code_red.png',
		'params' => array(
			'notonready' => array(
				'required' => false,
				'name' => tra('Not On Ready'),
				'description' => tra('Do not execute on document ready (execute inline)'),
			),
			'nojquery' => array(
				'required' => false,
				'name' => tra('No JavaScript'),
				'description' => tra('Optional markup for when JavaScript is off'),
			)
		)
	);
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:25,代码来源:wikiplugin_jq.php

示例10: verifySecurity

 function verifySecurity(&$pParamHash)
 {
     if ($pParamHash['security_id'] != 'public' && !empty($pParamHash['access_level'])) {
         // if we have an access level, we know we are trying to save/update,
         // else perhaps we are just assigning security_id to content_id
         if (empty($pParamHash['security_description']) && (empty($pParamHash['security_id']) || $pParamHash['security_id'] == 'new')) {
             // default name to security access level instead of throwing an error
             $pParamHash['security_store']['security_description'] = $pParamHash['access_level'];
         } elseif (!empty($pParamHash['security_description'])) {
             // we need to load the existing security_id to verify we user owns the security_id & if anything has changed
             $pParamHash['security_store']['security_description'] = substr($pParamHash['security_description'], 0, 160);
         }
         if (!empty($pParamHash['access_level'])) {
             $pParamHash['security_store']['is_hidden'] = $pParamHash['access_level'] == 'hidden' ? 'y' : NULL;
             $pParamHash['security_store']['is_private'] = $pParamHash['access_level'] == 'private' ? 'y' : NULL;
             // If we have an answer, store the question.
             if ($pParamHash['access_level'] == 'protected' && empty($pParamHash['access_answer'])) {
                 $this->mErrors['security'] = tra("You must enter an answer for your security question.");
             } else {
                 $pParamHash['security_store']['access_question'] = !empty($pParamHash['access_answer']) ? $pParamHash['access_question'] : NULL;
                 $pParamHash['security_store']['access_answer'] = !empty($pParamHash['access_answer']) ? trim($pParamHash['access_answer']) : NULL;
             }
             //				$pParamHash['security_store']['group_id'] = !empty( $pParamHash['access_group_id'] ) ? $pParamHash['access_group_id'] : NULL;
         }
     }
     return count($this->mErrors) == 0;
 }
开发者ID:bitweaver,项目名称:gatekeeper,代码行数:27,代码来源:LibertyGatekeeper.php

示例11: module_since_last_visit

/**
 * @param $mod_reference
 * @param null $params
 */
function module_since_last_visit($mod_reference, $params = null)
{
    global $user, $tikilib, $smarty;
    $nvi_info = $tikilib->get_news_from_last_visit($user);
    $smarty->assign('nvi_info', $nvi_info);
    $smarty->assign('tpl_module_title', tra('Since your last visit'));
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:11,代码来源:mod-func-since_last_visit.php

示例12: galaxia_execute_activity

 function galaxia_execute_activity($activityId = 0, $iid = 0, $auto = 1)
 {
     // Now execute the code for the activity but we are in a method!
     // so just use an fopen with http mode
     global $tikilib;
     $parsed = parse_url($_SERVER["REQUEST_URI"]);
     $URI = $tikilib->httpPrefix() . $parsed["path"];
     $parts = explode('/', $URI);
     $parts[count($parts) - 1] = "tiki-g-run_activity.php?activityId={$activityId}&iid={$iid}&auto={$auto}";
     $URI = implode('/', $parts);
     $fp = fopen($URI, "r");
     $data = '';
     if (!$fp) {
         trigger_error(tra("Fatal error: cannot execute automatic activity {$activityId}"), E_USER_WARNING);
         die;
     }
     while (!feof($fp)) {
         $data .= fread($fp, 8192);
     }
     /*
     if(!empty($data)) {
     	trigger_error(tra("Fatal error: automatic activity produced some output:$data"), E_USER_WARNING);
     }
     */
     fclose($fp);
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:26,代码来源:config.php

示例13: smarty_function_error_report

function smarty_function_error_report($params, $smarty)
{
    $errorreportlib = TikiLib::lib('errorreport');
    $errors = $errorreportlib->get_errors();
    $pre = '<div id="error_report">';
    $post = '</div>';
    TikiLib::lib('header')->add_js('
	$("#error_report").ajaxComplete(function (e, jqxhr) {
		var error = jqxhr.getResponseHeader("X-Tiki-Error");
		if (error) {
			if ($("ul", this).length === 0) {
				$(this).append($(error)[0].childNodes);
			} else {
				$("ul", this).append($(error).find("li"));
			}
		}
	});
	$("#error_report .clear").live("click", function () {
		$("#error_report").empty();
		return false;
	});
	');
    if (count($errors)) {
        $smarty->loadPlugin('smarty_block_remarksbox');
        $repeat = false;
        return $pre . smarty_block_remarksbox(array('type' => 'errors', 'title' => tra('Error(s)')), '<a class="clear" style="float: right;" href="#">' . tr('Clear errors') . '</a><ul><li>' . implode('</li><li>', $errors) . '</li></ul>', $smarty, $repeat) . $post;
    } else {
        return $pre . $post;
    }
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:30,代码来源:function.error_report.php

示例14: gatherVoteData

 private function gatherVoteData()
 {
     global $user;
     $field = $this->getBaseFieldData();
     $trackerId = $this->getConfiguration('trackerId');
     $itemId = $this->getItemId();
     $votings = TikiDb::get()->table('tiki_user_votings');
     if ($field['type'] == 's' && $field['name'] == tra('Rating')) {
         // global rating to an item - value is the sum of the votes
         $key = 'tracker.' . $trackerId . '.' . $itemId;
     } elseif ($field['type'] == '*' || $field['type'] == 'STARS') {
         // field rating - value is the average of the votes
         $key = "tracker.{$trackerId}.{$itemId}." . $field['fieldId'];
     }
     $data = $votings->fetchRow(array('count' => $votings->count(), 'total' => $votings->sum('optionId')), array('id' => $key));
     $field['numvotes'] = $data['count'];
     $field['total'] = $data['total'];
     if ($field['numvotes']) {
         $field['voteavg'] = round($field['total'] / $field['numvotes'], 2);
     } else {
         $field['voteavg'] = 0;
     }
     // be careful optionId is the value - not the optionId
     $field['my_rate'] = $votings->fetchOne('optionId', array('id' => $key, 'user' => $user));
     return $field;
 }
开发者ID:hurcane,项目名称:tiki-azure,代码行数:26,代码来源:Rating.php

示例15: wikiplugin_map_info

function wikiplugin_map_info()
{
    return array('name' => tra('Map'), 'format' => 'html', 'documentation' => 'PluginMap', 'description' => tra('Display a map'), 'prefs' => array('wikiplugin_map', 'feature_search'), 'iconname' => 'map', 'introduced' => 1, 'tags' => array('basic'), 'filter' => 'wikicontent', 'body' => tr('Instructions to load content'), 'params' => array('scope' => array('required' => false, 'name' => tra('Scope'), 'description' => tr('Display the geolocated items represented in the page (%0all%1, %0center%1, or
					%0custom%1 as a CSS selector). Default: %0center%1', '<code>', '</code>'), 'since' => '8.0', 'filter' => 'text', 'default' => 'center'), 'controls' => array('required' => false, 'name' => tra('Controls'), 'description' => tr('Comma-separated list of map controls will be displayed on the map and around it'), 'since' => '9.0', 'filter' => 'word', 'accepted' => 'controls, layers, search_location, levels, current_location, scale, streetview,
					navigation, coordinates, overview', 'separator' => ',', 'default' => wp_map_default_controls()), 'width' => array('required' => false, 'name' => tra('Width'), 'description' => tra('Width of the map in pixels'), 'since' => '1', 'filter' => 'digits'), 'height' => array('required' => false, 'name' => tra('Height'), 'description' => tra('Height of the map in pixels'), 'since' => '1', 'filter' => 'digits'), 'center' => array('requied' => false, 'name' => tra('Center'), 'description' => tr('Format: %0x,y,zoom%1 where %0x%1 is the longitude, and %0y%1 is the latitude.
					%0zoom%1 is between %00%1 (view Earth) and %019%1.', '<code>', '</code>'), 'since' => '9.0', 'filter' => 'text'), 'popupstyle' => array('required' => false, 'name' => tr('Popup Style'), 'description' => tr('Alter the way the information is displayed when objects are loaded on the map.'), 'since' => '10.0', 'filter' => 'word', 'default' => 'bubble', 'options' => array(array('text' => '', 'value' => ''), array('text' => tr('Bubble'), 'value' => 'bubble'), array('text' => tr('Dialog'), 'value' => 'dialog'))), 'mapfile' => array('required' => false, 'name' => tra('MapServer File'), 'description' => tra('MapServer file identifier. Only fill this in if you are using MapServer.'), 'since' => '1', 'filter' => 'url', 'advanced' => true), 'extents' => array('required' => false, 'name' => tra('Extents'), 'description' => tra('Extents'), 'since' => '1', 'filter' => 'text', 'advanced' => true), 'size' => array('required' => false, 'name' => tra('Size'), 'description' => tra('Size of the map'), 'since' => '1', 'filter' => 'digits', 'advanced' => true), 'tooltips' => array('required' => false, 'name' => tra('Tooltips'), 'description' => tra('Show item name in a tooltip on hover'), 'since' => '12.1', 'default' => 'n', 'filter' => 'alpha', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n')), 'advanced' => true)));
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:7,代码来源:wikiplugin_map.php


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