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


PHP HTML_Common类代码示例

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


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

示例1: MyQuickForm

 function MyQuickForm($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false)
 {
     HTML_Common::HTML_Common($attributes);
     $method = strtoupper($method) == 'GET' ? 'get' : 'post';
     $action = $action == '' ? $_SERVER['PHP_SELF'] : $action;
     $target = empty($target) ? array() : array('target' => $target);
     $attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
     $this->_trackSubmit = $trackSubmit;
     $this->updateAttributes($attributes);
     $this->initRequest();
     if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
         // see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
         switch (strtoupper($matches['2'])) {
             case 'G':
                 $this->_maxFileSize = $matches['1'] * 1073741824;
                 break;
             case 'M':
                 $this->_maxFileSize = $matches['1'] * 1048576;
                 break;
             case 'K':
                 $this->_maxFileSize = $matches['1'] * 1024;
                 break;
             default:
                 $this->_maxFileSize = $matches['1'];
         }
     }
 }
开发者ID:demental,项目名称:m,代码行数:27,代码来源:MyQuickForm.php

示例2: HTML_Table

 /**
  * Class constructor
  * @param    array    $attributes        Associative array of table tag attributes
  * @param    int      $tabOffset
  * @access   public
  */
 function HTML_Table($attributes = null, $tabOffset = 0)
 {
     $commonVersion = 1.7;
     if (HTML_Common::apiVersion() < $commonVersion) {
         return PEAR::raiseError("HTML_Table version " . $this->apiVersion() . " requires " . "HTML_Common version {$commonVersion} or greater.", 0, PEAR_ERROR_TRIGGER);
     }
     HTML_Common::HTML_Common($attributes, $tabOffset);
 }
开发者ID:Artea,项目名称:freebeer,代码行数:14,代码来源:Table.php

