Пример #1
0
 protected function getValueAttr()
 {
     switch (classUnqualified(get_class($this))) {
         case 'Input':
             $type = 'text';
             break;
         case 'Textarea':
             $type = 'textarea';
             break;
         case 'Checkbox':
             $type = 'checkbox';
             break;
         case 'Radio':
             $type = 'radio';
             break;
         case 'Select':
             $type = 'select';
             break;
     }
     $value = stringIndex($_POST, $this->name);
     if ($value != '__UNSET_ELEMENT' && $value !== '') {
         return formState($type, uh($value), isset($this->compare_value) ? $this->compare_value : null);
     } else {
         if ($this->default_value !== '') {
             return formState($type, uh($this->default_value), isset($this->compare_value) ? $this->compare_value : null);
         }
     }
 }
Пример #2
0
  <p class="form-control-group">
    <label>
      <input type="checkbox" name="<?php 
echo $name;
?>
" value="<?php 
echo uh($compare_value);
?>
"<?php 
echo $attributes . $value_attribute;
?>
 />
      <?php 
echo $label . PHP_EOL;
?>
    </label>
    <?php 
echo $errors_html . PHP_EOL;
?>
  </p>
Пример #3
0
  <div class="js-booya-flash flash-container">
<?php 
foreach ($flash as $flash_type => $flash_messages) {
    ?>
    <ul class="flash-messages flash-<?php 
    echo $flash_type;
    ?>
">
<?php 
    foreach ($flash_messages as $flash_message) {
        ?>
      <li><?php 
        echo uh($flash_message);
        ?>
</li>
<?php 
    }
    ?>
    </ul>
<?php 
}
?>
  </div>
Пример #4
0
 public function paginationLinks($target_id = '')
 {
     $base_href = $this->url . '?';
     $prev_page = $this->current_page > 1 ? $this->current_page - 1 : 1;
     $next_page = $this->current_page < $this->num_pages ? $this->current_page + 1 : $this->num_pages;
     $target_id = $target_id == '' ? '' : ' data-target="' . $target_id . '"';
     $html = '<a' . ($this->current_page > 1 ? ' href="' . $base_href . uh($this->queryString($prev_page)) . '"' : '') . $target_id . ' class="pagination-link' . ($this->current_page === 1 ? ' is-disabled' : '') . '">«</a>' . PHP_EOL;
     $pages = array();
     // Link to page 1 should always be there
     $pages[] = 1;
     // Maximum of 5 pages in between first and last page
     if ($this->num_pages > 2) {
         $min_page = max(2, $this->current_page - 2);
         $max_page = min($this->current_page + 2, $this->num_pages - 1);
         $pages = array_merge($pages, range($min_page, $max_page));
     }
     // Link to last page should always be there (if more than 1 page)
     if ($this->num_pages > 1) {
         $pages[] = $this->num_pages;
     }
     $html_jump = '<span class="pagination-jump">...</span>' . PHP_EOL;
     $prev_page = 1;
     foreach ($pages as $page) {
         if ($page - $prev_page > 1) {
             $html .= $html_jump;
         }
         $html .= '<a href="' . $base_href . uh($this->queryString($page)) . '"' . $target_id . ' class="pagination-link' . ($page == $this->current_page ? ' is-current' : '') . '">' . $page . '</a>' . PHP_EOL;
         $prev_page = $page;
     }
     if ($page - $prev_page > 1) {
         $html .= $html_jump;
     }
     $html .= '<a' . ($this->current_page < $this->num_pages ? ' href="' . $base_href . uh($this->queryString($next_page)) . '"' : '') . $target_id . ' class="pagination-link' . ($this->current_page == $this->num_pages || $this->num_pages == 0 ? ' is-disabled' : '') . '">»</a>' . PHP_EOL;
     return $html;
 }
Пример #5
0
echo $name;
?>
" id="<?php 
echo $form_name . '_' . $flat_name;
?>
"<?php 
echo $attributes;
?>
>
<?php 
foreach ($options as $value => $text) {
    ?>
      <option value="<?php 
    echo uh($value);
    ?>
"<?php 
    formStatePost($name, 'select', $value, $default_value);
    ?>
><?php 
    echo uh($text);
    ?>
</option>
<?php 
}
?>
    </select>
    <?php 
echo $errors_html . PHP_EOL;
?>
  </p>
