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


PHP RSMembershipHelper::addClass方法代码示例

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


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

示例1: showCustomField

 public static function showCustomField($field, $selected = array(), $editable = true, $show_required = true, $type = 'user')
 {
     if (empty($field) || empty($field->type)) {
         return false;
     }
     $name_field = $type == 'user' ? 'rsm_fields' : 'rsm_membership_fields';
     $return = array();
     $return[0] = '<label title="' . JText::_($field->label) . '" class="fs-field-label fs-anim-upper hasTip" for="rsm_' . $field->name . '" id="jform_' . $field->name . '-lbl">' . JText::_($field->label) . '</label>';
     $return[1] = '';
     switch ($field->type) {
         case 'hidden':
             $name = $name_field . '[' . $field->name . ']';
             $app = JFactory::getApplication();
             if ($app->isAdmin() && isset($selected[$field->name])) {
                 $field->values = $selected[$field->name];
             } else {
                 $field->values = RSMembershipHelper::isCode($field->values);
             }
             $return[1] = '<input type="hidden" name="' . $name . '" id="rsm_' . $field->name . '" value="' . htmlspecialchars($field->values, ENT_COMPAT, 'utf-8') . '" />';
             if ($editable && $app->isAdmin()) {
                 $return[1] = '<input type="text" class="rsm_textbox" name="' . $name . '" id="rsm_' . $field->name . '" value="' . htmlspecialchars($field->values, ENT_COMPAT, 'utf-8') . '" size="40" />';
             } else {
                 if (!$editable && $app->isAdmin()) {
                     $return[1] = htmlspecialchars($field->values, ENT_COMPAT, 'utf-8');
                 }
             }
             if (!$app->isAdmin()) {
                 $return[2] = 'hidden';
             }
             break;
         case 'freetext':
             $field->values = RSMembershipHelper::isCode($field->values);
             $return[1] = $field->values;
             break;
         case 'textbox':
             if (isset($selected[$field->name])) {
                 $field->values = $selected[$field->name];
             } else {
                 $field->values = RSMembershipHelper::isCode($field->values);
             }
             $name = $name_field . '[' . $field->name . ']';
             /*$return[1] = '<input type="text" name="'.$name.'" id="rsm_'.$field->name.'" value="'.htmlspecialchars($field->values, ENT_COMPAT, 'utf-8').'" size="40" '.RSMembershipHelper::addClass($field->additional, 'rsm_textbox').' />';*/
             $return[1] = '<input type="text" name="' . $name . '" class="fs-anim-lower" id="rsm_' . $field->name . '" value="' . htmlspecialchars($field->values, ENT_COMPAT, 'utf-8') . '" size="40" required />';
             if (!$editable) {
                 $return[1] = htmlspecialchars($field->values, ENT_COMPAT, 'utf-8');
             }
             break;
         case 'textarea':
             if (isset($selected[$field->name])) {
                 $field->values = $selected[$field->name];
             } else {
                 $field->values = RSMembershipHelper::isCode($field->values);
             }
             $name = $name_field . '[' . $field->name . ']';
             $return[1] = '<textarea name="' . $name . '" id="rsm_' . $field->name . '" ' . RSMembershipHelper::addClass($field->additional, 'textarea rsm_textarea') . '>' . htmlspecialchars($field->values, ENT_COMPAT, 'utf-8') . '</textarea>';
             if (!$editable) {
                 $return[1] = nl2br(htmlspecialchars($field->values, ENT_COMPAT, 'utf-8'));
             }
             break;
         case 'select':
         case 'multipleselect':
             $field->values = RSMembershipHelper::isCode($field->values);
             $field->values = str_replace("\r\n", "\n", $field->values);
             $field->values = explode("\n", $field->values);
             $multiple = $field->type == 'multipleselect' ? 'multiple="multiple"' : '';
             $name = $name_field . '[' . $field->name . '][]';
             if ($editable) {
                 $return[1] = '<select ' . $multiple . ' name="' . $name . '" id="rsm_' . $field->name . '" ' . RSMembershipHelper::addClass($field->additional, 'rsm_select') . '>';
                 foreach ($field->values as $value) {
                     $tmp = explode('|', $value, 2);
                     $label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
                     $val = $tmp[0];
                     $found_checked = false;
                     if (preg_match('/\\[c\\]/', $value)) {
                         $value = str_replace('[c]', '', $value);
                         $label = str_replace('[c]', '', $label);
                         $val = str_replace('[c]', '', $val);
                         $found_checked = true;
                     }
                     $checked = '';
                     if (isset($selected[$field->name]) && in_array($val, $selected[$field->name])) {
                         $checked = 'selected="selected"';
                     } elseif (!isset($selected[$field->name]) && $found_checked) {
                         $checked = 'selected="selected"';
                     }
                     $return[1] .= '<option ' . $checked . ' value="' . htmlspecialchars($val, ENT_COMPAT, 'utf-8') . '">' . htmlspecialchars($label, ENT_COMPAT, 'utf-8') . '</option>';
                 }
                 $return[1] .= '</select>';
             } else {
                 $return[1] = '';
                 if (isset($selected[$field->name])) {
                     foreach ($field->values as $value) {
                         $value = str_replace('[c]', '', $value);
                         $tmp = explode('|', $value, 2);
                         $label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
                         $val = $tmp[0];
                         if (is_array($selected[$field->name]) && in_array($val, $selected[$field->name]) || !is_array($selected[$field->name]) && $selected[$field->name] == $val) {
                             $return[1] .= htmlspecialchars($label, ENT_COMPAT, 'utf-8') . '<br />';
                         }
                     }
//.........这里部分代码省略.........
开发者ID:JozefAB,项目名称:qk,代码行数:101,代码来源:helper.php


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