Beispiel #1
0
 /**
  * Read from a YAML string and create a config object
  *
  * @param  string $string
  * @return ObjectConfigYaml|false   Returns a ObjectConfig object. False on failure.
  * @throws \RuntimeException
  */
 public static function fromString($string)
 {
     $config = false;
     if (function_exist('yaml_parse')) {
         $data = array();
         if (!empty($string)) {
             $data = yaml_parse($string);
             if ($data === false) {
                 throw new \RuntimeException('Cannot parse YAML string');
             }
         }
         $config = new static($data);
     }
     return $config;
 }
 * Date: 2014-10-02
 * Time: 09:24
 */
if (!function_exists('css_url')) {
    function css_url($name)
    {
        return base_url() . 'assets/css/' . $name . '.css';
    }
}
if (!function_exists('js_url')) {
    function js_url($name)
    {
        return base_url() . 'assets/js/' . $name . '.js';
    }
}
if (!function_exist('img_url')) {
    function img_url($name)
    {
        return base_url() . 'assets/img/' . $name;
    }
}
if (!function_exists('img')) {
    function img($name, $alt = 'dummy image', $id = null, $classes = null)
    {
        $html = '<img';
        $html .= !is_null($id) ? ' id="' . $id . '"' : '';
        $html .= !is_null($classes) ? ' class="' . $classes . '"' : '';
        $html .= ' src="' . base_url() . 'assets/img/' . $name . '"';
        $html .= ' alt="' . $alt . '" />';
        return $html;
    }