Example #1
0
 function get_index($langName = null, $tag = null)
 {
     $text = trim($langName ? __($langName)->get() : $this->viewData('title'));
     $tag or $tag = $langName ? 'h2' : 'h1';
     is_numeric($tag) and $tag = "h{$tag}";
     if ($text === '') {
         return '';
     } else {
         $html = $this->in('html', false) ? $text : HLEx::q($text);
         return compact('tag', 'html');
     }
 }
Example #2
0
 protected function defaultViewDataTo(array &$data)
 {
     $info = $this->config('company');
     // Trying to reverse-map the logo URL to local path. Upon success attach that
     // file to the message as "related" file so it's not visible in the attachment
     // list and can be refered to with special "cid:NAME" prefix (e.g. in src).
     // Unlike remote images attached ones are not hidden by most mail viewers.
     $logoFile = assetPath($info['logo']);
     if ($logoFile) {
         $this->attachRelatedLocal($logoFile, $name = 'head-logo' . S::ext($logoFile));
         $info['logo'] = "cid:{$name}";
     }
     $data['header']['logo'] = Block::execCustom('Vane::logo', array('input' => $info, 'ajax' => false, 'response' => true, 'return' => 'response'))->render();
     $info = array_filter($info, 'is_scalar') + array('l0' => HLEx::tag('a', \URL::to(Current::bundleURL())), 'l1' => '</a>');
     $signature = __('vanemart::general.mail.signature', $info);
     $data['footer']['signature'] = HLEx::p($signature);
 }
Example #3
0
 static function summary($html = false)
 {
     $items = Str::langNum('general.goods', static::count(), $html);
     $sum = Str::langNum('general.price', static::subtotal(), $html);
     if ($html) {
         return HLEx::lang('cart.summary', compact('items', 'sum'), false);
     } else {
         return __('vanemart::cart.summary', compact('items', 'sum'))->get();
     }
 }
Example #4
0
 function openTag()
 {
     if ($this->tag) {
         return "\n" . HLEx::tag($this->tag, $this->tagAttributes());
     }
 }
Example #5
0
<?php

namespace VaneMart;

use Px\Query;
use Vane\Mail;
use Vane\Current;
/*-----------------------------------------------------------------------
| GENERAL LISTENERS
|----------------------------------------------------------------------*/
// Fires to get HTML representation of user message $text (can be used to attach
// BB-code processor, Markdown, wiki, etc.).
//
//= str HTML
Event::listen(VANE_NS . 'format.generic', function (&$text) {
    return nl2br(HLEx::q($text));
});
Event::listen(VANE_NS . 'format.post', function (&$text) {
    return format('generic', $text);
});
Event::listen(VANE_NS . 'format.product', function (&$text) {
    return format('generic', $text);
});
/*-----------------------------------------------------------------------
| FILE MODEL
|----------------------------------------------------------------------*/
// Fired to determine local path for storing File data.
//
//* $path str - can be '' to get root folder's path; guaranteed to be safe (no '..').
//
//= str absolute path
Example #6
0
function htmlLang($string, $replaces = array(), $quote = true)
{
    return HLEx::lang($string, $replaces, $quote);
}
Example #7
0
 function popup()
 {
     return isset($this->popup) ? $this->popup : HLEx::isExternal($this->url);
 }
Example #8
0
 function getStatus($name, $replaces = array())
 {
     \Lang::has($name) or $name = $this->langVarName("ctlstatus.{$name}");
     if (\Lang::has($name)) {
         return HLEx::lang(__($name), $replaces);
     } else {
         Log::warn_Block("Block is missing status language string [{$name}];" . " current action: [{$this->currentAction}].");
     }
 }