Esempio n. 1
0
 protected function onFirstTD(HTMLTag $td)
 {
     $td->addClass('first');
     if ($this->getOption('css.extendedClasses', FALSE)) {
         $td->addClass('\\Psc\\ui-table-column-last');
     }
 }
Esempio n. 2
0
 protected function placeholder($id)
 {
     $placeholder = new HTMLTag('span', false, false);
     $placeholder->createAttribute('id', 'hashover-placeholder-' . $id);
     $placeholder->appendAttribute('id', '-' . $this->fromVariable('permalink'), false);
     if (!empty($this->comment[$id])) {
         $placeholder->innerHTML($this->comment[$id]);
     }
     return $placeholder->asHTML();
 }
Esempio n. 3
0
 protected function editCheck($permalink, $comment, $subscribed = true)
 {
     if (empty($_GET['hashover-edit'])) {
         return;
     }
     if ($_GET['hashover-edit'] === $permalink) {
         $file = substr($permalink, 1);
         $file = str_replace('r', '-', $file);
         $file = str_replace('-pop', '', $file);
         $body = $comment['body'];
         $body = preg_replace($this->linkRegex, '\\1', $body);
         $status = !empty($comment['status']) ? $comment['status'] : 'approved';
         $name = !empty($comment['name']) ? $comment['name'] : '';
         $website = !empty($comment['website']) ? $comment['website'] : '';
         $form = new HTMLTag('form', false, false);
         $form->createAttribute('id', 'hashover-edit-' . $permalink);
         $form->createAttribute('class', 'hashover-edit-form');
         $form->createAttribute('method', 'post');
         $form->createAttribute('action', $this->setup->httpScripts . '/postcomments.php');
         $form->innerHTML($this->html->editForm($permalink, $file, $name, $website, $body, $status, $subscribed));
         return $form->asHTML();
     }
 }
Esempio n. 4
0
    $D = new Deck();
    $Hand = new Hand();
    foreach (range(1, 7) as $i) {
        $Hand->add($D->draw());
    }
    //*/
    /**
    	$Hand = new Hand();
    	$Hand->add( new Card(2,1) );
    	$Hand->add( new Card(3,1) );
    	$Hand->add( new Card(4,1) );
    	$Hand->add( new Card(5,1) );
    	$Hand->add( new Card(6,1) );
    	$Hand->add( new Card(7,2) );
    	$Hand->add( new Card(8,1) );
    	//*/
    $div = new HTMLTag("div", $Hand->rank(), array("class" => "row"));
    $col = new HTMLTag_Collection();
    foreach ($Hand->cards as $c) {
        $tpl = $c->show();
        $col->append($tpl);
    }
    #$div->append($col);
    echo $div->parse();
    echo $col->parse();
}
?>
</body>
</html>

