コード例 #1
0
ファイル: attributeCtrl.php プロジェクト: b3Projekt/website
 function index()
 {
     $attributeModel = $this->loadModel("addattribute_model");
     $result = $attributeModel->getAllAddAttributes();
     if (isset($_POST["addAttribute"])) {
         addAttribute();
     }
     $template = $this->loadView('attributeView');
     $template->set('data', $result);
     $template->render();
 }
コード例 #2
0
ファイル: blogskin.php プロジェクト: webhacking/Textcube
 function applyMF2Entry($type, $content)
 {
     /* This function contains heavy regular expressions, but this function is called once and stored in cache by skin setup logic */
     $bareContent = $this->getTopLevelContent($content);
     $content = preg_replace("/<((br|hr|img)[^>]*)>/sm", "{{{\\1}}}", $content);
     /* hAtom:entry-title */
     $content = addAttributeCore($content, '@(.*?)(<(a|span|textarea|td|h1|h2|h3|strong|cite|font)[^>]*>[^<>]*?\\[##_article_rep_title_##\\].*?</\\3>)(.*)@sm', array('class' => 'entry-title'), array(1, 2, 4), 1);
     if (preg_match('@<(a|span|textarea|td|h1|h2|h3|strong|cite|font)[^>]*?class=[\'"][^\'"]*entry-title[^\'"]*[\'"][^>]*>@sm', $content)) {
         array_push($this->microformatDebug, _text('Microformat-info: 제목에 hAtom용 title을 추가합니다.'));
     } else {
         array_push($this->microformatDebug, _text('Microformat-warn: 제목에 hAtom용 title을 추가하지 못했습니다.'));
     }
     /* hAtom:entry-content */
     $content = addAttributeCore($content, '@(.*?)(<(div|td|span|p)[^>]*>[^<>]*?\\[##_article_rep_desc_##\\].*?</\\3>)(.*)@sm', array('class' => 'entry-content'), array(1, 2, 4), 1);
     if (strstr($bareContent, '[##_article_rep_desc_##]') !== false) {
         $content = str_replace("[##_article_rep_desc_##]", "<div class=\"entry-content\">[##_article_rep_desc_##]</div>", $content);
         array_push($this->microformatDebug, _text('Microformat-info: 본문을 감싸고 있는 태그가 없어 div를 삽입한 뒤 hAtom용 entry-content를 추가합니다.'));
     } else {
         if (preg_match('@<(div|td|span|p)[^>]*?class=[\'"][^\'"]*entry-content[^\'"]*[\'"][^>]*>@sm', $content)) {
             array_push($this->microformatDebug, _text('Microformat-info: hAtom용 content를 추가합니다.'));
         } else {
             array_push($this->microformatDebug, _text('Microformat-warn: hAtom용 content를 추가하지 못했습니다.'));
         }
     }
     /* hAtom:updated, published */
     if (Setting::getBlogSettingGlobal('useMicroformat', 3) > 2) {
         /* Adding published, updated date */
         $content = preg_replace('@(<(div|td|span|p)[^>]*>[^<>]*?\\[##_article_rep_desc_##\\].*?</\\2>)@sm', "\\1\n\t\t\t\t\t<div style=\"display:none\">\n\t\t\t\t\t<abbr class=\"updated\" title=\"[##_article_rep_microformat_updated_##]\">[##_article_rep_date_##]</abbr>\n\t\t\t\t\t<abbr class=\"published\" title=\"[##_article_rep_microformat_published_##]\">[##_article_rep_date_##]</abbr>\n\t\t\t\t\t</div>", $content);
         if (preg_match('@<abbr[^>]*?class=[\'"][^\'"]*\\bupdated\\b[^\'"]*[\'"][^>]*>@sm', $content)) {
             array_push($this->microformatDebug, _text('Microformat-info: hAtom용 발행일(published,updated)을 보이지 않게 추가하였습니다.'));
         } else {
             array_push($this->microformatDebug, _text('Microformat-warn: hAtom용 발행일을 추가하지 못하였습니다.'));
         }
     } else {
         array_push($this->microformatDebug, _text('Microformat-info: 의미상 어긋나는 사용인 hAtom용 발행일(published,updated)을 추가하지 않았습니다.'));
     }
     /* hAtom:author should be a complete inner text(without other text such as 'By', 'From') of span,cite,label,li. */
     if (!preg_match('@<(\\w+)\\b[^>]*?class=[\'"][^\'"]*author[^\'"]*[\'"][^>]*>@sm', $content)) {
         if (preg_match('@<(span|cite|label|li)[^>]*>([^<>]*)\\[##_article_rep_author_##\\]([^<>]*)</\\1>@sm', $content, $match)) {
             /* If there are garbage texts around author's name..., embrace author's name with a span */
             if (!preg_match('/^\\s*$/', $match[2]) || !preg_match('/^\\s*$/', $match[3])) {
                 $content = str_replace("[##_article_rep_author_##]", "<span>[##_article_rep_author_##]</span>", $content);
                 array_push($this->microformatDebug, _text('Microformat-info: 작성자 주위로 공백외의 문자가 있어 <span>으로 한번 더 감쌉니다.'));
             }
         } else {
             array_push($this->microformatDebug, _text('Microformat-info: 작성자가 출력되지 않는 스킨입니다. 작성자를 보이지 않게 추가하였습니다.'));
             $content = preg_replace('@(<(div|td|span|p)[^>]*>[^<>]*?\\[##_article_rep_desc_##\\].*?</\\2>)@sm', "\\1\n\t\t\t\t\t<span style=\"display:none\">[##_article_rep_author_##]</span>", $content);
         }
         $content = addAttributeCore($content, '@(.*?)(<(span|cite|label|li|div)[^>]*>\\s*\\[##_article_rep_author_##\\]\\s*</\\3>)(.*)@sm', array('class' => 'author'), array(1, 2, 4), 1);
         if (preg_match('@<(span|cite|label|li|div)[^>]*?class=[\'"][^\'"]*\\bauthor\\b[^\'"]*[\'"][^>]*>@sm', $content)) {
             array_push($this->microformatDebug, _text('Microformat-info: 작성자에 hAtom용 class="author"를 추가합니다'));
         } else {
             array_push($this->microformatDebug, _text('Microformat-warn: 작성자에 hAtom용 class="author"를 추가하지 못하였습니다'));
         }
     } else {
         array_push($this->microformatDebug, _text('Microformat-info: class="author"를 사용한 스킨입니다. hAtom용 author는 삽입하지 않았습니다. 주의: 스킨에 사용된 author의 용도가 마이크로포맷과 다를 수 있습니다.'));
     }
     /* hAtom:hEntry is a unique division in a blog entry*/
     if (!preg_match('/<(p|div)[^>]*class=[\'"][^\'"]*\\bhentry\\b[^\'"]*[\'"][^>]*>/sm', $content)) {
         $content = "<div class=\"hentry\">\r\n{$content}\r\n</div>";
         array_push($this->microformatDebug, _text('Microformat-info: 블로그 글영역 전체를 hAtom용 entry로 간주합니다. 적절한 class="hentry" 삽입이 필요할 수 있습니다.'));
     } else {
         array_push($this->microformatDebug, _text('Microformat-info: 스킨에 class="hentry"가 있으므로, hAtom용 entry는 삽입하지 않았습니다.'));
     }
     /* bookmark to A link */
     addAttribute($content, 'a', 'href', '##_article_rep_link_##', array('rel' => 'bookmark', 'title' => "[##_article_rep_title_##]"));
     if (preg_match('@<a\\b[^>]*?rel=[\'"][^\'"]*bookmark[^\'"]*[\'"][^>]*>@sm', $content)) {
         array_push($this->microformatDebug, _text('Microformat-info: 제목에 bookmark를 추가합니다'));
     } else {
         if (Setting::getBlogSettingGlobal('useMicroformat', 3) > 2) {
             $content = str_replace("[##_article_rep_desc_##]", "<a style=\"display:none\" href=\"[##_article_rep_link_##]\" rel=\"bookmark\" class=\"entry-title\" title=\"[##_article_rep_title_##]\">[##_article_rep_title_##]</a>\r\n[##_article_rep_desc_##]", $content);
         }
         array_push($this->microformatDebug, _text('Microformat-info: 링크가 걸린 제목이 없어 보이지 않는 링크를 추가한 뒤 rel="bookmark"와 hAtom용 title을 추가하였습니다'));
     }
     $this->hentryExisted = true;
     $content = preg_replace("/{{{([^}]+)}}}/sm", '<\\1>', $content);
     return $content;
 }
コード例 #3
0
ファイル: grokit_codegen_top.php プロジェクト: gokulp/grokit
 function parseFullAttribute($ast)
 {
     $name = ast_get($ast, NodeKey::NAME);
     $type = ast_get($ast, NodeKey::TYPE);
     $slot = ast_get($ast, NodeKey::SLOT);
     // Give entire type AST to attribute manager, it will be parsed
     // only when needed.
     addAttribute($name, $type, $slot);
 }