Пример #6
0
    ?>
</dd>
    <dt><?php 
    echo __('Fil');
    ?>
:</dt>
    <dd><?php 
    echo uh($file);
    ?>
</dd>
    <dt><?php 
    echo __('Rad');
    ?>
:</dt>
    <dd><?php 
    echo uh($line);
    ?>
</dd>
<?php 
    if (isset($backtrace)) {
        ?>
    <pre>
    <?php 
        var_dump($backtrace);
        ?>
    </pre>
<?php 
    }
}
?>
  </dl>
Пример #7
0
  <p class="form-control-group">
    <span class="form-radio-label"><?php 
echo $label;
?>
</span>
<?php 
foreach ($options as $value => $text) {
    ?>
    <label>
      <input type="radio" name="<?php 
    echo $name;
    ?>
" value="<?php 
    echo uh($value);
    ?>
"<?php 
    formStatePost($name, 'radio', $value, $default_value);
    ?>
>
      <?php 
    echo uh($text) . PHP_EOL;
    ?>
    </label>
<?php 
}
?>
    <?php 
echo $errors_html . PHP_EOL;
?>
  </p>
Пример #8
0
 function http_response_code($code = NULL)
 {
     if ($code !== NULL) {
         switch ($code) {
             case 100:
                 $text = 'Continue';
                 break;
             case 101:
                 $text = 'Switching Protocols';
                 break;
             case 200:
                 $text = 'OK';
                 break;
             case 201:
                 $text = 'Created';
                 break;
             case 202:
                 $text = 'Accepted';
                 break;
             case 203:
                 $text = 'Non-Authoritative Information';
                 break;
             case 204:
                 $text = 'No Content';
                 break;
             case 205:
                 $text = 'Reset Content';
                 break;
             case 206:
                 $text = 'Partial Content';
                 break;
             case 300:
                 $text = 'Multiple Choices';
                 break;
             case 301:
                 $text = 'Moved Permanently';
                 break;
             case 302:
                 $text = 'Moved Temporarily';
                 break;
             case 303:
                 $text = 'See Other';
                 break;
             case 304:
                 $text = 'Not Modified';
                 break;
             case 305:
                 $text = 'Use Proxy';
                 break;
             case 400:
                 $text = 'Bad Request';
                 break;
             case 401:
                 $text = 'Unauthorized';
                 break;
             case 402:
                 $text = 'Payment Required';
                 break;
             case 403:
                 $text = 'Forbidden';
                 break;
             case 404:
                 $text = 'Not Found';
                 break;
             case 405:
                 $text = 'Method Not Allowed';
                 break;
             case 406:
                 $text = 'Not Acceptable';
                 break;
             case 407:
                 $text = 'Proxy Authentication Required';
                 break;
             case 408:
                 $text = 'Request Time-out';
                 break;
             case 409:
                 $text = 'Conflict';
                 break;
             case 410:
                 $text = 'Gone';
                 break;
             case 411:
                 $text = 'Length Required';
                 break;
             case 412:
                 $text = 'Precondition Failed';
                 break;
             case 413:
                 $text = 'Request Entity Too Large';
                 break;
             case 414:
                 $text = 'Request-URI Too Large';
                 break;
             case 415:
                 $text = 'Unsupported Media Type';
                 break;
             case 500:
                 $text = 'Internal Server Error';
                 break;
             case 501:
                 $text = 'Not Implemented';
                 break;
             case 502:
                 $text = 'Bad Gateway';
                 break;
             case 503:
                 $text = 'Service Unavailable';
                 break;
             case 504:
                 $text = 'Gateway Time-out';
                 break;
             case 505:
                 $text = 'HTTP Version not supported';
                 break;
             default:
                 exit('Unknown http status code "' . uh($code) . '"');
                 break;
         }
         $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
         header($protocol . ' ' . $code . ' ' . $text);
         $GLOBALS['http_response_code'] = $code;
     } else {
         $code = isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200;
     }
     return $code;
 }
Пример #9
0
<!DOCTYPE html>
<meta charset="utf-8" />
<?php 
if (isset($title)) {
    ?>
<title><?php 
    echo uh($title);
    ?>
</title>
<?php 
}
?>
<base href="<?php 
echo $app->config('appurl');
?>
" />

<?php 
include 'flash.php';