Esempio n. 5
0
 public function setStyle($style, $value)
 {
     $this->html->setStyle($style, $value);
 }
 public function editForm($permalink, $file, $name = '', $website = '', $body, $subscribed = true)
 {
     // "Edit Comment" locale string
     $edit_comment = $this->locales->locale('edit_comment', $this->addcslashes);
     // "Save Edit" locale string
     $save_edit = $this->locales->locale('save_edit', $this->addcslashes);
     // "Cancel" locale string
     $cancel_edit = $this->locales->locale('cancel', $this->addcslashes);
     // "Delete" locale string
     $delete_comment = $this->locales->locale('delete', $this->addcslashes);
     // Create wrapper element
     $edit_form = new HTMLTag('div');
     // Create edit form title element
     $edit_form_title = new HTMLTag('div', false, false);
     $edit_form_title->createAttribute('class', 'hashover-title');
     $edit_form_title->appendAttribute('class', 'hashover-dashed-title');
     $edit_form_title->innerHTML($edit_comment);
     // Append edit form title to edit form wrapper
     $edit_form->appendChild($edit_form_title);
     // Append default login inputs
     $edit_form->appendChild($this->loginInputs(true, $name, $website));
     // Create label element for comment textarea
     if ($this->setup->usesLabels) {
         $edit_comment_label = new HTMLTag('label', false, false);
         $edit_comment_label->createAttribute('for', 'hashover-edit-comment');
         $edit_comment_label->createAttribute('class', 'hashover-comment-label');
         $edit_comment_label->innerHTML($edit_comment);
         // Add comment label to form element
         $edit_form->appendChild($edit_comment_label);
     }
     // Create edit textarea
     $edit_textarea = new HTMLTag('textarea', false, false);
     $edit_textarea->createAttribute('id', 'hashover-edit-comment');
     $edit_textarea->createAttribute('class', 'hashover-textarea');
     $edit_textarea->appendAttribute('class', 'hashover-edit-textarea');
     $edit_textarea->createAttribute('cols', '62');
     $edit_textarea->createAttribute('name', 'comment');
     $edit_textarea->createAttribute('rows', '10');
     $edit_textarea->createAttribute('title', $this->locales->locale('form_tip', $this->addcslashes));
     $edit_textarea->innerHTML($this->injectVar($body));
     // Add edit textarea element to form element
     $edit_form->appendChild($edit_textarea);
     // Create hidden page title input element
     $edit_page_title_input = new HTMLTag('input', true);
     $edit_page_title_input->createAttribute('type', 'hidden');
     $edit_page_title_input->createAttribute('name', 'title');
     $edit_page_title_input->createAttribute('value', $this->pageTitle);
     // Add hidden page title input element to form element
     $edit_form->appendChild($edit_page_title_input);
     // Create hidden page URL input element
     $edit_page_url_input = new HTMLTag('input', true);
     $edit_page_url_input->createAttribute('type', 'hidden');
     $edit_page_url_input->createAttribute('name', 'url');
     $edit_page_url_input->createAttribute('value', $this->pageURL);
     // Add hidden page title input element to form element
     $edit_form->appendChild($edit_page_url_input);
     // Create hidden comment file input element
     $edit_file_input = new HTMLTag('input', true);
     $edit_file_input->createAttribute('type', 'hidden');
     $edit_file_input->createAttribute('name', 'file');
     $edit_file_input->createAttribute('value', $this->injectVar($file));
     // Add hidden page title input element to form element
     $edit_form->appendChild($edit_file_input);
     // Create wrapper element for edit form buttons
     $edit_form_footer = new HTMLTag('div');
     $edit_form_footer->createAttribute('class', 'hashover-form-footer');
     // Add checkbox label element to edit form buttons wrapper element
     $edit_form_footer->appendChild($this->subscribeLabel($permalink, 'edit', $subscribed));
     // Create wrapper for form buttons
     $edit_form_buttons_wrapper = new HTMLTag('span');
     $edit_form_buttons_wrapper->createAttribute('class', 'hashover-form-buttons');
     // Create "Cancel" link element
     if ($this->setup->usesCancelButtons) {
         $edit_cancel_button = new HTMLTag('a', false, false);
         $edit_cancel_button->createAttribute('href', $this->setup->parsedURL['path']);
         // Add URL queries to link reference
         if (!empty($this->setup->URLQueries)) {
             $edit_cancel_button->appendAttribute('href', '?' . $this->setup->URLQueries, false);
         }
         // Add ID attribute with JavaScript variable single quote break out
         if (!empty($permalink)) {
             $edit_cancel_button->createAttribute('id', 'hashover-edit-cancel-' . $this->injectVar($permalink));
         }
         // Continue with other attibutes
         $edit_cancel_button->appendAttribute('href', '#' . $this->injectVar($permalink), false);
         $edit_cancel_button->createAttribute('class', 'hashover-submit');
         $edit_cancel_button->appendAttribute('class', 'hashover-edit-cancel');
         $edit_cancel_button->createAttribute('title', $cancel_edit);
         $edit_cancel_button->innerHTML($cancel_edit);
         // Add "Cancel" link element to edit form footer element
         $edit_form_buttons_wrapper->appendChild($edit_cancel_button);
     }
     // Create "Post Comment" button element
     $save_edit_button = new HTMLTag('input', true);
     // Add ID attribute with JavaScript variable single quote break out
     if (!empty($permalink)) {
         $save_edit_button->createAttribute('id', 'hashover-edit-post-' . $this->injectVar($permalink));
     }
     // Continue with other attibutes
     $save_edit_button->createAttribute('class', 'hashover-submit');
     $save_edit_button->appendAttribute('class', 'hashover-edit-post');
     $save_edit_button->createAttribute('type', 'submit');
     $save_edit_button->createAttribute('name', 'edit');
     $save_edit_button->createAttribute('value', $save_edit);
     $save_edit_button->createAttribute('title', $save_edit);
     // Add "Save Edit" element to edit form footer element
     $edit_form_buttons_wrapper->appendChild($save_edit_button);
     // Create "Delete" button element
     $delete_button = new HTMLTag('input', true);
     // Add ID attribute with JavaScript variable single quote break out
     if (!empty($permalink)) {
         $delete_button->createAttribute('id', 'hashover-edit-delete-' . $this->injectVar($permalink));
     }
     // Continue with other attibutes
     $delete_button->createAttribute('class', 'hashover-submit');
     $delete_button->appendAttribute('class', 'hashover-edit-delete');
     $delete_button->createAttribute('type', 'submit');
     $delete_button->createAttribute('name', 'delete');
     $delete_button->createAttribute('value', $delete_comment);
     $delete_button->createAttribute('title', $delete_comment);
     // Add "Delete" element to edit form footer element
     $edit_form_buttons_wrapper->appendChild($delete_button);
     // Add edit form buttons wrapper to edit form footer element
     $edit_form_footer->appendChild($edit_form_buttons_wrapper);
     // Add form buttons to edit form element
     $edit_form->appendChild($edit_form_footer);
     return $edit_form->innerHTML;
 }
