コード例 #1
0
ファイル: Carousel.php プロジェクト: phgamper/markdown_blog
 public function markup(Markup $model, $arg, $bool)
 {
     $tags = $model->parseTags();
     $item = [];
     if (array_key_exists('name', $tags)) {
         $item['name'] = $tags['name'];
         $item['static'] = Config::getInstance()->app_root . $model->config['static'] . '/' . preg_replace('/\\.[^.\\s]{2,4}$/', '', basename($model->config['path']));
     }
     return $item;
 }
コード例 #2
0
ファイル: PreView.php プロジェクト: Stephan123/markdown_blog
 public function markup(Markup $model, $arg)
 {
     $body = '<div class="preview"><div class="text">' . $model->parse($arg) . '</div></div>';
     $body = '<div class="row content-item"><div class="col-md-12">' . $body . '</div></div>';
     if (array_key_exists('static', $model->config) && $model->config['static']) {
         $href = Config::getInstance()->app_root . $model->config['static'] . '/' . preg_replace('/\\.[^.\\s]{2,4}$/', '', basename($model->config['path']));
         // social
         $social = '';
         $general = Config::getInstance()->getGeneralArray('general');
         // TODO description
         if (array_key_exists('social', $general) && $general['social']) {
             $buttons = Social::getInstance()->socialButtons('https://' . $_SERVER['HTTP_HOST'] . $href, Head::getInstance()->getTitle());
             $span = floor(6 / count($buttons));
             foreach ($buttons as $b) {
                 $social .= '<div class="col-xs-2 col-md-' . $span . ' text-center">' . $b . '</div>';
             }
         }
         $static = '<a class="btn" href="' . $href . '">More <i class="fa fa-angle-double-right"></i></a>';
         $body .= '<div class="row socials"><div class="col-md-5"><div class="row">' . $social . '</div></div><div class="col-md-7 text-right">' . $static . '</div></div>';
     }
     return self::head($model->parseTags($model->config['path'])) . $body;
 }
コード例 #3
0
ファイル: Filter.php プロジェクト: phgamper/markdown_blog
 public function markup(Markup $model, $arg, $bool)
 {
     $tags = $model->parseTags();
     foreach ($arg as $key => $value) {
         if (isset($tags[$key])) {
             if (is_array($tags[$key])) {
                 if (in_array($value, $tags[$key])) {
                     continue;
                     // check next criteria
                 }
             } else {
                 if ($tags[$key] == $value) {
                     continue;
                     // check next criteria
                 }
             }
         }
         return false;
         // at least one criteria does not match
     }
     return true;
 }
コード例 #4
0
 public function markup(Markup $model, $arg, $bool)
 {
     // parse head
     $head = '';
     $tags = $model->parseTags();
     if (!empty($tags)) {
         $left = '';
         if (isset($tags['published'])) {
             $left .= $tags['published'];
         }
         if (isset($tags['author'])) {
             $left = $left ? $left . ' | ' . $tags['author'] : $tags['author'];
         }
         $left = $left ? '<div class="col-md-7"><p>' . $left . '</p></div>' : '';
         $right = '';
         if (isset($tags['category'])) {
             $href = Config::getInstance()->app_root . URLs::getInstance()->getURI() . '?' . QueryString::removeAll(['tag', 'page'], $_SERVER['QUERY_STRING']);
             foreach ($tags['category'] as $c) {
                 $right .= ' | <a href="' . $href . '&tag=' . $c . '">#' . trim($c) . '</a>';
                 // $right .= ' | #' . trim($c);
             }
             $right = '<div class="col-md-5 pull-right text-right">' . substr($right, 3) . '</div>';
         }
         $head = $left . $right ? '<div class="row content-head">' . $left . $right . '</div>' : '';
     }
     // parse body
     $body = '<div class="row content-body"><div class="col-md-12">' . $model->parse($arg) . '</div></div>';
     if (array_key_exists('static', $model->config) && $model->config['static']) {
         $href = Config::getInstance()->app_root . URLs::getInstance()->getURI() . '/' . preg_replace('/\\.[^.\\s]{2,4}$/', '', basename($model->config['path']));
         // social
         $social = '';
         $general = Config::getInstance()->getGeneralArray('general');
         // TODO description
         if (array_key_exists('social', $general) && $general['social']) {
             $buttons = Social::getInstance()->socialButtons('https://' . $_SERVER['HTTP_HOST'] . $href, Head::getInstance()->getTitle());
             $span = floor(6 / count($buttons));
             foreach ($buttons as $b) {
                 $social .= '<div class="col-xs-2 col-md-' . $span . ' text-center">' . $b . '</div>';
             }
         }
         $static = '<a class="btn btn-default" href="' . $href . '" role="button">Static <i class="fa fa-share-alt"></i></a>';
         $body .= '<div class="row content-foot"><div class="col-md-5"><div class="row">' . $social . '</div></div><div class="col-md-7 text-right">' . $static . '</div></div>';
     }
     return '<div class="row content-item"><div class="col-md-12">' . $head . $body . '</div></div>';
 }