• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP _fn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了_fn函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _event

/**
 * Creates a reference to the client-side event callback wrapper function. Used to trigger an event callback to the server from the client.
 * @return RaxanClientVariable
 */
function _event($type, $value = null, $target = 'page')
{
    // get value from first argument. If first argument is an event then pass event to trigger
    $code = 'var e,v=arguments[0],data=arguments[1]; if (v && v.stopPropagation) {e=v;v=null};';
    $code .= '$trigger("' . Raxan::escapeText($target) . '",' . ($type !== null ? '"' . Raxan::escapeText($type) . '"' : '""') . ',' . ($value !== null ? '"' . Raxan::escapeText($value) . '"' : 'v') . ',null,{event:e,data:data}' . ')';
    return _fn($code);
}
开发者ID:enriqueism,项目名称:raxan,代码行数:11,代码来源:raxan.webpage.php


示例2: smarty_modifier_dateformatHuman

/**
 * Smarty modifier to format datetimes in a more Human Readable form 
 * (like tomorow, 4 days from now, 6 hours ago)
 *
 * Example
 * <!--[$futuredate|dateformatHuman:'%x':'2']-->
 *
 * @author   Erik Spaan
 * @since    05/03/09
 * @param    string   $string   input datetime string
 * @param    string   $format   The format of the regular date output (default %x)
 * @param    string   $niceval  [1|2|3|4] Choose the nice value of the output (default 2)
 *                                    1 = full human readable
 *                                    2 = past date > 1 day with dateformat, otherwise human readable
 *                                    3 = within 1 day human readable, otherwise dateformat
 *                                    4 = only use the specified format
 * @return   string   the modified output
 */
function smarty_modifier_dateformatHuman($string, $format = '%x', $niceval = 2)
{
    $dom = ZLanguage::getModuleDomain('News');
    if (empty($format)) {
        $format = '%x';
    }
    // store the current datetime in a variable
    $now = DateUtil::getDatetime();
    if (empty($string)) {
        return DateUtil::formatDatetime($now, $format);
    }
    if (empty($niceval)) {
        $niceval = 2;
    }
    // now format the date with respect to the current datetime
    $res = '';
    $diff = DateUtil::getDatetimeDiff($now, $string);
    if ($diff['d'] < 0) {
        if ($niceval == 1) {
            $res = _fn('%s day ago', '%s days ago', abs($diff['d']), abs($diff['d']), $dom);
        } elseif ($niceval < 4 && $diff['d'] == -1) {
            $res = __('yesterday', $dom);
        } else {
            $res = DateUtil::formatDatetime($string, $format);
        }
    } elseif ($diff['d'] > 0) {
        if ($niceval > 2) {
            $res = DateUtil::formatDatetime($string, $format);
        } elseif ($diff['d'] == 1) {
            $res = __('tomorrow', $dom);
        } else {
            $res = _fn('%s day from now', '%s days from now', $diff['d'], $diff['d'], $dom);
        }
    } else {
        // no day difference
        if ($diff['h'] < 0) {
            $res = _fn('%s hour ago', '%s hours ago', abs($diff['h']), abs($diff['h']), $dom);
        } elseif ($diff['h'] > 0) {
            $res = _fn('%s hour from now', '%s hours from now', $diff['h'], $diff['h'], $dom);
        } else {
            // no hour difference
            if ($diff['m'] < 0) {
                $res = _fn('%s minute ago', '%s minutes ago', abs($diff['m']), abs($diff['m']), $dom);
            } elseif ($diff['m'] > 0) {
                $res = _fn('%s minute from now', '%s minutes from now', $diff['m'], $diff['m'], $dom);
            } else {
                // no min difference
                if ($diff['s'] < 0) {
                    $res = _fn('%s second ago', '%s seconds ago', abs($diff['s']), abs($diff['s']), $dom);
                } else {
                    $res = _fn('%s second from now', '%s seconds from now', $diff['s'], $diff['s'], $dom);
                }
            }
        }
    }
    return $res;
}
开发者ID:aksiide,项目名称:SuperPlugin-generator,代码行数:75,代码来源:modifier.dateformatHuman.php


示例3: smarty_function_gt

