/**
  * Constructor
  *
  * @param Request $request
  * @return MobileAccessController extends ApplicationController 
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->mobile_device = mobile_access_module_get_compatible_device(USER_AGENT);
     $this->setLayout(array('module' => MOBILE_ACCESS_MODULE, 'layout' => 'wireframe'));
     // assign variables to smarty
     $this->smarty->assign(array("mobile_device" => $this->mobile_device, "module_assets_url" => get_asset_url('modules/' . $this->active_module)));
 }
Example #2
0
 function __init()
 {
     $this->load->config('wyvern');
     $this->load->config('wyvern_admin');
     define('THEME_PATH', $this->config->item('theme_path') . $this->config->item('theme') . "/");
     define('ADMIN_THEME_PATH', $this->config->item('theme_path') . $this->config->item('theme') . "/admin/");
     define('ASSETS_PATH', $this->config->item('assets_path') . $this->config->item('theme') . "/");
     define('ADMIN_ASSETS_PATH', $this->config->item('assets_path') . $this->config->item('theme') . "/admin/");
     $this->data['theme_logo'] = ASSETS_PATH . 'images/' . $this->config->item('logo_default');
     $this->data['js'] = get_asset_url($this->config->item('theme_js'));
     $this->data['css'] = get_asset_url($this->config->item('theme_css'));
     $this->data['fonts'] = get_asset_url($this->config->item('theme_fonts'));
     $this->data['admin_js'] = get_admin_asset_url($this->config->item('admin_theme_js'));
     $this->data['admin_css'] = get_admin_asset_url($this->config->item('admin_theme_css'));
     $this->data['admin_fonts'] = get_admin_asset_url($this->config->item('admin_theme_fonts'));
     /* Load Modules */
     $this->load->spark('ion_auth/2.5.0');
 }
Example #3
0
function get_asset($file)
{
    //  Allow calling as an array
    //  {{ get_asset(['test.jpg', 'lol.css']) }}
    if (is_array($file)) {
        foreach ($file as $item) {
            get_asset($item);
        }
        return;
    }
    //  Store an array of file types so we know what we're
    //  going to be comparing against. HTML::{type} gets called.
    $types = ['js' => 'script', 'css' => 'style', 'img' => 'image'];
    //  Get our URL and file type to match $types
    $info = get_asset_url($file, true);
    //  Get our arguments and replace the first one with the right URL
    $args = func_get_args();
    $args[0] = $info['url'];
    //  Call HTML::{$type} with our arguments
    return call_user_func_array('HTML::' . $types[$info['type']], $args);
}
/**
 * Return asset URL
 * 
 * Params:
 * 
 * - name - resource path relative to assets folder
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_asset_url($params, &$smarty)
{
    $name = array_var($params, 'name');
    return get_asset_url($name, array_var($params, 'module'));
}
/**
 * Render HTML editor
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_editor_field($params, $content, &$smarty, &$repeat)
{
    static $ids = array(), $files_included = false;
    // if browser is ipad, we need to turn visual editor off
    if (USER_AGENT == USER_AGENT_IPAD) {
        $visual = false;
    } else {
        if (isset($params['visual'])) {
            $visual = array_var($params, 'visual', true, true);
        } else {
            $logged_user = $smarty->get_template_vars('logged_user');
            if (instance_of($logged_user, 'User')) {
                $visual = UserConfigOptions::getValue('visual_editor', $logged_user);
                // if user is loaded $visual is set dependable of user config option
            } else {
                $visual = true;
            }
            // if
        }
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        $counter = 1;
        do {
            $id = "visual_editor_{$counter}";
            $counter++;
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    $params['id'] = $id;
    //$hide_editor = array_var($params, 'hide_editor');
    //if (empty($hide_editor)){
    $params['mce_editable'] = true;
    //}
    if (!isset($params['auto_expand'])) {
        $params['auto_expand'] = 'yes';
    }
    // if
    if ($visual && !$files_included) {
        $page =& PageConstruction::instance();
        $disable_image_upload = array_var($params, 'disable_image_upload', false);
        $page->addScript(get_asset_url('javascript/tinymce/tiny_mce.js'), false);
        $page->addScript(get_asset_url('javascript/tinymce/tiny_mce_init.js'), false);
        echo "<script type='text/javascript'>";
        if ($disable_image_upload) {
            echo "App.widgets.EditorImagePicker.disable_image_upload = true;";
        }
        // if
        echo "</script>";
        $files_included = true;
    }
    // if
    if (isset($params['class'])) {
        $classes = explode(' ', $params['class']);
        $classes[] = 'editor';
        if (in_array('tiny_value_present', $classes) && !$visual) {
            $classes[] = 'required';
        }
        // if
        $params['class'] = implode(' ', $classes);
    } else {
        $params['class'] = 'editor';
    }
    // if
    $return_string = '';
    if (!($variable_name = array_var($params, 'variable_name'))) {
        $name_parameter = array_var($params, 'name');
        $variable_name = substr($name_parameter, 0, strrpos($name_parameter, '['));
    }
    // if
    $variable_name .= '[inline_attachments][]';
    $inline_attachments = array_var($params, 'inline_attachments');
    if (is_foreachable($inline_attachments)) {
        foreach ($inline_attachments as $inline_attachment) {
            $return_string .= '<input type=hidden name="' . $variable_name . '" value="' . $inline_attachment . '" />' . "\n";
        }
        // foreach
    }
    // if
    unset($params['inline_attachments']);
    unset($params['variable_name']);
    $params['inline_attachments_name'] = $variable_name;
    $return_string .= open_html_tag('textarea', $params) . clean($content) . '</textarea>';
    return $return_string;
}