Пример #1
0
 function compile($less)
 {
     $path = FCPATH . $less;
     if (file_exists($path)) {
         $path_parts = pathinfo($path);
         $name = $path_parts['filename'];
         if (!file_exists(FCPATH . LESS_COMPILE_DIR)) {
             mkdir(FCPATH . LESS_COMPILE_DIR);
         }
         $dir = basename(dirname($less));
         $out = FCPATH . LESS_COMPILE_DIR . '/' . $dir . '/' . $name . '.css';
         if (!file_exists($out)) {
             if (!file_exists(FCPATH . LESS_COMPILE_DIR . '/' . $dir)) {
                 mkdir(FCPATH . LESS_COMPILE_DIR . '/' . $dir);
             }
             $content = file_get_contents($path);
             $content = '@site_base:"' . site_url('') . "\";\n" . $content;
             $content .= '@fcpath:"' . FCPATH . "\";\n" . $content;
             $this->_compile($path, $content, $out);
         }
         return LESS_COMPILE_DIR . '/' . $dir . '/' . $name . '.css';
     } else {
         ci_error('The less file %s is not exists!', $less);
     }
 }
Пример #2
0
function smarty_function_banner($params, $template)
{
    $src = get_default($params, 'src', null);
    if ($src == null) {
        ci_error(lang_f('The banner\'s attribute src must be set!'));
        return '';
    }
    $params['class'] = make_classes('pinet_banner', get_default($params, 'class', null));
    $height = get_default($params, 'height', null);
    if ($height != null) {
        $params['style'] .= 'height:' . $height . ';';
    }
    return create_tag('div', $params, array(), '');
}
Пример #3
0
function smarty_function_iframe($params, $template)
{
    $src = get_default($params, 'src', null);
    if (!$src) {
        ci_error('The src attribute must be set for iframe.');
        return '';
    }
    $src = site_url($src);
    $lazy = get_default($params, 'lazy', false);
    $class = $lazy ? 'iframe-lazy' : 'iframe';
    $params['class'] = make_classes($class, get_default($params, 'class'));
    if ($lazy) {
        $params['data-src'] = $src;
        unset($params['src']);
    }
    return create_tag('iframe', $params, array(), '');
}
Пример #4
0
 public function __construct()
 {
     $this->key_path = get_ci_config('encryptor_key', FCPATH . APPPATH . 'config/encrypt.key');
     $this->public_key_path = get_ci_config('encryptor_public_key', FCPATH . APPPATH . 'config/encrypt_public.key');
     if (file_exists($this->key_path)) {
         ci_log('Loading the private key file from %s', $this->key_path);
         $this->key = file_get_contents($this->key_path);
     } else {
         ci_error('Can\'t find private key file at %s', $this->key_path);
     }
     if (file_exists($this->public_key_path)) {
         ci_log('Loading the public key file from %s', $this->public_key_path);
         $this->public_key = file_get_contents($this->public_key_path);
     } else {
         ci_error('Can\'t find public key file at %s', $this->key_path);
     }
 }
Пример #5
0
 public function addMixin($mixin)
 {
     if (!(is_object($mixin) && is_subclass_of($mixin, 'Mixin'))) {
         ci_error('Must be subclass of Mixin', $mixin);
         return;
     }
     foreach ($mixin->_propertyNames() as $name) {
         $this->__e_propertyMap[$name] = $mixin;
         $mixin->entity = $this;
     }
 }