/**
 * Copyright Zikula Foundation 2009 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
function smarty_function_gt($params, &$smarty)
{
    if (isset($params['domain'])) {
        $domain = $params['domain'] == strtolower('zikula') ? null : $params['domain'];
    } else {
        $domain = null;
        // default domain
    }
    if (!isset($params['text'])) {
        $smarty->trigger_error(__("Error! Gettext 'gt' requires an attribute text."));
        return false;
    }
    $text = $params['text'];
    // validate plural settings if applicable
    if (!isset($params['count']) && isset($params['plural']) || isset($params['count']) && !isset($params['plural'])) {
        $smarty->trigger_error(__('Error! If you use a plural or count in gettext, you must use both parameters together.'));
        return false;
    }
    $count = isset($params['count']) ? (int) $params['count'] : 0;
    $plural = isset($params['plural']) ? $params['plural'] : false;
    // build array for tags (for %s, %1$s etc) if applicable
    ksort($params);
    $tags = array();
    foreach ($params as $key => $value) {
        if (preg_match('#^tag([0-9]{1,2})$#', $key)) {
            $tags[] = $value;
        }
    }
    $tags = count($tags) == 0 ? null : $tags;
    // perform gettext
    if ($plural) {
        $result = isset($tags) ? _fn($text, $plural, $count, $tags, $domain) : _n($text, $plural, $count, $domain);
    } else {
        $result = isset($tags) ? __f($text, $tags, $domain) : __($text, $domain);
    }
    // assign or return
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    } else {
        return $result;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:54,代码来源:function.gt.php


示例4: _fn

 /**
  * Translate plural string with sprintf().
  *
  * @param string       $sin    Singular instance.
  * @param string       $plu    Plural instance.
  * @param string       $n      Object count.
  * @param string|array $params Sprintf() arguments.
  *
  * @return string
  */
 public function _fn($sin, $plu, $n, $params)
 {
     return _fn($sin, $plu, $n, $params, $this->domain);
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:14,代码来源:AbstractHelper.php


示例5: _fn

 /**
  * Format pural translations for modules.
  *
  * @param string       $m1    Singular.
  * @param string       $m2    Plural.
  * @param integer      $n     Count.
  * @param string|array $param Format parameters.
  *
  * @return string
  */
 public function _fn($m1, $m2, $n, $param)
 {
     return _fn($m1, $m2, $n, $param, $this->domain);
 }
开发者ID:rmaiwald,项目名称:core,代码行数:14,代码来源:ZL10n.php


示例6: sendmail

 /**
  * Send an e-mail message to one or more users.
  *
  * Parameters passed in the $args array:
  * -------------------------------------
  * numeric|array $args['uid']                         A single (numeric integer) uid or an array of uids to which the e-mail should be sent.
  * array         $args['sendmail']                    An array containing the information necessary to send an e-mail.
  * string        $args['sendmail']['from']            The name of the e-mail message's sender.
  * string        $args['sendmail']['rpemail']         The e-mail address of the e-mail message's sender.
  * string        $args['sendmail']['subject']         The e-mail message's subject.
  * string        $args['sendmail']['message']         The e-mail message's body (the message itself).
  * array         $args['sendmail']['recipientsname']  An array indexed by uid of each recipient's name.
  * array         $args['sendmail']['recipientsemail'] An array indexed by uid of each recipient's e-mail address.
  *
  * @param array $args All arguments passed to this function.
  *
  * @return bool True on success; otherwise false
  *
  * @throws \Zikula\Framework\Exception\ForbiddenException Thrown if the current user does not have sufficient access to send mail.
  */
 public function sendmail($args)
 {
     if (!SecurityUtil::checkPermission("{$this->name}::MailUsers", '::', ACCESS_COMMENT)) {
         throw new \Zikula\Framework\Exception\ForbiddenException();
     }
     if (isset($args['uid']) && !empty($args['uid'])) {
         if (is_array($args['uid'])) {
             $recipientUidList = $args['uid'];
         } else {
             $recipientUidList = array($args['uid']);
         }
     } else {
         $this->registerError(__('Error! No users selected to receive e-mail, or invalid uid list.'));
         return false;
     }
     if (isset($args['sendmail']) && !empty($args['sendmail']) && is_array($args['sendmail'])) {
         $sendmail = $args['sendmail'];
     } else {
         $this->registerError(__('Error! E-mail message to be sent not specified or invalid.'));
         return false;
     }
     $missingFields = array();
     if (empty($sendmail['from'])) {
         $missingFields[] = 'from';
     }
     if (empty($sendmail['rpemail'])) {
         $missingFields[] = 'reply-to e-mail address';
     }
     if (empty($sendmail['subject'])) {
         $missingFields[] = 'subject';
     }
     if (empty($sendmail['message'])) {
         $missingFields[] = 'message';
     }
     if (!empty($missingFields)) {
         $count = count($missingFields);
         $msg = _fn('Error! The required field \'%2$s\' was blank or missing', 'Error! %1$d required fields were blank or missing: \'%2$s\'.', $count, array($count, implode("', '", $missingFields)));
         $this->registerError($msg);
         return false;
     }
     unset($missingFields);
     $bcclist = array();
     $recipientlist = array();
     $recipientscount = 0;
     foreach ($sendmail['recipientsemail'] as $uid => $recipient) {
         if (in_array($uid, $recipientUidList)) {
             $bcclist[] = array('name' => $sendmail['recipientsname'][$uid], 'address' => $recipient);
             $recipientlist[] = $recipient;
         }
         if (count($bcclist) == $sendmail['batchsize']) {
             if (ModUtil::apiFunc('MailerModule', 'user', 'sendmessage', array('fromname' => $sendmail['from'], 'fromaddress' => $sendmail['rpemail'], 'toname' => UserUtil::getVar('uname'), 'toaddress' => UserUtil::getVar('email'), 'replytoname' => UserUtil::getVar('uname'), 'replytoaddress' => $sendmail['rpemail'], 'subject' => $sendmail['subject'], 'body' => $sendmail['message'], 'bcc' => $bcclist)) == true) {
                 $recipientscount += count($bcclist);
                 $bcclist = array();
             } else {
                 $this->registerError($this->__('Error! Could not send the e-mail message.'));
                 return false;
             }
         }
     }
     if (count($bcclist) != 0) {
         $sendMessageArgs = array('fromname' => $sendmail['from'], 'fromaddress' => $sendmail['rpemail'], 'toname' => UserUtil::getVar('uname'), 'toaddress' => UserUtil::getVar('email'), 'replytoname' => UserUtil::getVar('uname'), 'replytoaddress' => $sendmail['rpemail'], 'subject' => $sendmail['subject'], 'body' => $sendmail['message'], 'bcc' => $bcclist);
         if (ModUtil::apiFunc('MailerModule', 'user', 'sendMessage', $sendMessageArgs)) {
             $recipientscount += count($bcclist);
         } else {
             $this->registerError($this->__('Error! Could not send the e-mail message.'));
             return false;
         }
     }
     if ($recipientscount > 0) {
         $this->registerStatus($this->_fn('Done! E-mail message has been sent to %1$d user. ', 'Done! E-mail message has been sent to %1$d users. ', $recipientscount, array($recipientscount)));
     }
     return true;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:93,代码来源:AdminApi.php


示例7: getUtilityInputsTempdir

 public function getUtilityInputsTempdir()
 {
     if ($this->tempdirexists == false) {
         $form = __('Your temporary directory does not seem to exist. It will be built from scratch') . "\n";
     } else {
         $form = __('Your temporary directory seems to exist. The status of the subdirectories is as follows:') . "\n";
         $form .= "<br /><br />\n";
         foreach ($this->tempdirsubs as $dir => $status) {
             if ($status == 1) {
                 $icon = 'button_ok.png';
             } else {
                 $icon = 'button_cancel.png';
             }
             $form .= '<img src="images/icons/extrasmall/' . $icon . '" alt="' . __('directory status') . '" /> ' . $dir . "\n";
             $form .= "<br />\n";
         }
         $form .= "<br />\n";
         $form .= _fn('%s directory was not found. Please use the utility to create the deleted directory', '%s directories were not found. Please use the utility to create the deleted directories', $this->tempdirsubsfailed, $this->tempdirsubsfailed);
     }
     $form .= "<br /><br />\n";
     return $form;
 }
开发者ID:Silwereth,项目名称:core,代码行数:22,代码来源:zrc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP account_verify_password函数代码示例发布时间:2022-05-24
下一篇:
PHP Load函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap