Example #1
0
 public static function run(array $parameters, $content, &$smarty, &$repeat)
 {
     if ($repeat === true) {
         return;
         // 閉じタグでのみ実行
     }
     $form = $parameters['form'];
     if (self::_isFormObject($form) === false) {
         return false;
     }
     $defaultParameters = self::$parameters;
     $defaultParameters['id'] = $form->getName();
     $parameters = array_merge($defaultParameters, $parameters);
     unset($parameters['form']);
     $attributes = Pengin_TextFilter::buildAttributeString($parameters);
     if ($form->checksXSRF() === true) {
         $key = $form->getTransactionKey();
         $keyName = $form->getTransactionKeyName();
         $tokenTag = '<input type="hidden" name="%s" value="%s" />';
         $tokenTag = sprintf($tokenTag, $keyName, $key);
         $content = $tokenTag . $content;
     }
     if ($form->preventsDoubleSubmission() === true) {
         $content .= self::_getJavaScriptPreventingDoubleSubmission($parameters);
     }
     $formTag = '<form action="%s" method="%s"%s>%s</form>';
     $formTag = sprintf($formTag, $form->getAction(), $form->getMethod(), $attributes, $content);
     return $formTag;
 }
Example #2
0
 public static function render(array $parameters = array())
 {
     $template = '<textarea%s>%s</textarea>';
     $contents = self::_shiftParameter('value', $parameters, '');
     $contents = htmlspecialchars($contents, ENT_QUOTES);
     $attributes = Pengin_TextFilter::buildAttributeString($parameters);
     return sprintf($template, $attributes, $contents);
 }
Example #3
0
 protected static function _renderOptions(array $options, $selected = null)
 {
     $template = '<option%s>%s</option>';
     $optionTag = '';
     foreach ($options as $key => $value) {
         $parameters = array('value' => $key);
         if ($key == $selected) {
             $parameters['selected'] = 'selected';
         }
         $attributes = Pengin_TextFilter::buildAttributeString($parameters);
         $contents = htmlspecialchars($value, ENT_QUOTES);
         $optionTag .= sprintf($template, $attributes, $contents);
     }
     return $optionTag;
 }
Example #4
0
 protected static function _renderInputs(array $defaultParameters, array $options, $checked, $separator)
 {
     $template = '<label><input%s />%s</label>';
     $inputTags = array();
     foreach ($options as $key => $value) {
         $parameters = $defaultParameters;
         $parameters['value'] = $key;
         if ($key == $checked) {
             $parameters['checked'] = 'checked';
         }
         $attributes = Pengin_TextFilter::buildAttributeString($parameters);
         $contents = htmlspecialchars($value, ENT_QUOTES);
         $inputTags[] = sprintf($template, $attributes, $contents);
     }
     $inputTags = implode($separator, $inputTags);
     return $inputTags;
 }
Example #5
0
 public static function render(array $parameters = array())
 {
     $template = '<input%s />';
     $parameters = Pengin_TextFilter::buildAttributeString($parameters);
     return sprintf($template, $parameters);
 }
 protected function _escapeHtml()
 {
     $this->output = Pengin_TextFilter::escapeHtmlArray($this->output);
 }