Ejemplo n.º 1
0
function include_style()
{
    global $app;
    if ($app->getMode() != 'production') {
        echo Html::style(Location::css('build.css'));
        echo Html::style(Location::to('bower_components/components-font-awesome/css/font-awesome.css'));
        echo Html::style(Location::to('bower_components/formstone/dist/css/background.css'));
        echo Html::style(Location::to('bower_components/formstone/dist/css/navigation.css'));
        echo Html::style(Location::to('bower_components/formstone/dist/css/carousel.css'));
        //echo Html::style( Location::to('bower_components/formstone/dist/css/checkbox.css') );
        //echo Html::style( Location::to('bower_components/formstone/dist/css/dropdown.css') );
    } else {
        echo Html::style(Location::css('build.min.css'));
    }
}
Ejemplo n.º 2
0
 public function call()
 {
     $app = Slim::getInstance();
     $this->app->container->singleton(__NAMESPACE__, function () {
         return $this;
     });
     // make them available for other classes */
     $hook = function ($app, $settings) {
         $plugin = $this->app->container->get(__NAMESPACE__);
         return function () use($app, $plugin, $settings) {
             echo $plugin->google($settings->ga, Location::host());
         };
     };
     if (isset($this->settings) && isset($this->settings->ga)) {
         $app->hook('script', $hook($app, $this->settings));
     }
     $this->next->call();
 }
Ejemplo n.º 3
0
 public function call()
 {
     $app = Slim::getInstance();
     $this->app->container->singleton(__NAMESPACE__, function () {
         return $this;
     });
     // make them available for other classes */
     $hook = function ($app) {
         $plugin = $app->container->get(__NAMESPACE__);
         return function () use($app, $plugin) {
             $app->page->sitename = $app->config('site')->sitename;
             $app->page->image = $plugin->search($app->page->parent, 'image');
             $app->page->share = $plugin->search($app->page->parent, 'share');
             $app->page->seo_title = $plugin->search($app->page->parent, 'seo_title');
             $app->page->url = Location::full_url();
             $page = $app->page->get_array();
             $page['image'] = Location::uri($page['image']);
             $meta = $plugin->facebook();
             echo $plugin->replace($page, $meta);
         };
     };
     $script = function ($app) {
         $plugin = $app->container->get(__NAMESPACE__);
         return function () use($app, $plugin) {
             echo $plugin->facebook_embed($this->settings->id);
         };
     };
     $body = function ($app) {
         $plugin = $app->container->get(__NAMESPACE__);
         return function () use($app, $plugin) {
             echo '<div id="fb-root"></div>';
         };
     };
     $app->hook('header', $hook($app));
     if (isset($this->settings) && isset($this->settings->id) && $this->settings->id != '') {
         $app->hook('script', $script($app));
         $app->hook('body', $body($app));
     }
     $app->applyHook('front.plugin.social', $this->settings);
     $this->next->call();
 }
Ejemplo n.º 4
0
 /**
  * init shortcodes
  */
 protected function addShortCodes()
 {
     $handle_args = function ($arg, $cb) {
         $id = isset($arg['id']) ? $arg['id'] : (isset($arg['name']) ? $arg['name'] : '');
         $label = isset($arg['label']) ? $arg['label'] : '';
         $value = isset($arg['value']) ? $arg['value'] : '';
         $required = isset($arg['required']) ? $arg['required'] : false;
         if (isset($arg['label'])) {
             unset($arg['label']);
         }
         return $cb($id, $label, $value, $required, $arg);
     };
     \helpers\Util::register_shortcode('submit', function ($arg) {
         $arg['type'] = 'submit';
         $arg['class'] = 'button ' . (isset($arg['class']) ? $arg['class'] : '');
         return \helpers\html::input('', $arg);
     });
     \helpers\Util::register_shortcode('button', function ($arg) {
         $arg['type'] = 'button';
         return \helpers\html::input('', $arg);
     });
     \helpers\Util::register_shortcode('label', function ($arg) use($handle_args) {
         return $handle_args($arg, function ($id, $label, $value, $required, $arg) {
             return '<label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>';
         });
     });
     \helpers\Util::register_shortcode('text', function ($arg) use($handle_args) {
         $arg['type'] = isset($arg['type']) ? $arg['type'] : 'text';
         return $handle_args($arg, function ($id, $label, $value, $required, $arg) {
             $el = '';
             $el .= '<p class="ui">';
             $el .= '    <label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>';
             $el .= \helpers\html::input($value, $arg);
             $el .= '</p>';
             return $el;
         });
     });
     \helpers\Util::register_shortcode('select', function ($arg) use($handle_args) {
         $options = explode(',', $arg['options']);
         array_walk($options, function (&$v, $k) {
             $v = '<option>' . $v . '</option>';
         });
         return $handle_args($arg, function ($id, $label, $value, $required, $arg) use($options) {
             $el = '';
             $el .= '<p class="ui">';
             $el .= '    <label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>';
             $el .= '    <select name="' . $id . '" id="' . $id . '" required="' . $required . '">' . implode($options) . '</select>';
             $el .= '</p>';
             return $el;
         });
     });
     \helpers\Util::register_shortcode('radio', function ($arg) use($handle_args) {
         $arg['type'] = 'radio';
         return $handle_args($arg, function ($id, $label, $value, $required, $arg) {
             $el = '';
             $el .= '<p class="ui radio">';
             $el .= \helpers\html::input($value, $arg);
             $el .= '    <label for="' . $id . '">' . $label . '</label>';
             $el .= '</p>';
             return $el;
         });
     });
     \helpers\Util::register_shortcode('checkbox', function ($arg) use($handle_args) {
         $arg['type'] = 'checkbox';
         return $handle_args($arg, function ($id, $label, $value, $required, $arg) {
             $el = '';
             $el .= '<p class="ui checkbox">';
             $el .= \helpers\html::input($value, $arg);
             $el .= '    <label for="' . $id . '">' . $label . '</label>';
             $el .= '</p>';
             return $el;
         });
     });
     \helpers\Util::register_shortcode('form', function ($arg) use($handle_args) {
         $form = $this->_actionGetForm($arg['id']);
         return '<form id="form_' . $arg['id'] . '" method="post" action="' . \helpers\Location::to('form/' . $arg['id']) . '">
                     <input type="hidden" name="csrf_key" value="' . $_SESSION['csrf_token'] . '">
                     <input type="hidden" name="form" value="' . $arg['id'] . '">
                     ' . \helpers\Util::parse_shortcode($form['page_translation']['content']) . '
                 </form>';
     });
 }