Esempio n. 7
0
function redirectToReferer($time = 0)
{
    //echo "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
    //echo "<br>";
    //echo $_SERVER["HTTP_REFERER"];
    if ("http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] == $_SERVER["HTTP_REFERER"] || $_SERVER["HTTP_REFERER"] == null) {
        return redirect("");
        //echo "cuak";
    } else {
        $options = array();
        $options["http-equiv"] = "refresh";
        $options["content"] = $time . "; URL=" . $_SERVER["HTTP_REFERER"];
        $meta = new HTMLTag("meta", $options);
        return $meta->build();
    }
}
Esempio n. 8
0
 public function editForm($permalink, $file, $name = '', $website = '', $body, $status = '', $subscribed = true)
 {
     // "Edit Comment" locale string
     $edit_comment = $this->locales->locale('edit-comment', $this->addcslashes);
     // "Save Edit" locale string
     $save_edit = $this->locales->locale('save-edit', $this->addcslashes);
     // "Cancel" locale string
     $cancel_edit = $this->locales->locale('cancel', $this->addcslashes);
     // "Delete" locale string
     $delete_comment = $this->locales->locale('delete', $this->addcslashes);
     // Create wrapper element
     $edit_form = new HTMLTag('div');
     // Create edit form title element
     $edit_form_title = new HTMLTag('div', false, false);
     $edit_form_title->createAttribute('class', 'hashover-title');
     $edit_form_title->appendAttribute('class', 'hashover-dashed-title');
     $edit_form_title->innerHTML($edit_comment);
     if ($this->login->userIsAdmin === true) {
         // Create status dropdown wrapper element
         $edit_status_wrapper = new HTMLTag('span', false, false);
         $edit_status_wrapper->createAttribute('class', 'hashover-edit-status');
         $edit_status_wrapper->innerHTML('Status');
         // Create select wrapper element
         $edit_status_select_wrapper = new HTMLTag('span', false, false);
         $edit_status_select_wrapper->createAttribute('class', 'hashover-select-wrapper');
         // Status dropdown menu options
         $status_options = array('approved' => $this->locales->locale('status-approved', $this->addcslashes), 'pending' => $this->locales->locale('status-pending', $this->addcslashes), 'deleted' => $this->locales->locale('status-deleted', $this->addcslashes));
         // Create status dropdown menu element
         $edit_status_dropdown = new HTMLTag('select');
         $edit_status_dropdown->createAttribute('id', 'hashover-edit-status-' . $this->injectVar($permalink));
         $edit_status_dropdown->createAttribute('name', 'status');
         $edit_status_dropdown->createAttribute('size', '1');
         foreach ($status_options as $value => $inner_html) {
             // Create status dropdown menu option element
             $edit_status_option = new HTMLTag('option');
             $edit_status_option->createAttribute('value', $value);
             $edit_status_option->innerHTML($inner_html);
             // Set option as selected if it matches the comment status given
             if ($value === $status) {
                 $edit_status_option->createAttribute('selected', 'true');
             }
             // Add option element to status dropdown menu
             $edit_status_dropdown->appendChild($edit_status_option);
         }
         // Add status dropdown menu to select wrapper element
         $edit_status_select_wrapper->appendChild($edit_status_dropdown);
         // Add select wrapper to status dropdown wrapper element
         $edit_status_wrapper->appendChild($edit_status_select_wrapper);
         // Add status dropdown wrapper to edit form title element
         $edit_form_title->appendChild($edit_status_wrapper);
     }
     // Append edit form title to edit form wrapper
     $edit_form->appendChild($edit_form_title);
     // Append default login inputs
     $edit_form->appendChild($this->loginInputs(true, $name, $website));
     // Create label element for comment textarea
     if ($this->setup->usesLabels === true) {
         $edit_comment_label = new HTMLTag('label', false, false);
         $edit_comment_label->createAttribute('for', 'hashover-edit-comment');
         $edit_comment_label->createAttribute('class', 'hashover-comment-label');
         $edit_comment_label->innerHTML($edit_comment);
         // Add comment label to form element
         $edit_form->appendChild($edit_comment_label);
     }
     // Create edit textarea
     $edit_textarea = new HTMLTag('textarea', false, false);
     $edit_textarea->createAttribute('id', 'hashover-edit-comment');
     $edit_textarea->createAttribute('class', 'hashover-textarea');
     $edit_textarea->appendAttribute('class', 'hashover-edit-textarea');
     $edit_textarea->createAttribute('cols', '62');
     $edit_textarea->createAttribute('name', 'comment');
     $edit_textarea->createAttribute('rows', '10');
     $edit_textarea->createAttribute('title', $this->locales->locale('form-tip', $this->addcslashes));
     $edit_textarea->innerHTML($this->injectVar($body));
     // Add edit textarea element to form element
     $edit_form->appendChild($edit_textarea);
     // Create hidden page title input element
     $edit_page_title_input = new HTMLTag('input', true);
     $edit_page_title_input->createAttribute('type', 'hidden');
     $edit_page_title_input->createAttribute('name', 'title');
     $edit_page_title_input->createAttribute('value', $this->pageTitle);
     // Add hidden page title input element to form element
     $edit_form->appendChild($edit_page_title_input);
     // Create hidden page URL input element
     $edit_page_url_input = new HTMLTag('input', true);
     $edit_page_url_input->createAttribute('type', 'hidden');
     $edit_page_url_input->createAttribute('name', 'url');
     $edit_page_url_input->createAttribute('value', $this->pageURL);
     // Add hidden page title input element to form element
     $edit_form->appendChild($edit_page_url_input);
     // Create hidden comment file input element
     $edit_file_input = new HTMLTag('input', true);
     $edit_file_input->createAttribute('type', 'hidden');
     $edit_file_input->createAttribute('name', 'file');
     $edit_file_input->createAttribute('value', $this->injectVar($file));
     // Add hidden page title input element to form element
     $edit_form->appendChild($edit_file_input);
     // Create element for various messages when needed
     $edit_message = new HTMLTag('div');
     $edit_message->createAttribute('id', 'hashover-edit-message-' . $this->injectVar($permalink));
     $edit_message->createAttribute('class', 'hashover-message');
     // Add message element to edit form element
     $edit_form->appendChild($edit_message);
     // Create wrapper element for edit form buttons
     $edit_form_footer = new HTMLTag('div');
     $edit_form_footer->createAttribute('class', 'hashover-form-footer');
     // Add checkbox label element to edit form buttons wrapper element
     if ($this->setup->fieldOptions['email'] !== false) {
         $edit_form_footer->appendChild($this->subscribeLabel($permalink, 'edit', $subscribed));
     }
     // Create wrapper for form buttons
     $edit_form_buttons_wrapper = new HTMLTag('span');
     $edit_form_buttons_wrapper->createAttribute('class', 'hashover-form-buttons');
     // Create "Cancel" link element
     if ($this->setup->usesCancelButtons === true) {
         $edit_cancel_button = new HTMLTag('a', false, false);
         $edit_cancel_button->createAttribute('href', $this->setup->filePath);
         // Add URL queries to link reference
         if (!empty($this->setup->URLQueries)) {
             $edit_cancel_button->appendAttribute('href', '?' . $this->setup->URLQueries, false);
         }
         // Add ID attribute with JavaScript variable single quote break out
         if (!empty($permalink)) {
             $edit_cancel_button->createAttribute('id', 'hashover-edit-cancel-' . $this->injectVar($permalink));
         }
         // Continue with other attributes
         $edit_cancel_button->appendAttribute('href', '#' . $this->injectVar($permalink), false);
         $edit_cancel_button->createAttribute('class', 'hashover-submit');
         $edit_cancel_button->appendAttribute('class', 'hashover-edit-cancel');
         $edit_cancel_button->createAttribute('title', $cancel_edit);
         $edit_cancel_button->innerHTML($cancel_edit);
         // Add "Cancel" link element to edit form footer element
         $edit_form_buttons_wrapper->appendChild($edit_cancel_button);
     }
     // Create "Post Comment" button element
     $save_edit_button = new HTMLTag('input', true);
     // Add ID attribute with JavaScript variable single quote break out
     if (!empty($permalink)) {
         $save_edit_button->createAttribute('id', 'hashover-edit-post-' . $this->injectVar($permalink));
     }
     // Continue with other attributes
     $save_edit_button->createAttribute('class', 'hashover-submit');
     $save_edit_button->appendAttribute('class', 'hashover-edit-post');
     $save_edit_button->createAttribute('type', 'submit');
     $save_edit_button->createAttribute('name', 'edit');
     $save_edit_button->createAttribute('value', $save_edit);
     $save_edit_button->createAttribute('title', $save_edit);
     // Add "Save Edit" element to edit form footer element
     $edit_form_buttons_wrapper->appendChild($save_edit_button);
     // Create "Delete" button element
     $delete_button = new HTMLTag('input', true);
     // Add ID attribute with JavaScript variable single quote break out
     if (!empty($permalink)) {
         $delete_button->createAttribute('id', 'hashover-edit-delete-' . $this->injectVar($permalink));
     }
     // Continue with other attributes
     $delete_button->createAttribute('class', 'hashover-submit');
     $delete_button->appendAttribute('class', 'hashover-edit-delete');
     $delete_button->createAttribute('type', 'submit');
     $delete_button->createAttribute('name', 'delete');
     $delete_button->createAttribute('value', $delete_comment);
     $delete_button->createAttribute('title', $delete_comment);
     // Add "Delete" element to edit form footer element
     $edit_form_buttons_wrapper->appendChild($delete_button);
     // Add edit form buttons wrapper to edit form footer element
     $edit_form_footer->appendChild($edit_form_buttons_wrapper);
     // Add form buttons to edit form element
     $edit_form->appendChild($edit_form_footer);
     return $edit_form->innerHTML;
 }