示例3: HTML_Select

 /**
  * Class constructor
  *
  * @param     string    $name       (optional)Name attribute of the SELECT
  * @param     int       $size       (optional) Size attribute of the SELECT
  * @param     bool      $multiple   (optional)Whether the select will allow multiple
  *                                  selections or not
  * @param     mixed     $attributes (optional)Either a typical HTML attribute string
  *                                  or an associative array
  * @param     int       $tabOffset  (optional)Number of tabs to offset HTML source
  * @since     1.0
  * @access    public
  * @return    void
  * @throws
  */
 function HTML_Select($name = '', $size = 1, $multiple = false, $attributes = null, $tabOffset = 0)
 {
     HTML_Common::HTML_Common($attributes, $tabOffset);
     $attr = array('name' => $name, 'size' => $size);
     if ($multiple) {
         $attr['multiple'] = 'multiple';
     }
     $this->updateAttributes($attr);
     $this->setSelectedValues(array());
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:25,代码来源:HTML_Select.php

示例4: HTML_QuickForm_element

 /**
  * Class constructor
  * 
  * @param    string     Name of the element
  * @param    mixed      Label(s) for the element
  * @param    mixed      Associative array of tag attributes or HTML attributes name="value" pairs
  * @since     1.0
  * @access    public
  * @return    void
  */
 function HTML_QuickForm_element($elementName = null, $elementLabel = null, $attributes = null)
 {
     HTML_Common::HTML_Common($attributes);
     if (isset($elementName)) {
         $this->setName($elementName);
     }
     if (isset($elementLabel)) {
         $this->setLabel($elementLabel);
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:20,代码来源:element.php

示例5: ilp_MoodleQuickForm

 /**
  * Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless
  * @param    string      $formName          Form's name.
  * @param    string      $method            (optional)Form's method defaults to 'POST'
  * @param    mixed      $action             (optional)Form's action - string or moodle_url
  * @param    string      $target            (optional)Form's target defaults to none
  * @param    mixed       $attributes        (optional)Extra attributes for <form> tag
  * @param    bool        $trackSubmit       (optional)Whether to track if the form was submitted by adding a special hidden field
  * @access   public
  */
 function ilp_MoodleQuickForm($formName, $method, $action, $target = '', $attributes = array())
 {
     global $CFG, $OUTPUT;
     static $formcounter = 1;
     HTML_Common::HTML_Common($attributes);
     $target = empty($target) ? array() : array('target' => $target);
     $this->_formName = $formName;
     if (is_a($action, 'moodle_url')) {
         $this->_pageparams = $action->hidden_params_out();
         $action = $action->out(true);
     } else {
         $this->_pageparams = '';
     }
     //no 'name' atttribute for form in xhtml strict :
     $attributes['action'] = $action;
     $attributes['method'] = $method;
     $attributes['accept-charset'] = 'utf-8';
     $attributes['id'] = empty($attributes['id']) ? 'mform' . $formcounter : $attributes['id'];
     $attributes += $target;
     //
     //            array('action'=>$action, 'method'=>$method,
     //                'accept-charset'=>'utf-8', 'id'=>'mform'.$formcounter) + $target;
     $formcounter++;
     $this->updateAttributes($attributes);
     //this is custom stuff for Moodle :
     $oldclass = $this->getAttribute('class');
     if (!empty($oldclass)) {
         $this->updateAttributes(array('class' => $oldclass . ' mform'));
     } else {
         $this->updateAttributes(array('class' => 'mform'));
     }
     $this->_reqHTML = '<img class="req" title="' . get_string('requiredelement', 'form') . '" alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />';
     $this->_advancedHTML = '<img class="adv" title="' . get_string('advancedelement', 'form') . '" alt="' . get_string('advancedelement', 'form') . '" src="' . $OUTPUT->pix_url('adv') . '" />';
     $this->setRequiredNote(get_string('somefieldsrequired', 'form', '<img alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />'));
     //(Help file doesn't add anything) helpbutton('requiredelement', get_string('requiredelement', 'form'), 'moodle', true, false, '', true));
 }
开发者ID:nathanfriend,项目名称:moodle-block_ilp,代码行数:46,代码来源:ilp_formslib.class.php

示例6: _getAttributes

 /**
  * DB_DataObject_FormBuilder_QuickForm::_getAttributes()
  *
  * Returns the attributes to apply to a field based on the field name and
  * element type. The field's attributes take precedence over the element type's.
  *
  * @param string $elementType the internal type of the element
  * @param string $fieldName the name of the field
  * @return array an array of attributes to apply to the element
  */
 function _getAttributes($elementType, $fieldName)
 {
     if (isset($this->elementTypeAttributes[$elementType])) {
         if (is_string($this->elementTypeAttributes[$elementType])) {
             $this->elementTypeAttributes[$elementType] = HTML_Common::_parseAttributes($this->elementTypeAttributes[$elementType]);
         }
         $attr = $this->elementTypeAttributes[$elementType];
     } else {
         $attr = array();
     }
     if (isset($this->fieldAttributes[$fieldName])) {
         if (is_string($this->fieldAttributes[$fieldName])) {
             $this->fieldAttributes[$fieldName] = HTML_Common::_parseAttributes($this->fieldAttributes[$fieldName]);
         }
         $attr = array_merge($attr, $this->fieldAttributes[$fieldName]);
     }
     return $attr;
 }
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:28,代码来源:QuickForm.php

示例7: __construct

 /**
  * Class constructor
  *
  * @param    int      $tabOffset
  * @param    bool     $useTGroups        Whether to use <thead>, <tfoot> and
  *                                       <tbody> or not
  * @access   public
  */
 function __construct($tabOffset = 0, $useTGroups = false)
 {
     HTML_Common::HTML_Common(null, (int) $tabOffset);
     $this->_useTGroups = (bool) $useTGroups;
 }
开发者ID:pear,项目名称:html_table,代码行数:13,代码来源:Storage.php

示例8: MoodleQuickForm

 /**
  * Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless
  *
  * @staticvar int $formcounter counts number of forms
  * @param string $formName Form's name.
  * @param string $method Form's method defaults to 'POST'
  * @param string|moodle_url $action Form's action
  * @param string $target (optional)Form's target defaults to none
  * @param mixed $attributes (optional)Extra attributes for <form> tag
  */
 function MoodleQuickForm($formName, $method, $action, $target = '', $attributes = null)
 {
     global $CFG, $OUTPUT;
     static $formcounter = 1;
     HTML_Common::HTML_Common($attributes);
     $target = empty($target) ? array() : array('target' => $target);
     $this->_formName = $formName;
     if (is_a($action, 'moodle_url')) {
         $this->_pageparams = html_writer::input_hidden_params($action);
         $action = $action->out_omit_querystring();
     } else {
         $this->_pageparams = '';
     }
     // No 'name' atttribute for form in xhtml strict :
     $attributes = array('action' => $action, 'method' => $method, 'accept-charset' => 'utf-8') + $target;
     if (is_null($this->getAttribute('id'))) {
         $attributes['id'] = 'mform' . $formcounter;
     }
     $formcounter++;
     $this->updateAttributes($attributes);
     // This is custom stuff for Moodle :
     $oldclass = $this->getAttribute('class');
     if (!empty($oldclass)) {
         $this->updateAttributes(array('class' => $oldclass . ' mform'));
     } else {
         $this->updateAttributes(array('class' => 'mform'));
     }
     $this->_reqHTML = '<img class="req" title="' . get_string('requiredelement', 'form') . '" alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />';
     $this->_advancedHTML = '<img class="adv" title="' . get_string('advancedelement', 'form') . '" alt="' . get_string('advancedelement', 'form') . '" src="' . $OUTPUT->pix_url('adv') . '" />';
     $this->setRequiredNote(get_string('somefieldsrequired', 'form', '<img alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />'));
 }
开发者ID:educacionbe,项目名称:cursos,代码行数:41,代码来源:formslib.php

示例9: createButtons

 /**
  * Adds all necessary buttons to the given page object.
  *
  * @param      object    $page          Page where to put the button
  * @param      array     $buttons       Key/label of each button/event to handle
  * @param      mixed     $attributes    (optional) Either a typical HTML attribute string
  *                                      or an associative array.
  * @return     void
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function createButtons(&$page, $buttons, $attributes = null)
 {
     if (!is_a($page, 'HTML_QuickForm_Page')) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$page', 'was' => gettype($page), 'expected' => 'HTML_QuickForm_Page object', 'paramnum' => 1));
     } elseif (!is_array($buttons)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$buttons', 'was' => gettype($buttons), 'expected' => 'array', 'paramnum' => 2));
     } elseif (!is_array($attributes) && !is_string($attributes) && !is_null($attributes)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array | string', 'paramnum' => 3));
     }
     $confirm = $attributes = HTML_Common::_parseAttributes($attributes);
     $confirm['onClick'] = "return(confirm('Are you sure ?'));";
     $prevnext = array();
     foreach ($buttons as $event => $label) {
         if ($event == 'cancel') {
             $type = 'submit';
             $attrs = $confirm;
         } elseif ($event == 'reset') {
             $type = 'reset';
             $attrs = $confirm;
         } else {
             $type = 'submit';
             $attrs = $attributes;
         }
         $prevnext[] = $page->createElement($type, $page->getButtonName($event), $label, HTML_Common::_getAttrString($attrs));
     }
     $page->addGroup($prevnext, 'buttons', '', '&nbsp;', false);
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:39,代码来源:generator.php

示例10: HTML_Table

 /**
  * Class constructor
  * @param    array    $attributes        Associative array of table tag attributes
  * @param    int      $tabOffset         Tab offset of the table
  * @param    bool     $useTGroups        Whether to use <thead>, <tfoot> and
  *                                       <tbody> or not
  * @access   public
  */
 function HTML_Table($attributes = null, $tabOffset = 0, $useTGroups = false)
 {
     $commonVersion = 1.7;
     if (HTML_Common::apiVersion() < $commonVersion) {
         return PEAR::raiseError('HTML_Table version ' . $this->apiVersion() . ' requires ' . "HTML_Common version {$commonVersion} or greater.", 0, PEAR_ERROR_TRIGGER);
     }
     HTML_Common::HTML_Common($attributes, (int) $tabOffset);
     $this->_useTGroups = (bool) $useTGroups;
     $this->_tbody = new HTML_Table_Storage($attributes, $tabOffset, $this->_useTGroups);
     if ($this->_useTGroups) {
         $this->_thead = new HTML_Table_Storage($attributes, $tabOffset, $this->_useTGroups);
         $this->_tfoot = new HTML_Table_Storage($attributes, $tabOffset, $this->_useTGroups);
     }
 }
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:22,代码来源:Table.php

示例11: _getAttrString

 /**
  * Returns an HTML formatted attribute string
  * Use Sigma for parsing
  * @param    array   $attributes
  * @return   string
  * @access   private
  */
 function _getAttrString($attributes)
 {
     $template = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/Html/View/Template/Generic/');
     $template->loadTemplateFile('Attribute.html');
     $strAttr = '';
     if (is_array($attributes)) {
         $charset = HTML_Common::charset();
         foreach ($attributes as $key => $value) {
             $template->setVariable(array('ATTRIBUTE_NAME' => $key, 'ATTRIBUTE_VALUE' => htmlspecialchars($value, ENT_COMPAT, $charset)));
             $template->parse('attribute');
         }
     }
     return $template->get();
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:21,代码来源:BackendTable.class.php

示例12: HTML_QuickForm

 /**
  * Class constructor
  * @param    string      $formName          Form's name.
  * @param    string      $method            (optional)Form's method defaults to 'POST'
  * @param    string      $action            (optional)Form's action
  * @param    string      $target            (optional)Form's target defaults to '_self'
  * @param    mixed       $attributes        (optional)Extra attributes for <form> tag
  * @param    bool        $trackSubmit       (optional)Whether to track if the form was submitted by adding a special hidden field
  * @access   public
  */
 function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = null, $trackSubmit = false)
 {
     HTML_Common::HTML_Common($attributes);
     $method = strtoupper($method) == 'GET' ? 'get' : 'post';
     $action = $action == '' ? $_SERVER['PHP_SELF'] : $action;
     $target = empty($target) || $target == '_self' ? array() : array('target' => $target);
     $attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
     $this->updateAttributes($attributes);
     if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
         if (1 == get_magic_quotes_gpc()) {
             $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method ? $_GET : $_POST);
             foreach ($_FILES as $keyFirst => $valFirst) {
                 foreach ($valFirst as $keySecond => $valSecond) {
                     if ('name' == $keySecond) {
                         $this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond);
                     } else {
                         $this->_submitFiles[$keyFirst][$keySecond] = $valSecond;
                     }
                 }
             }
         } else {
             $this->_submitValues = 'get' == $method ? $_GET : $_POST;
             $this->_submitFiles = $_FILES;
         }
     }
     if ($trackSubmit) {
         unset($this->_submitValues['_qf__' . $formName]);
         $this->addElement('hidden', '_qf__' . $formName, null);
     }
 }
