コード例 #1
0
 function render()
 {
     $out = array();
     foreach ($this->_forms as $name => $form) {
         if (is_array($form) && isset($form['type'])) {
             list($type, $note) = array($form['type'], $form['note']);
             unset($form['type'], $form['note']);
             if (!$type) {
                 $type = 'text';
             }
             $value = get_option($name);
             if ($value !== false) {
                 $form['value'] = $value;
             }
             $out[] = WpOgp_FormComponent::create($name, $type, $form);
             if ($note) {
                 $out[] = "<span class=\"description\">{$note}</span>";
             }
         } else {
             if (is_string($form)) {
                 $out[] = $form;
             }
         }
     }
     echo implode("\n", $out);
 }
コード例 #2
0
 function tag($name, $text = null, $attributes = array())
 {
     $self =& WpOgp_FormComponent::getInstance();
     if (!is_array($attributes)) {
         $attributes = array('class' => $attributes);
     }
     if ($text === null) {
         $tag = 'tagstart';
     } else {
         $tag = 'tag';
     }
     return sprintf($self->_tags[$tag], $name, $self->_parseAttributes($attributes, null, ' ', ''), $text, $name);
 }