本文整理汇总了PHP中HtmlHelper::input方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::input方法的具体用法?PHP HtmlHelper::input怎么用?PHP HtmlHelper::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper::input方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: metabox_html
/**
* Prints the HTML markup for the 'Is This An Hotel?' metabox
*/
public static function metabox_html($post)
{
wp_nonce_field(__FILE__, self::META_KEY_NAME . '_nonce');
$value = get_post_meta($post->ID, self::META_KEY_NAME, true);
echo HtmlHelper::input(self::META_KEY_NAME, 'checkbox', array('checked' => $value == 'on' ? 'checked' : ''));
echo ' ' . HtmlHelper::label(__('Yes, this page is an Hotel!', 'wtu_framework'), self::META_KEY_NAME);
}
示例2: JParameter
</div>
<?php
echo $DropTabsHelper->tabEnd();
?>
<?php
echo $DropTabsHelper->tabStart('settings');
?>
<?php
if (!empty($form)) {
$params = new JParameter($form->params);
} else {
$params = new JParameter('');
}
?>
<?php
echo $HtmlHelper->input('chronoform_name', array('type' => 'text', 'id' => 'chronoform_name', 'class' => 'medium_input', 'label' => 'Form name', 'smalldesc' => 'Unique form name without spaces or any special characters, underscores _ or dashes -', 'value' => !empty($form) ? $form->name : ''));
?>
<?php
echo $HtmlHelper->input('chronoform_published', array('type' => 'select', 'label' => 'Published', 'options' => array(0 => 'No', 1 => 'Yes'), 'default' => 1, 'value' => !empty($form) ? $form->published : 0));
?>
<?php
echo $HtmlHelper->input('form_type', array('type' => 'hidden', 'value' => !empty($form) ? $form->form_type : 1));
?>
<?php
echo $HtmlHelper->input('params[tight_layout]', array('type' => 'select', 'label' => 'Tight Layout', 'value' => $params->get('tight_layout', 0), 'options' => array(0 => 'Normal', 1 => 'Tight'), 'default' => 0, 'smalldesc' => 'Should the form load the regular CSS or load a tight CSS (less spaced out, smaller fields and less padding..etc) ?'));
?>
<!--<textarea style="display:none;" name="params"><?php
echo !empty($form) ? $form->params : '';
?>
</textarea>-->
示例3: _processWizardCode
function _processWizardCode($formdata)
{
$content = '';
require_once JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_chronoforms" . DS . "helpers" . DS . "html_helper.php";
$HtmlHelper = new HtmlHelper();
foreach ($formdata as $formdata_key => $formdata_element) {
$field_header = $formdata_element['tag'] . '_' . $formdata_element['type'] . '_' . str_replace('field_', '', $formdata_key);
$formcontent_item_array = array();
$field_name = '';
if (isset($formdata_element[$field_header . '_input_name'])) {
$field_name = $formdata_element[$field_header . '_input_name'];
}
//disable label if empty
if (isset($formdata_element[$field_header . '_label_text']) && strlen($formdata_element[$field_header . '_label_text'])) {
$formcontent_item_array['label'] = $formdata_element[$field_header . '_label_text'];
} else {
$formcontent_item_array['label'] = false;
}
switch ($formdata_element['type']) {
case 'select':
if (strlen($formdata_element[$field_header . '_showempty'])) {
$showempty = $formdata_element[$field_header . '_showempty'];
} else {
$showempty = false;
}
$formcontent_item_array['empty'] = $showempty;
if ((bool) $formdata_element[$field_header . '_multiple']) {
$formcontent_item_array['multiple'] = (bool) $formdata_element[$field_header . '_multiple'];
}
$formcontent_item_array['size'] = $formdata_element[$field_header . '_size'];
$formcontent_item_array['selected'] = $formdata_element[$field_header . '_selected'];
$formcontent_item_array['label_over'] = $formdata_element[$field_header . '_label_over'];
$formcontent_item_array['hide_label'] = $formdata_element[$field_header . '_hide_label'];
$temp_options = explode("\n", $formdata_element[$field_header . '_options']);
foreach ($temp_options as $temp_option) {
$temp_option_details = explode('=', $temp_option);
$formcontent_item_array['options'][strval($temp_option_details[0])] = trim($temp_option_details[1]);
}
$formcontent_item_array['id'] = $formdata_element[$field_header . '_input_id'];
$formcontent_item_array['class'] = $formdata_element[$field_header . '_input_class'];
$formcontent_item_array['title'] = $formdata_element[$field_header . '_input_title'];
$formcontent_item_array['validations'] = $formdata_element[$field_header . '_validations'];
$formcontent_item_array['smalldesc'] = $formdata_element[$field_header . '_instructions'];
$formcontent_item_array['tooltip'] = $formdata_element[$field_header . '_tooltip'];
$formcontent_item_array['type'] = $formdata_element['type'];
break;
case 'textarea':
$formcontent_item_array['id'] = $formdata_element[$field_header . '_input_id'];
$formcontent_item_array['default'] = $formdata_element[$field_header . '_input_value'];
$formcontent_item_array['cols'] = $formdata_element[$field_header . '_input_cols'];
$formcontent_item_array['rows'] = $formdata_element[$field_header . '_input_rows'];
$formcontent_item_array['class'] = $formdata_element[$field_header . '_input_class'];
$formcontent_item_array['title'] = $formdata_element[$field_header . '_input_title'];
$formcontent_item_array['label_over'] = $formdata_element[$field_header . '_label_over'];
$formcontent_item_array['hide_label'] = $formdata_element[$field_header . '_hide_label'];
$formcontent_item_array['validations'] = $formdata_element[$field_header . '_validations'];
$formcontent_item_array['smalldesc'] = $formdata_element[$field_header . '_instructions'];
$formcontent_item_array['tooltip'] = $formdata_element[$field_header . '_tooltip'];
$formcontent_item_array['type'] = $formdata_element['type'];
break;
case 'radio':
if (!empty($formdata_element[$field_header . '_input_value'])) {
$formcontent_item_array['value'] = $formdata_element[$field_header . '_input_value'];
}
$temp_options = explode("\n", $formdata_element[$field_header . '_options']);
foreach ($temp_options as $temp_option) {
$temp_option_details = explode('=', $temp_option);
$formcontent_item_array['options'][strval($temp_option_details[0])] = trim($temp_option_details[1]);
}
$formcontent_item_array['legend'] = $formdata_element[$field_header . '_legend'];
$formcontent_item_array['id'] = $formdata_element[$field_header . '_input_id'];
$formcontent_item_array['ghost'] = $formdata_element[$field_header . '_ghost'];
$formcontent_item_array['ghost_value'] = $formdata_element[$field_header . '_ghost_value'];
$formcontent_item_array['label_over'] = $formdata_element[$field_header . '_label_over'];
$formcontent_item_array['hide_label'] = $formdata_element[$field_header . '_hide_label'];
$formcontent_item_array['radios_over'] = $formdata_element[$field_header . '_radios_over'];
$formcontent_item_array['title'] = $formdata_element[$field_header . '_input_title'];
$formcontent_item_array['validations'] = $formdata_element[$field_header . '_validations'];
$formcontent_item_array['smalldesc'] = $formdata_element[$field_header . '_instructions'];
$formcontent_item_array['tooltip'] = $formdata_element[$field_header . '_tooltip'];
$formcontent_item_array['type'] = $formdata_element['type'];
break;
case 'checkbox_group':
$formcontent_item_array['selected'] = $formdata_element[$field_header . '_checked'];
$temp_options = explode("\n", $formdata_element[$field_header . '_options']);
foreach ($temp_options as $temp_option) {
$temp_option_details = explode('=', $temp_option);
$formcontent_item_array['options'][strval($temp_option_details[0])] = trim($temp_option_details[1]);
}
$formcontent_item_array['id'] = $formdata_element[$field_header . '_input_id'];
$formcontent_item_array['ghost'] = $formdata_element[$field_header . '_ghost'];
$formcontent_item_array['ghost_value'] = $formdata_element[$field_header . '_ghost_value'];
$formcontent_item_array['label_over'] = $formdata_element[$field_header . '_label_over'];
$formcontent_item_array['hide_label'] = $formdata_element[$field_header . '_hide_label'];
$formcontent_item_array['radios_over'] = $formdata_element[$field_header . '_radios_over'];
$formcontent_item_array['title'] = $formdata_element[$field_header . '_input_title'];
$formcontent_item_array['multiple'] = 'checkbox';
$formcontent_item_array['validations'] = $formdata_element[$field_header . '_validations'];
$formcontent_item_array['smalldesc'] = $formdata_element[$field_header . '_instructions'];
$formcontent_item_array['tooltip'] = $formdata_element[$field_header . '_tooltip'];
//.........这里部分代码省略.........
示例4: HtmlHelper
function _processWizardCode($formdata)
{
$content = '';
require_once JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_chronoforms" . DS . "helpers" . DS . "html_helper.php";
$HtmlHelper = new HtmlHelper();
foreach ($formdata as $formdata_key => $formdata_element) {
$field_header = $formdata_element['tag'] . '_' . $formdata_element['type'] . '_' . str_replace('field_', '', $formdata_key);
$formcontent_item_array = array();
$field_name = '';
if (isset($formdata_element[$field_header . '_input_name'])) {
$field_name = $formdata_element[$field_header . '_input_name'];
}
//disable label if empty
if (isset($formdata_element[$field_header . '_label_text']) && strlen($formdata_element[$field_header . '_label_text'])) {
$formcontent_item_array['label'] = $formdata_element[$field_header . '_label_text'];
} else {
$formcontent_item_array['label'] = false;
}
switch ($formdata_element['type']) {
default:
$process = true;
$file_name = 'input_' . $formdata_element['type'];
if (file_exists(JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_chronoforms" . DS . 'form_elements' . DS . $file_name . '.php')) {
require_once JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_chronoforms" . DS . 'form_elements' . DS . $file_name . '.php';
$elementclassname = preg_replace('/(?:^|_)(.?)/e', "strtoupper('\$1')", 'chrono_forms_' . $file_name);
if (class_exists($elementclassname)) {
$elementclass = new $elementclassname();
$methods = get_class_methods($elementclass);
if (in_array('save', $methods)) {
$formcontent_item_array = $elementclass->save($formdata_element, $field_header, $formcontent_item_array);
$process = false;
}
}
}
if ($process) {
if (isset($formdata_element[$field_header . '_input_id'])) {
$formcontent_item_array['id'] = $formdata_element[$field_header . '_input_id'];
unset($formdata_element[$field_header . '_input_id']);
}
if (isset($formdata_element[$field_header . '_input_value'])) {
$formcontent_item_array['default'] = $formdata_element[$field_header . '_input_value'];
unset($formdata_element[$field_header . '_input_value']);
}
if (isset($formdata_element[$field_header . '_input_maxlength'])) {
$formcontent_item_array['maxlength'] = $formdata_element[$field_header . '_input_maxlength'];
unset($formdata_element[$field_header . '_input_maxlength']);
}
if (isset($formdata_element[$field_header . '_input_size'])) {
$formcontent_item_array['size'] = $formdata_element[$field_header . '_input_size'];
unset($formdata_element[$field_header . '_input_size']);
}
if (isset($formdata_element[$field_header . '_input_class'])) {
$formcontent_item_array['class'] = $formdata_element[$field_header . '_input_class'];
unset($formdata_element[$field_header . '_input_class']);
}
if (isset($formdata_element[$field_header . '_input_title'])) {
$formcontent_item_array['title'] = $formdata_element[$field_header . '_input_title'];
unset($formdata_element[$field_header . '_input_title']);
}
if (isset($formdata_element[$field_header . '_label_over'])) {
$formcontent_item_array['label_over'] = $formdata_element[$field_header . '_label_over'];
unset($formdata_element[$field_header . '_label_over']);
}
if (isset($formdata_element[$field_header . '_hide_label'])) {
$formcontent_item_array['hide_label'] = $formdata_element[$field_header . '_hide_label'];
unset($formdata_element[$field_header . '_hide_label']);
}
if (isset($formdata_element[$field_header . '_validations'])) {
$formcontent_item_array['validations'] = $formdata_element[$field_header . '_validations'];
unset($formdata_element[$field_header . '_validations']);
}
if (isset($formdata_element[$field_header . '_instructions'])) {
$formcontent_item_array['smalldesc'] = $formdata_element[$field_header . '_instructions'];
unset($formdata_element[$field_header . '_instructions']);
}
if (isset($formdata_element[$field_header . '_tooltip'])) {
$formcontent_item_array['tooltip'] = $formdata_element[$field_header . '_tooltip'];
unset($formdata_element[$field_header . '_tooltip']);
}
if (isset($formdata_element['real_type'])) {
$formcontent_item_array['type'] = $formdata_element['real_type'];
unset($formdata_element['real_type']);
unset($formdata_element['type']);
unset($formdata_element['tag']);
}
//unset the name and the label
unset($formdata_element[$field_header . '_input_name']);
unset($formdata_element[$field_header . '_label_text']);
//load the field params array
foreach ($formdata_element as $k => $v) {
$formcontent_item_array[str_replace($field_header . '_', '', $k)] = $formdata_element[$k];
}
$formcontent_item_array['wf_key'] = str_replace('field_', '', $formdata_key);
}
$formcontent_item_array['container_id'] = $formdata_element['container_id'];
break;
}
$content .= $HtmlHelper->input($field_name, $formcontent_item_array, true);
}
return $content;
//.........这里部分代码省略.........
示例5: metabox_html
/**
* Prints the HTML markup for the metabox
*/
public static function metabox_html($post)
{
if (is_null($post)) {
global $post;
}
$template = self::get_template($post);
if (count(self::$media_list)) {
$is_first = true;
foreach (self::$media_list as $k => $elem) {
$template_checker = new TemplateChecker($elem['include'], $elem['exclude']);
if (!$template_checker->check($template)) {
continue;
}
$name = self::META_KEY_NAME . '-' . $elem['id'];
wp_nonce_field(__FILE__, $name . '_nonce');
$value = get_post_meta($post->ID, $name, true);
// main edit button
$edit_button = HtmlHelper::anchor('javascript:;', HtmlHelper::span('', array('class' => 'wp-media-buttons-icon')) . __('Manage Media', 'wtu_framework'), array('id' => 'wtu-media-manager-button-' . $elem['id'], 'class' => 'button media-manager-button', 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-target-undo' => '#wtu-media-manager-undo-' . $elem['id'], 'data-target-delete' => '#wtu-media-manager-delete-' . $elem['id'], 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'data-frame-id' => 'wtu-media-manager-' . $elem['id'], 'data-title' => sprintf(__('Manage Media for %s', 'wtu_framework'), $elem['label']), 'data-button-label' => sprintf(__('Add selected media to %s set', 'wtu_framework'), $elem['label']), 'data-multiple' => 'true', 'data-elem-id' => $elem['id'], 'data-shortcode' => $elem['shortcode'], 'title' => sprintf(__('Manage Media for %s', 'wtu_framework'), $elem['label'])));
// input to store temp values, use text instead of hidden to debug
$input = HtmlHelper::input($name, 'hidden', array('id' => 'wtu-media-manager-element-' . $elem['id'], 'value' => $value));
// Counter
$number = 0;
if (isset($value) && $value != '') {
$number = count(explode(',', $value));
}
$counter = ' ' . HtmlHelper::span($number > 0 ? sprintf(_n('1 element', '%s elements', $number, 'wtu_framework'), $number) : __('Empty', 'wtu_framework'), array('id' => 'wtu-media-manager-counter-' . $elem['id'], 'data-label-no-images' => __('Empty', 'wtu_framework'), 'data-label-one-image' => __('1 element', 'wtu_framework'), 'data-label-more-images' => __('%s elements', 'wtu_framework')));
// delete button
$delete = HtmlHelper::anchor('javascript:;', __('Delete', 'wtu_framework'), array('id' => 'wtu-media-manager-delete-' . $elem['id'], 'style' => $value ? '' : 'display:none;', 'class' => 'delete-media-manager-gallery submitdelete', 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'data-gallery' => $elem['id'], 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-target-undo' => '#wtu-media-manager-undo-' . $elem['id'], 'data-target-origin' => '#wtu-media-manager-button-' . $elem['id'], 'title' => __('Delete Media Set', 'wtu_framework')));
// undo button
$undo = HtmlHelper::anchor('javascript:;', __('Undo', 'wtu_framework'), array('id' => 'wtu-media-manager-undo-' . $elem['id'], 'style' => 'display:none;', 'class' => 'undo-media-manager-gallery', 'data-gallery' => $elem['id'], 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-elem-id' => $elem['id'], 'data-target-origin' => '#wtu-media-manager-button-' . $elem['id'], 'data-target-delete' => '#wtu-media-manager-delete-' . $elem['id'], 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'title' => __('Restore Media Set', 'wtu_framework')));
$title = HtmlHelper::paragraph(HtmlHelper::strong($elem['label']));
$inner_html = '';
if (!$is_first) {
$inner_html .= HtmlHelper::br();
}
$inner_html .= '<table class="widefat"><thead>';
$inner_html .= '<td width="33%">' . $title . '</td>';
$inner_html .= '<td width="33%"> </td>';
$inner_html .= '<td width="33%">' . $edit_button . '</td></thead>';
$inner_html .= '<tbody><tr style="line-height: 25px;"><td class="submitbox">' . $delete . $undo . '</td>';
$inner_html .= '<td> </td>';
$inner_html .= '<td>' . $counter . '</td>';
$inner_html .= '</tr></tbody></table>';
$inner_html .= $input;
echo HtmlHelper::div($inner_html, array('class' => ''));
$is_first = false;
}
}
//var_dump($value);
}
示例6: count
<?php
$wrong_inputs = array();
foreach ($defaults as $default => $default_data) {
if ((int) preg_match("/^[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*\$/", $default) == 0) {
$wrong_inputs[] = $default;
JError::raiseWarning(200, 'Field name "' . $default . '" is invalid, please fix the field name in the wizard (or the form code) then retry again.');
}
}
if (!empty($wrong_inputs)) {
JError::raiseNotice(200, 'A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.');
}
?>
<form action="index.php?option=com_chronoforms" method="post" name="adminForm" id="adminForm">
<?php
echo $HtmlHelper->input('_cf_table_name', array('label' => 'Table Name', 'value' => '#__chronoforms_data_' . str_replace("-", "_", $row->name), 'class' => 'medium_input', 'smalldesc' => 'Enter the table name here, no spaces or any special characters, underscores allowed.'));
?>
<table class="adminlist">
<thead>
<th width="1%" class='title'>#</th>
<th width="5%" class='title' style="text-align: left;">Field name</th>
<th width="1%" class='title' style="text-align: left;">Enabled<input type="checkbox" checked name="toggle" value="" onclick="checkAll(<?php
echo count($defaults);
?>
, 'enabled');" /></th>
<th width="10%" align="left" class='title' style="text-align: left;">Type</th>
<th width="10%" align="left" class='title' style="text-align: left;">Length</th>
<th width="2%" align="left" class='title' style="text-align: left;">Primary key</th>
<th width="10%" align="left" class='title' style="text-align: left;">Default</th>
<th width="10%" align="left" class='title' style="text-align: left;">Extra</th>
<th width="10%" align="left" class='title' style="text-align: left;">Null</th>
示例7: test_exception_when_add_content_to_void_element
/**
* @expectedException \LogicException
*/
public function test_exception_when_add_content_to_void_element()
{
$h = new HtmlHelper();
$h->input("text");
}
示例8: _markup_text
public function _markup_text($field, $values)
{
return HtmlHelper::input($this->metaname . '[' . $field['id'] . ']', $field['type'], array_merge(array('value' => $values[$field['id']], 'class' => 'large-text'), (array) $field['parms']));
}
示例9: array
<?php
if (!empty($form)) {
echo $form->name;
} else {
echo 'New Form...';
}
?>
</h2>
<?php
echo $TabsHelper->Header(array('general' => 'General', 'code' => 'Code', 'jsval' => 'JS Validation', 'admin_actions' => 'Admin actions', 'apps' => 'Form Applications', 'data_view' => 'Data View'));
?>
<?php
echo $TabsHelper->tabStart('general');
?>
<?php
echo $HtmlHelper->input('name', array('type' => 'text', 'id' => 'chronoform_name', 'label' => 'Form name', 'class' => 'medium_input', 'smalldesc' => 'Unique form name without spaces or any special characters, underscores _ or dashes -'));
?>
<?php
echo $HtmlHelper->input('published', array('type' => 'select', 'label' => 'Published', 'options' => array(0 => 'No', 1 => 'Yes'), 'default' => 1));
?>
<?php
echo $HtmlHelper->input('params[form_mode]', array('type' => 'select', 'label' => 'Form Wizard Mode', 'value' => $params->get('form_mode', 'advanced'), 'options' => array('advanced' => 'Advanced (Default)', 'easy' => 'Easy'), 'default' => 'advanced', 'smalldesc' => 'Choose your form wizard mode, the advanced mode is the default one, you will have all the Chronoforms V4 tools enabled in the wizard, the Easy mode is easier to use though and is enough to build strong simple forms.'));
?>
<?php
echo $HtmlHelper->input('params[form_method]', array('type' => 'select', 'label' => 'Form method', 'value' => $params->get('form_method', 'post'), 'options' => array('post' => 'Post', 'get' => 'Get', 'file' => 'File'), 'default' => 'post', 'smalldesc' => 'Choose your form method, File is ncessary to get file uploads working.'));
?>
<?php
echo $HtmlHelper->input('params[auto_detect_settings]', array('type' => 'select', 'label' => 'Auto Detect Settings', 'value' => $params->get('auto_detect_settings', 1), 'options' => array(0 => 'No', 1 => 'Yes (Advised)'), 'default' => 1, 'smalldesc' => 'Should the form detect some settings and apply them automatically ? settings like validtaion and files uploading will be detected based on your form code.'));
?>
<?php
echo $HtmlHelper->input('params[load_files]', array('type' => 'select', 'label' => 'Load Chronoforms files', 'value' => $params->get('load_files', 1), 'options' => array(0 => 'Disable completely', 1 => 'Load necessary files', 2 => 'Load ALL files!'), 'default' => 1));
示例10: metabox_html
/**
* Prints the metabox for the offer details
* @param object $post the current post
*/
public function metabox_html($post)
{
wp_nonce_field(__FILE__, static::META_KEY_NAME . '_nonce');
$values = get_post_meta($post->ID, static::META_KEY_NAME, true);
echo '<table class="form-table">';
foreach ($this->offer_details_list() as $k => $v) {
$name = static::META_KEY_NAME . '[' . $v['name'] . ']';
echo '<tr>';
echo '<th>' . HtmlHelper::label($v['label'], $name) . '</th>';
echo '<td>' . HtmlHelper::input($name, 'text', array('value' => isset($values[$k]) ? $values[$k] : '')) . '</td>';
echo '</tr>';
}
echo '</table>';
}