コード例 #1
0
ファイル: functions.php プロジェクト: netdust/ntdst-project
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'));
    }
}
コード例 #2
0
ファイル: Plugin.php プロジェクト: netdust/ntdst-project
 /**
  * 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>';
     });
 }