本文整理汇总了PHP中JText::printf方法的典型用法代码示例。如果您正苦于以下问题:PHP JText::printf方法的具体用法?PHP JText::printf怎么用?PHP JText::printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JText
的用法示例。
在下文中一共展示了JText::printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($params = array())
{
// render widget
if ($widget_id = (int) $this->get('value', $this->config->get('default'))) {
// render output
$output = $this->widgetkit['widget']->render($widget_id);
return $output === false ? JText::printf("Could not load widget with the id %s.", $widget_id) : $output;
}
}
示例2: OfflajnMenuThemeCache
function OfflajnMenuThemeCache($namespace, &$_module, &$_params)
{
$this->cssCompress = 1;
$this->jsCompress = 1;
$this->js = array();
$this->css = array();
$this->module =& $_module;
$this->params =& $_params;
$this->env = array('params' => &$_params);
$writeError = false;
$folder = $this->module->id;
$registry = JFactory::getConfig();
if (version_compare(JVERSION, '3.0', 'ge')) {
$curLanguage = $registry->get("joomfish.language");
} else {
$curLanguage = $registry->getValue("joomfish.language");
}
if (is_object($curLanguage)) {
$folder .= '-lang' . $curLanguage->get('lang_id');
} else {
if (is_string($curLanguage) && $curLanguage != '') {
$folder .= '-lang' . $curLanguage;
}
}
$this->cachePath = JPath::clean(JPATH_SITE . DS . 'modules' . DS . $this->module->module . DS . 'cache' . DS . $folder . DS);
if (!JFolder::exists($this->cachePath)) {
JFolder::create($this->cachePath, 0777);
}
if (!JFolder::exists($this->cachePath)) {
$writeError = true;
}
if ($writeError) {
JText::printf("%s is unwriteable or non-existent, because the system does not allow the operation from PHP. Please create the directory and set the writing access!", $this->cachePath);
exit;
}
$this->cacheUrl = JURI::root(true) . '/modules/' . $this->module->module . '/cache/' . $folder . '/';
$this->moduleUrl = JURI::root(true) . '/modules/' . $this->module->module . '/';
}
示例3: _Move
protected function _Move($MessageID, $TargetCatID, $TargetSubject = '', $TargetMessageID = 0, $mode = KN_MOVE_MESSAGE, $GhostThread = false, $changesubject = false) {
// Private move function
// $mode
// KN_MOVE_MESSAGE ... move current message only
// KN_MOVE_THREAD ... move entire thread
// KN_MOVE_NEWER ... move current message and all newer in current thread
// KN_MOVE_REPLIES ... move current message and replies and quotes - 1 level deep
//
// if $TargetMessagID is a valid message ID, the messages will be appended to that thread
// Reset error message
$this->_ResetErrorMessage ();
// Sanitize parameters!
$MessageID = intval ( $MessageID );
$TargetCatID = intval ( $TargetCatID );
$TargetMessageID = intval ( $TargetMessageID );
$mode = intval ( $mode );
// no need to check $GhostThread as we only test for true
// Always check security clearance before taking action!
// Assumption: only moderators can move messages
// This test is made to prevent user to guess existing message ids
if ( !$this->_me->isModerator() ) {
$this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_NOT_MODERATOR');
return false;
}
$query = "SELECT m.id, m.catid, m.parent, m.name, m.userid, m.thread, m.subject , p.id AS poll
FROM #__kunena_messages AS m
LEFT JOIN #__kunena_polls AS p ON p.threadid=m.thread
WHERE m.id={$this->_db->Quote($MessageID)}";
$this->_db->setQuery ( $query );
$currentMessage = $this->_db->loadObject ();
if (KunenaError::checkDatabaseError()) return false;
// Check that message to be moved actually exists
if ( !is_object($currentMessage) ) {
$this->_errormsg = JText::sprintf('COM_KUNENA_MODERATION_ERROR_MESSAGE_NOT_FOUND', $MessageID);
return false;
}
if ($mode == KN_MOVE_THREAD && $currentMessage->parent != 0) {
// When moving a thread, message has to point into first message
$this->_errormsg = JText::sprintf('COM_KUNENA_MODERATION_ERROR_NOT_TOPIC', $currentMessage->id);
return false;
}
// Check that thread can't be move into a section
$category = KunenaForumCategoryHelper::get($TargetCatID);
if ( $category->isSection() ) {
$this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_NOT_MOVE_SECTION');
return false;
}
// Check that user has moderator permissions in source category
if ( !$this->_me->isModerator($currentMessage->catid) ) {
$this->_errormsg = JText::sprintf('COM_KUNENA_MODERATION_ERROR_NOT_MODERATOR_IN_CATEGORY', $currentMessage->id, $currentMessage->catid);
return false;
}
// Check that we have target category or message
if ($TargetCatID == 0 && $TargetMessageID == 0) {
$this->_errormsg = JText::printf('COM_KUNENA_MODERATION_ERROR_NO_TARGET', $currentMessage->id);
return false;
}
if ($TargetMessageID != 0) {
// Check that target message actually exists
$this->_db->setQuery ( "SELECT m.id, m.catid, m.parent, m.thread, m.subject, p.id AS poll FROM #__kunena_messages AS m LEFT JOIN #__kunena_polls AS p ON p.threadid=m.thread WHERE m.id={$this->_db->Quote($TargetMessageID)}" );
$targetMessage = $this->_db->loadObject ();
if (KunenaError::checkDatabaseError()) return false;
if ( !is_object( $targetMessage )) {
// Target message not found. Cannot proceed with move
$this->_errormsg = JText::sprintf('COM_KUNENA_MODERATION_ERROR_TARGET_MESSAGE_NOT_FOUND', $currentMessage->id, $TargetMessageID);
return false;
}
if ($targetMessage->thread == $currentMessage->thread) {
// Recursive self moves not supported
$this->_errormsg = JText::sprintf('COM_KUNENA_MODERATION_ERROR_SAME_TARGET_THREAD', $currentMessage->id, $currentMessage->thread);
return false;
}
// If $TargetMessageID has been specified and is valid,
// overwrite $TargetCatID with the category ID of the target message
$TargetCatID = $targetMessage->catid;
}
// Check that target category exists and is visible to our moderator
if (! in_array ( $TargetCatID, $this->_allowed ) ) {
//the user haven't moderator permissions in target category
$this->_errormsg = JText::sprintf('COM_KUNENA_MODERATION_ERROR_TARGET_CATEGORY_NOT_FOUND', $currentMessage->id, $TargetCatID);
return false;
}
// Special case if the first message is moved in case 2 or 3
//.........这里部分代码省略.........
示例4: printf
/**
* Helper wrapper method for printf
*
* @param format $string The format string.
*
* @return mixed
*
* @see JText::printf
* @since 3.4
*/
public function printf($string)
{
return JText::printf($string);
}
示例5:
}
?>
<?php
echo $created;
?>
</dd>
<?php
}
?>
<?php
if ($this->params->get('show_author') && $this->article->author != "") {
?>
<dd class="createdby">
<?php
$this->escape(JText::printf($this->escape($this->article->created_by_alias) ? $this->escape($this->article->created_by_alias) : $this->escape($this->article->author)));
?>
</dd>
<?php
}
?>
<?php
if ($this->params->get('show_hits')) {
?>
<dd class="hits">
<?php
echo JText::_('Hits');
?>
: <?php
echo $this->article->hits;
示例6: foreach
foreach ($upgradeRules as $rule) {
$upgradeOptionCount++;
?>
<li class="osm-upgrade-option">
<input type="radio" class="validate[required]" id="upgrade_option_id_<?php
echo $upgradeOptionCount;
?>
" name="upgrade_option_id" value="<?php
echo $rule->id;
?>
" />
<label for="upgrade_option_id_<?php
echo $upgradeOptionCount;
?>
"><?php
JText::printf('OSM_UPGRADE_OPTION_TEXT', $plans[$rule->from_plan_id]->title, $plans[$rule->to_plan_id]->title, OSMembershipHelper::formatCurrency($rule->price, $this->config));
?>
</label>
</li>
<?php
}
?>
</ul>
<div class="form-actions">
<input type="submit" class="btn btn-primary" value="<?php
echo JText::_('OSM_PROCESS_UPGRADE');
?>
"/>
</div>
<?php
示例7: move
/**
* Move topic or parts of it into another category or topic.
*
* @param object $target Target KunenaForumCategory or KunenaForumTopic
* @param mixed $ids false, array of message Ids or JDate
* @param bool $shadow Leave visible shadow topic.
* @param string $subject New subject
* @param bool $subjectall Change subject from every message
* @param int $topic_iconid Define a new topic icon
*
* @return bool|KunenaForumCategory|KunenaForumTopic Target KunenaForumCategory or KunenaForumTopic or false on failure
*/
public function move($target, $ids = false, $shadow = false, $subject = '', $subjectall = false, $topic_iconid = null)
{
// Warning: logic in this function is very complicated and even with full understanding its easy to miss some details!
// Clear authentication cache
$this->_authfcache = $this->_authccache = $this->_authcache = array();
// Cleanup input
if (!$ids instanceof JDate) {
if (!is_array($ids)) {
$ids = explode(',', (string) $ids);
}
$mesids = array();
foreach ($ids as $id) {
$mesids[(int) $id] = (int) $id;
}
unset($mesids[0]);
$ids = implode(',', $mesids);
}
$subject = (string) $subject;
// First we need to check if there will be messages left in the old topic
if ($ids) {
$query = new KunenaDatabaseQuery();
$query->select('COUNT(*)')->from('#__kunena_messages')->where("thread={$this->id}");
if ($ids instanceof JDate) {
// All older messages will remain (including unapproved, deleted)
$query->where("time<{$ids->toUnix()}");
} else {
// All messages that were not selected will remain
$query->where("id NOT IN ({$ids})");
}
$this->_db->setQuery($query);
$oldcount = (int) $this->_db->loadResult();
if ($this->_db->getErrorNum()) {
$this->setError($this->_db->getError());
return false;
}
// So are we moving the whole topic?
if (!$oldcount) {
$ids = '';
}
}
$categoryFrom = $this->getCategory();
// Find out where we are moving the messages
if (!$target || !$target->exists()) {
$this->setError(JText::printf('COM_KUNENA_MODERATION_ERROR_NO_TARGET', $this->id));
return false;
} elseif ($target instanceof KunenaForumTopic) {
// Move messages into another topic (original topic will always remain, either as real one or shadow)
if ($target == $this) {
// We cannot move topic into itself
$this->setError(JText::sprintf('COM_KUNENA_MODERATION_ERROR_SAME_TARGET_THREAD', $this->id, $this->id));
return false;
}
if ($this->moved_id) {
// Moved topic cannot be merged with another topic -- it has no posts to be moved
$this->setError(JText::sprintf('COM_KUNENA_MODERATION_ERROR_ALREADY_SHADOW', $this->id));
return false;
}
if ($this->poll_id && $target->poll_id) {
// We cannot currently have 2 polls in one topic -- fail
$this->setError(JText::_('COM_KUNENA_MODERATION_CANNOT_MOVE_TOPIC_WITH_POLL_INTO_ANOTHER_WITH_POLL'));
return false;
}
if ($subjectall) {
$subject = $target->subject;
}
} elseif ($target instanceof KunenaForumCategory) {
// Move messages into category
if ($target->isSection()) {
// Section cannot have any topics
$this->setError(JText::_('COM_KUNENA_MODERATION_ERROR_NOT_MOVE_SECTION'));
return false;
}
// Save category information for later use
$categoryTarget = $target;
if ($this->moved_id) {
// Move shadow topic and we are done
$this->category_id = $categoryTarget->id;
if ($subject) {
$this->subject = $subject;
}
$this->save(false);
return $target;
}
if ($shadow || $ids) {
// Create new topic for the moved messages
$target = clone $this;
$target->exists(false);
$target->id = 0;
//.........这里部分代码省略.........
示例8:
?>
<span class="createdate">
<?php
echo JHTML::_('date', $this->item->created, JText::_('DATE_FORMAT_LC2'));
?>
</span>
<?php
}
?>
<?php
if ($this->item->params->get('show_author') && $this->item->author != "") {
?>
<span class="createby">
<?php
JText::printf($this->item->created_by_alias ? $this->escape($this->item->created_by_alias) : $this->escape($this->item->author));
?>
</span>
<?php
}
?>
<?php
if ($this->item->params->get('show_section') && $this->item->sectionid || $this->item->params->get('show_category') && $this->item->catid) {
?>
<?php
if ($this->item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) {
?>
<span class="article-section">
<?php
if ($this->item->params->get('link_section')) {
示例9:
if ($item->show_readmore) {
echo JText::_('more');
}
echo "</div>";
}
if ($order[$j] == "d" && $item->show_date) {
echo "<div class=\"thumbsup-date" . $item->css . "\">" . JHTML::_('date', $item->created, $item->date_f) . "</div>";
}
if ($order[$j] == "a" && $item->show_author) {
echo "<div class=\"thumbsup-author" . $item->css . "\">";
JText::printf('Written by', $item->author);
echo "</div>";
}
if ($order[$j] == "h" && $item->show_hits) {
echo "<div class=\"thumbsup-hits" . $item->css . "\">";
JText::printf('Hits', $item->hits);
echo " " . $item->hits;
echo "</div>";
}
}
?>
</td>
<?php
if ($list[1]->disposition == "v" || !$list[1]->disposition) {
print "</tr>";
}
}
$i++;
}
if ($list[1]->disposition == "h") {
print "</tr>";
示例10: defined
* @email admin@vinaora.com
*
* @warning DON'T EDIT OR DELETE LINK HTTP://VINAORA.COM ON THE FOOTER OF MODULE. PLEASE CONTACT ME IF YOU WANT.
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
$vvisit_path = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_vvisit_counter" . DS . "helpers";
$vvisit_exists = file_exists($vvisit_path . DS . "vinaora_visitors_counter.php") && file_exists($vvisit_path . DS . "browsers.php") && file_exists($vvisit_path . DS . "datetime.php");
if ($vvisit_exists) {
require_once $vvisit_path . DS . "vinaora_visitors_counter.php";
require_once $vvisit_path . DS . "browsers.php";
require_once $vvisit_path . DS . "datetime.php";
} else {
echo $vvisit_path;
echo JText::printf("Please reinstall [Vinaora Visitors Counter] component");
return;
}
require_once dirname(__FILE__) . DS . 'helper.php';
/* ------------------------------------------------------------------------------------------------ */
// Read our Parameters
$mode = @$params->get('mode', 'full');
$today = @$params->get('today', 'Today');
$yesterday = @$params->get('yesterday', 'Yesterday');
$x_week = @$params->get('week', 'This week');
$l_week = @$params->get('lweek', 'Last week');
$x_month = @$params->get('month', 'This month');
$l_month = @$params->get('lmonth', 'Last month');
$all = @$params->get('all', 'All days');
$beginday = @$params->get('beginday', '');
$online = @$params->get('online', 'Online Now: ');
示例11:
?>
<span class="modified">
<?php
echo JText::sprintf('LAST_UPDATED2', JHTML::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC2')));
?>
</span>
<?php
}
?>
<?php
if ($this->item->params->get('show_author') && $this->item->author != "") {
?>
<span class="author">
<?php
JText::printf('Written by', $this->escape($this->item->created_by_alias) ? $this->escape($this->item->created_by_alias) : $this->escape($this->item->author));
?>
</span>
<?php
}
?>
<?php
if ($this->item->params->get('show_url') && $this->item->urls) {
?>
<span class="url">
<a href="http://<?php
echo $this->escape($this->item->urls);
?>
" target="_blank"><?php
echo $this->escape($this->item->urls);
示例12: checkin
/**
* Check in module
*
* @param: Int $moduleid index of module in database
*
*/
public static function checkin($moduleid)
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->update("#__modules");
$query->set("checked_out = '0'");
$query->set("checked_out_time = ''");
$query->where("id = " . $db->Quote($moduleid));
$db->setQuery($query);
if (!$db->query()) {
JText::printf('MSG_AJAX_ERROR', $db->getErrorMsg());
return false;
}
return true;
}
示例13: if
<div class="rt-articleinfo-text">
<?php /** Begin Created Date **/ if ($this->item->params->get('show_create_date')) : ?>
<span class="rt-date-posted">
<?php echo JHTML::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3')); ?>
</span>
<?php /** End Created Date **/ endif; ?>
<?php /** Begin Modified Date **/ if ( intval($this->item->modified) != 0 && $this->item->params->get('show_modify_date')) : ?>
<span class="rt-date-modified">
<?php echo JText::sprintf('LAST_UPDATED2', JHTML::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</span>
<?php /** End Modified Date **/ endif; ?>
<?php /** Begin Author **/ if (($this->item->params->get('show_author')) && ($this->item->author != "")) : ?>
<span class="rt-author">
<?php JText::printf(($this->escape($this->item->created_by_alias) ? $this->item->created_by_alias : $this->escape($this->item->author)) ); ?>
</span>
<?php /** End Author **/ endif; ?>
<?php /** Begin Url **/ if ($this->item->params->get('show_url') && $this->item->urls) : ?>
<span class="rt-url">
<a href="http://<?php echo $this->escape($this->item->urls) ; ?>" target="_blank"><?php echo $this->escape($this->item->urls); ?></a>
</span>
<?php /** End Url **/ endif; ?>
</div>
<?php /** Begin Article Icons **/ if ($canEdit || $this->item->params->get('show_pdf_icon') || $this->item->params->get('show_print_icon') || $this->item->params->get('show_email_icon')) : ?>
<div class="rt-article-icons">
<?php if ($this->item->params->get('show_pdf_icon')) :
echo RokIcon::pdf($this->item, $this->item->params, $this->access);
endif;
if ($this->item->params->get('show_print_icon')) :
示例14:
}
?>
</td>
</tr>
<?php
}
?>
<?php
if ($this->item->params->get('show_author') && $this->item->author != "") {
?>
<tr>
<td width="70%" valign="top" colspan="2">
<span class="small">
<?php
JText::printf('WRITTEN_BY', $this->escape($this->item->created_by_alias) ? $this->escape($this->item->created_by_alias) : $this->escape($this->item->author));
?>
</span>
</td>
</tr>
<?php
}
?>
<?php
if ($this->item->params->get('show_create_date')) {
?>
<tr>
<td valign="top" colspan="2" class="createdate">
<?php
示例15:
break;
}
?>
<li class="osm-renew-option">
<input type="radio" class="validate[required] inputbox" id="renew_option_id_<?php
echo $renewOptionCount;
?>
" name="renew_option_id" value="<?php
echo $planId;
?>
" />
<label for="renew_option_id_<?php
echo $renewOptionCount;
?>
"><?php
JText::printf('OSM_RENEW_OPTION_TEXT', $plan->title, $length . ' ' . $text, OSMembershipHelper::formatCurrency($plan->price, $this->config));
?>
</label>
</li>
<?php
}
}
?>
</ul>
<div class="form-actions">
<input type="submit" class="btn btn-primary" value="<?php
echo JText::_('OSM_PROCESS_RENEW');
?>
"/>
</div>