Esempio n. 9
0
 public function __construct($tagname)
 {
     parent::__construct($tagname);
 }
Esempio n. 10
0
<body>
<?php 
require_once 'Poker.class.php';
$D = new Deck();
$Table = new Hand();
foreach (range(1, 5) as $i) {
    $Table->add($D->draw());
}
$players = range(1, 5);
foreach ($players as $k => $v) {
    $hole = new Hand();
    $hole->add($D->draw());
    $hole->add($D->draw());
    $players[$k] = $hole;
}
$center = new HTMLTag("center", $Table->show());
echo $center->parse();
echo "\n<hr />\n";
$full = array();
$WIN = Poker::rankHands($Table, $players, $full);
echo "<h2>" . intval(count($WIN)) . " winner(s)</h2>\n\n";
foreach ($players as $i => $h) {
    $out = Tpl::string('<div class="container{WINNER}">{HAND}<br />{EVAL}</div>');
    $win = in_array($i, $WIN);
    $out->setAttribs(array('WINNER' => $win ? ' winner' : '', 'HAND' => $h->show(), 'EVAL' => $full[$i]->rankName() . "<br />" . $full[$i]->printRun()));
    echo $out->parse();
}
?>
</body>
</html>
Esempio n. 11
0
 public function __construct($tagname, $content = '')
 {
     parent::__construct($tagname);
     $this->set_content($content);
 }
 function __construct($d = null, $nameSpace, $name, $attrs = array()) {
   parent::__construct(null, $nameSpace, $name, $attrs);
   $this->setDocument($d);
 }
 /**
  * This method will rewind the iterable for possible later reuse
  * @since 1.2.0.Beta
  */
 function onClose() {
   if($this->iterable instanceof Iterable) {
     $this->iterable->reset();
   }
   parent::onClose();
 }
 function onOpen() {
   $this->removeAll();
   
   $key = $this->getAttribute('name');
   $fld = $this->getDocument()->getVariable($key);
   $this->setName('input');
   
   if($fld instanceof TextInputField) {
     if($fld->getType() == TextInputField::TEXTAREA) {
       $this->setName('textarea');
       $this->addNode(new HTMLTextNode($this, htmlSpecialChars($fld->getValue(), ENT_QUOTES, 'UTF-8')));
     } else {
       $this->setAttribute('type', $fld->getType() == TextInputField::TEXT ? 'text' : 'password');
       $this->setAttribute('value', htmlSpecialChars($fld->getValue(), ENT_QUOTES, 'UTF-8'));
       // $this->setAttribute('value', $fld->getValue());
     }
   } elseif($fld instanceof CheckBoxInputField) {
     $this->setAttribute('type', 'checkbox');
     $this->setAttribute('value', '1');
     if($fld->getValue()) {
       $this->setAttribute('checked', 'true');
     }
     $t = new HTMLTag($this, 'input', array());
     $t->setAttribute('value', '');
     $t->setAttribute('type', 'hidden');
     $t->setAttribute('name', $key);
     $this->getDocument()->process($t);  
   } elseif($fld instanceof SelectInputField) {
     $this->setName('select');
     $this->setAttribute('size', '1');
     
     if($e = $fld->getEmpty()) {
       $t = new HTMLTag($this, 'option', array());
       $t->setAttribute('value', '');
       $t->addNode($tn = new HTMLTextNode($this, htmlSpecialChars($e, ENT_QUOTES, 'UTF-8')));
       $this->addNode($t);
     }
       
     foreach($fld->getData() as $k=>$v) {
       $t = new HTMLTag($this, 'option', array());
       $t->setAttribute('value', htmlSpecialChars($k, ENT_QUOTES, 'UTF-8'));
       if($fld->getValue() == $k) {
         $t->setAttribute('selected', 'true');
       }
       $t->addNode($tn = new HTMLTextNode($this, $v));
       $this->addNode($t);
     }
   } elseif($fld instanceof UploadFileInputField) {
     $this->setAttribute('type', 'file');
   } elseif($fld instanceof RadioButtonInputField) {
     $this->setAttribute('type', 'radio');
     $this->setAttribute('value', htmlSpecialChars($v = $fld->getNextValue(), ENT_QUOTES, 'UTF-8'));
     if($v == $fld->getValue()) {
       $this->setAttribute('checked', 'true');
     }
   } else {
     return self::SKIP_BODY;
   }
       
   return self::PROCESS_BODY;
 }
  function onOpen() {
    $this->wml = $this->getDocument() instanceof WMLDocument;
    
    if(!$this->key) {
      $this->key = $this->getAttribute('key');
      $this->removeAttribute('key');
    }
    
    $this->form = $this->getDocument()->getVariable($this->key);
    if(is_null($this->form)) {
      return self::SKIP_BODY;
    }
    
    $this->parameters = new HTMLTag($this, 'div', array());
    $this->parameters->setExposed(false);
    
    if($this->ifError = $this->getTagByName('iferror')) {
      $this->ifError->setExposed(false);
    }
    if($this->ifInputErrors = $this->getTagByName('ifinputerrors')) {
      $this->ifInputErrors->setExposed(false);
    }
    
    if($this->wml) {
      $this->setName('fieldset');
      $this->action->name = 'postfield';
      $do = new HTMLTag($this, 'do', array());
      $do->setAttribute('type', 'Accept');
      $go = new HTMLTag($this, 'go', array());
      $go->setAttribute('href', '?');
      $go->setAttribute('method', $this->form->getMethod() == Request::METHOD_POST ? 'post' : 'get');
      $go->addNode($this->parameters);
      $do->addNode($go);
      $this->addNode($do);
    } else {
      $this->setAttribute('method', $this->form->getMethod() == Request::METHOD_POST ? 'post' : 'get');
      if($this->getAttribute('method') == 'post') {
	       $this->setAttribute('enctype', 'multipart/form-data');
      }
      $this->setName('form');
      $this->setAttribute('action', htmlSpecialChars(Request::$URL, ENT_QUOTES, 'UTF-8')); 
      // Set the HTML4.01 attribute accept-encoding if we generate 4.01 HTML pages
      // !!! Must use version_compare !!!
      if(Package::getPackage($this)->getProperty('html.version') == '4.01') {
        $this->setAttribute('accept-charset', 'UTF-8');
      }
      $this->addNode($this->parameters);
    }
		
    // Pass over parameters
    $pars = $this->form->getParameters();
    
    if($this->wml) {
      foreach(array_keys($this->form->getFields()) as $fname) {
        $pars[$fname] = '$(' . $fname . ')';
      }
    }
    
    $pars['action'] = $this->form->getLocation()->getAction();
    foreach($pars as $k=>$v) {
      $a = new HTMLTag($this, $this->wml ? 'postfield' : 'input', array());
      $a->setAttribute('name', htmlSpecialChars($k, ENT_QUOTES, 'UTF-8'));
      $a->setAttribute('value', htmlSpecialChars($v, ENT_QUOTES, 'UTF-8'));
        
      if(!$this->wml) {
        $a->setAttribute('type', 'hidden');
      }
      $this->parameters->addNode($a);
    }
      
    if($this->ifInputErrors) {
      $this->ifInputErrors->setEnabled(
        $this->form->isSubmitted() && !$this->form->isValid());
    }
      
    return self::PROCESS_BODY;
  } 
Esempio n. 16
0
function textarea_tag($name, $value, $options = array())
{
    if (!array_key_exists("id", $options)) {
        $options["id"] = $name;
    }
    $options["name"] = $name;
    $text = new HTMLTag("textarea", $options, $value);
    return $text->build();
}