本文整理汇总了PHP中RSFormProHelper::hasCode方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::hasCode方法的具体用法?PHP RSFormProHelper::hasCode怎么用?PHP RSFormProHelper::hasCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::hasCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showPreview
public static function showPreview($formId, $componentId, $data)
{
$mainframe = JFactory::getApplication();
$formId = (int) $formId;
$componentId = (int) $componentId;
// Legacy
$r = array();
$r['ComponentTypeName'] = $data['ComponentTypeName'];
$out = '';
//Trigger Event - rsfp_bk_onBeforeCreateComponentPreview
$mainframe->triggerEvent('rsfp_bk_onBeforeCreateComponentPreview', array(array('out' => &$out, 'formId' => $formId, 'componentId' => $componentId, 'ComponentTypeName' => $r['ComponentTypeName'], 'data' => $data)));
static $passedPageBreak;
$codeIcon = '';
switch ($r['ComponentTypeName']) {
case 'textBox':
$defaultValue = $data['DEFAULTVALUE'];
if (RSFormProHelper::hasCode($defaultValue)) {
$defaultValue = JText::_('RSFP_PHP_CODE_PLACEHOLDER');
$codeIcon = self::getIcon('php');
}
$out .= '<td>' . $data['CAPTION'] . '</td>' . '<td>' . $codeIcon . '<input type="text" value="' . RSFormProHelper::htmlEscape($defaultValue) . '" size="' . $data['SIZE'] . '" /></td>';
break;
case 'textArea':
$defaultValue = $data['DEFAULTVALUE'];
if (RSFormProHelper::hasCode($defaultValue)) {
$defaultValue = JText::_('RSFP_PHP_CODE_PLACEHOLDER');
$codeIcon = self::getIcon('php');
}
$out .= '<td>' . $data['CAPTION'] . '</td>' . '<td>' . $codeIcon . '<textarea cols="' . $data['COLS'] . '" rows="' . $data['ROWS'] . '">' . RSFormProHelper::htmlEscape($defaultValue) . '</textarea></td>';
break;
case 'selectList':
$out .= '<td>' . $data['CAPTION'] . '</td>';
$items = $data['ITEMS'];
if (RSFormProHelper::hasCode($items)) {
$items = JText::_('RSFP_PHP_CODE_PLACEHOLDER');
$codeIcon = self::getIcon('php');
}
$out .= '<td>' . $codeIcon . '<select ' . ($data['MULTIPLE'] == 'YES' ? 'multiple="multiple"' : '') . ' size="' . $data['SIZE'] . '">';
$items = str_replace(array("\r\n", "\r"), "\n", $items);
$items = explode("\n", $items);
$special = array('[c]', '[g]', '[d]');
foreach ($items as $item) {
$item = preg_replace('#\\[p(.*?)\\]#is', '', $item);
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
// <optgroup>
if (strpos($item, '[g]') !== false) {
$out .= '<optgroup label="' . RSFormProHelper::htmlEscape($val) . '">';
continue;
}
// </optgroup>
if (strpos($item, '[/g]') !== false) {
$out .= '</optgroup>';
continue;
}
$additional = '';
// selected
if (strpos($item, '[c]') !== false) {
$additional .= 'selected="selected"';
}
// disabled
if (strpos($item, '[d]') !== false) {
$additional .= 'disabled="disabled"';
}
$out .= '<option ' . $additional . ' value="' . RSFormProHelper::htmlEscape($val) . '">' . RSFormProHelper::htmlEscape($txt) . '</option>';
}
$out .= '</select></td>';
break;
case 'checkboxGroup':
$out .= '<td>' . $data['CAPTION'] . '</td>' . '<td>';
$items = $data['ITEMS'];
if (RSFormProHelper::hasCode($items)) {
$items = JText::_('RSFP_PHP_CODE_PLACEHOLDER');
$codeIcon = self::getIcon('php');
$out .= $codeIcon;
}
$items = str_replace(array("\r\n", "\r"), "\n", $items);
$items = explode("\n", $items);
$special = array('[c]', '[d]');
$i = 0;
foreach ($items as $item) {
$item = preg_replace('#\\[p(.*?)\\]#is', '', $item);
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
$additional = '';
// checked
if (strpos($item, '[c]') !== false) {
$additional .= 'checked="checked"';
}
// disabled
if (strpos($item, '[d]') !== false) {
$additional .= 'disabled="disabled"';
}
$out .= '<input type="checkbox" ' . $additional . ' value="' . RSFormProHelper::htmlEscape($val) . '" id="' . $data['NAME'] . $i . '"/><label for="' . $data['NAME'] . $i . '">' . $txt . '</label>';
if ($data['FLOW'] == 'VERTICAL') {
$out .= '<br/>';
//.........这里部分代码省略.........