开发者ID:valentijnvenus,项目名称:geocloud,代码行数:40,代码来源:QuickForm.php

示例13: HTML_Table

 /**
  * Class constructor
  * @param array $attributes Associative array of table tag
  *                                       attributes
  * @param int  $tabOffset  Tab offset of the table
  * @param bool $useTGroups Whether to use <thead>, <tfoot> and
  *                                       <tbody> or not
  * @access   public
  */
 public function HTML_Table($attributes = null, $tabOffset = 0, $useTGroups = false)
 {
     HTML_Common::HTML_Common($attributes, (int) $tabOffset);
     $this->_useTGroups = (bool) $useTGroups;
     $this->addBody();
     if ($this->_useTGroups) {
         $this->_thead =& new HTML_Table_Storage($tabOffset, $this->_useTGroups);
         $this->_tfoot =& new HTML_Table_Storage($tabOffset, $this->_useTGroups);
     }
 }
开发者ID:YesWiki,项目名称:yeswiki-sandstorm,代码行数:19,代码来源:Table.php

示例14: HTML_QuickForm

 /**
  * Class constructor
  * @param    string      $formName          Form's name.
  * @param    string      $method            (optional)Form's method defaults to 'POST'
  * @param    string      $action            (optional)Form's action
  * @param    string      $target            (optional)Form's target defaults to '_self'
  * @param    mixed       $attributes        (optional)Extra attributes for <form> tag
  * @param    bool        $trackSubmit       (optional)Whether to track if the form was submitted by adding a special hidden field
  * @access   public
  */
 function HTML_QuickForm($formName = '', $method = 'post', $action = '', $target = '', $attributes = null, $trackSubmit = false)
 {
     HTML_Common::HTML_Common($attributes);
     $method = strtoupper($method) == 'GET' ? 'get' : 'post';
     $action = $action == '' ? $_SERVER['PHP_SELF'] : $action;
     $target = empty($target) ? array() : array('target' => $target);
     $attributes = array('action' => $action, 'method' => $method, 'name' => $formName, 'id' => $formName) + $target;
     $this->updateAttributes($attributes);
     if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
         $this->_setSubmitValues('get' == $method ? $_GET : $_POST, $_FILES);
     }
     if ($trackSubmit) {
         unset($this->_submitValues['_qf__' . $formName]);
         $this->addElement('hidden', '_qf__' . $formName, null);
     }
     if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
         // see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
         switch (strtoupper($matches['2'])) {
             case 'G':
                 $this->_maxFileSize = $matches['1'] * 1073741824;
                 break;
             case 'M':
                 $this->_maxFileSize = $matches['1'] * 1048576;
                 break;
             case 'K':
                 $this->_maxFileSize = $matches['1'] * 1024;
                 break;
             default:
                 $this->_maxFileSize = $matches['1'];
         }
     }
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:42,代码来源:QuickForm.php

示例15: _getAttrString

 /**
  * Returns an HTML formatted attribute string
  * @param    array   $attributes
  * @return   string
  * @access   private
  */
 function _getAttrString($attributes)
 {
     $strAttr = '';
     if (is_array($attributes)) {
         $charset = HTML_Common::charset();
         foreach ($attributes as $key => $value) {
             // Modified by Ivan Tcholakov, 16-MAR-2010
             //$strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"';
             $strAttr .= ' ' . $key . '="' . @htmlspecialchars($value, ENT_COMPAT, $charset) . '"';
             //
         }
     }
     return $strAttr;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:20,代码来源:Common.php


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