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


PHP RSMembershipHelper::isCode方法代码示例

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


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

示例1: getFieldsValidation

 public static function getFieldsValidation($membership_id = null, $upgrade = null)
 {
     $return = array();
     if (is_null($upgrade)) {
         $fields = RSMembership::getCustomFields(array('published' => 1, 'required' => 1));
     } else {
         $fields = array();
     }
     if (!is_null($membership_id)) {
         $membership_fields = RSMembership::getCustomMembershipFields($membership_id, array('published' => 1, 'required' => 1));
         $fields = array_merge($fields, $membership_fields);
     }
     foreach ($fields as $field) {
         $js = '';
         switch ($field->type) {
             case 'select':
             case 'multipleselect':
             case 'textarea':
             case 'textbox':
             case 'calendar':
                 $element = 'rsm_' . $field->name;
                 $js .= "if (document.getElementById('" . $element . "').value.length == 0)" . "\n";
                 break;
             case 'checkbox':
             case 'radio':
                 $field->values = RSMembershipHelper::isCode($field->values);
                 $field->values = str_replace("\r\n", "\n", $field->values);
                 $field->values = explode("\n", $field->values);
                 $ids = array();
                 foreach ($field->values as $i => $value) {
                     $element = 'rsm_field_' . $field->id . '_' . $i;
                     $ids[] = "!document.getElementById('" . $element . "').checked";
                 }
                 $element = '';
                 $js .= "if (" . implode(" && ", $ids) . ")" . "\n";
                 break;
         }
         $validation_message = JText::_($field->validation);
         if (empty($validation_message)) {
             $validation_message = JText::sprintf('COM_RSMEMBERSHIP_VALIDATION_DEFAULT_ERROR', JText::_($field->label));
         }
         $validation_message = str_replace(array("\r\n", "\r"), "\n", $validation_message);
         $validation_message = str_replace("\n", '\\n', $validation_message);
         $js .= "{\n";
         $js .= "msg.push('" . JText::_($validation_message, true) . "');" . "\n";
         if (@$element) {
             $js .= "document.getElementById('" . $element . "').className += ' rsm_field_error';\n";
         }
         $js .= "}\n";
         $return[] = $js;
     }
     return $return;
 }
开发者ID:JozefAB,项目名称:qk,代码行数:53,代码来源:helper.php

示例2: getFieldsValidation

 function getFieldsValidation()
 {
     $return = array();
     $db = JFactory::getDBO();
     $db->setQuery("SELECT * FROM #__rsmembership_fields WHERE published='1' AND required = '1' ORDER BY ordering");
     $fields = $db->loadObjectList();
     foreach ($fields as $field) {
         $js = '';
         switch ($field->type) {
             case 'select':
             case 'multipleselect':
             case 'textarea':
             case 'textbox':
             case 'calendar':
                 $element = 'rsm_' . $field->name;
                 $js .= "if (document.getElementById('" . $element . "').value.length == 0)" . "\n";
                 break;
             case 'checkbox':
             case 'radio':
                 $field->values = RSMembershipHelper::isCode($field->values);
                 $field->values = str_replace("\r\n", "\n", $field->values);
                 $field->values = explode("\n", $field->values);
                 $ids = array();
                 foreach ($field->values as $i => $value) {
                     $element = 'rsm_field_' . $field->id . '_' . $i;
                     $ids[] = "!document.getElementById('" . $element . "').checked";
                 }
                 $element = '';
                 $js .= "if (" . implode(" && ", $ids) . ")" . "\n";
                 break;
         }
         $validation_message = JText::_($field->validation);
         if (empty($validation_message)) {
             $validation_message = JText::sprintf('RSM_VALIDATION_DEFAULT_ERROR', JText::_($field->label));
         }
         $validation_message = str_replace(array("\r\n", "\r"), "\n", $validation_message);
         $validation_message = str_replace("\n", '\\n', $validation_message);
         $js .= "{\n";
         $js .= "msg.push('" . JText::_($validation_message, true) . "');" . "\n";
         if (@$element) {
             $js .= "document.getElementById('" . $element . "').className += ' rsm_field_error';\n";
         }
         $js .= "}\n";
         $return[] = $js;
     }
     return $return;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:47,代码来源:rsmembership.php


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