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


PHP CRM_Utils_Token::_requiredTokens方法代码示例

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


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

示例1: requiredTokens

 /**
  * Check a string (mailing body) for required tokens.
  *
  * @param string $str           The message
  *
  * @return true|array           true if all required tokens are found,
  *                              else an array of the missing tokens
  * @access public
  * @static
  */
 public static function requiredTokens(&$str)
 {
     if (self::$_requiredTokens == NULL) {
         self::$_requiredTokens = array('domain.address' => ts("Domain address - displays your organization's postal address."), 'action.optOutUrl or action.unsubscribeUrl' => array('action.optOut' => ts("'Opt out via email' - displays an email address for recipients to opt out of receiving emails from your organization."), 'action.optOutUrl' => ts("'Opt out via web page' - creates a link for recipients to click if they want to opt out of receiving emails from your organization. Alternatively, you can include the 'Opt out via email' token."), 'action.unsubscribe' => ts("'Unsubscribe via email' - displays an email address for recipients to unsubscribe from the specific mailing list used to send this message."), 'action.unsubscribeUrl' => ts("'Unsubscribe via web page' - creates a link for recipients to unsubscribe from the specific mailing list used to send this message. Alternatively, you can include the 'Unsubscribe via email' token or one of the Opt-out tokens.")));
     }
     $missing = array();
     foreach (self::$_requiredTokens as $token => $value) {
         if (!is_array($value)) {
             if (!preg_match('/(^|[^\\{])' . preg_quote('{' . $token . '}') . '/', $str)) {
                 $missing[$token] = $value;
             }
         } else {
             $present = FALSE;
             $desc = NULL;
             foreach ($value as $t => $d) {
                 $desc = $d;
                 if (preg_match('/(^|[^\\{])' . preg_quote('{' . $t . '}') . '/', $str)) {
                     $present = TRUE;
                 }
             }
             if (!$present) {
                 $missing[$token] = $desc;
             }
         }
     }
     if (empty($missing)) {
         return TRUE;
     }
     return $missing;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:40,代码来源:Token.php

示例2: getRequiredTokens

 /**
  * @return array
  */
 public static function getRequiredTokens()
 {
     if (self::$_requiredTokens == NULL) {
         self::$_requiredTokens = array('domain.address' => ts("Domain address - displays your organization's postal address."), 'action.optOutUrl or action.unsubscribeUrl' => array('action.optOut' => ts("'Opt out via email' - displays an email address for recipients to opt out of receiving emails from your organization."), 'action.optOutUrl' => ts("'Opt out via web page' - creates a link for recipients to click if they want to opt out of receiving emails from your organization. Alternatively, you can include the 'Opt out via email' token."), 'action.unsubscribe' => ts("'Unsubscribe via email' - displays an email address for recipients to unsubscribe from the specific mailing list used to send this message."), 'action.unsubscribeUrl' => ts("'Unsubscribe via web page' - creates a link for recipients to unsubscribe from the specific mailing list used to send this message. Alternatively, you can include the 'Unsubscribe via email' token or one of the Opt-out tokens.")));
     }
     return self::$_requiredTokens;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:10,代码来源:Token.php

示例3: requiredTokens

 /**
  * Check a string (mailing body) for required tokens.
  *
  * @param string $str           The message
  * @return true|array           true if all required tokens are found,
  *                              else an array of the missing tokens
  * @access public
  * @static
  */
 public static function requiredTokens(&$str)
 {
     if (self::$_requiredTokens == null) {
         self::$_requiredTokens = array('domain.address' => ts("Domain address - displays your organization's postal address."), 'action.optOutUrl' => array('action.optOut' => ts("'Opt out via email' - displays an email address for recipients to opt out of receiving emails from your organization."), 'action.optOutUrl' => ts("'Opt out via web page' - creates a link for recipients to click if they want to opt out of receiving emails from your organization. Alternatively, you can include the 'Opt out via email' token.")));
     }
     $missing = array();
     foreach (self::$_requiredTokens as $token => $value) {
         if (!is_array($value)) {
             if (!preg_match('/(^|[^\\{])' . preg_quote('{' . $token . '}') . '/', $str)) {
                 $missing[$token] = $value;
             }
         } else {
             $present = false;
             $desc = null;
             foreach ($value as $t => $d) {
                 $desc = $d;
                 if (preg_match('/(^|[^\\{])' . preg_quote('{' . $t . '}') . '/', $str)) {
                     $present = true;
                 }
             }
             if (!$present) {
                 $missing[$token] = $desc;
             }
         }
     }
     if (empty($missing)) {
         return true;
     }
     return $missing;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:39,代码来源:Token.php


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