Changeset 3333

Show
Ignore:
Timestamp:
05/25/07 04:30:39 (3 years ago)
Author:
inureyes
Message:

#226

  • 기본 구현. (태그 옆에 같은 이름의 키워드가 있으면 링크가 붙는다)
  • 관련하여 플러그인 이벤트를 사용하던 중 정말 불편하다는 것을 깨닫고 이벤트 개선.
  • ViewTagLists $mother : 글번호

$target : 태그 정보 및 출력 정보

'name' => link 식이다.
예) $target전지현? = '<a href=...'

넘어와서 링크를 추가로 붙여주고 싶으면 위의 형식을 지켜서 붙이면 됨.

Location:
sandbox
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • sandbox/lib/model/blog.keyword.php

    r3106 r3333  
    4444 
    4545    $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0'; 
    46     $sql = "SELECT * FROM {$database['prefix']}Entries WHERE owner = $owner AND draft = 0 $visibility AND category = -1 $aux ORDER BY published DESC"; 
     46    $sql = "SELECT *  
     47        FROM {$database['prefix']}Entries  
     48        WHERE owner = $owner  
     49            AND draft = 0 $visibility  
     50            AND category = -1 $aux  
     51        ORDER BY published DESC"; 
    4752    return fetchWithPaging($sql, $page, $count, "$folderURL/{$suri['value']}"); 
    4853} 
     
    5257    $keyword = mysql_tt_escape_string($keyword); 
    5358    $visibility = doesHaveOwnership() ? '' : 'AND visibility > 1'; 
    54     return DBQuery::queryAll("SELECT id, title, content, published, comments FROM {$database['prefix']}Entries WHERE owner = $owner AND draft = 0 $visibility AND category >= 0 AND (title LIKE '%$keyword%' OR content LIKE '%$keyword%') ORDER BY published DESC"); 
     59    return DBQuery::queryAll("SELECT id, title, content, published, comments  
     60            FROM {$database['prefix']}Entries  
     61            WHERE owner = $owner  
     62                AND draft = 0 $visibility  
     63                AND category >= 0  
     64                AND (title LIKE '%$keyword%' OR content LIKE '%$keyword%')  
     65            ORDER BY published DESC"); 
    5566} 
    5667?> 
  • sandbox/lib/piece/blog/entries.php

    r3299 r3333  
    4040            if (sizeof($entryTags) > 0) { 
    4141                $tags = array(); 
    42                 foreach ($entryTags as $entryTag) 
    43                     array_push($tags, "<a href=\"$defaultURL/tag/" . encodeURL($entryTag['name']) . '"' . ((count($entries) == 1 && getUserSetting('useRelTag', true)) ? ' rel="tag"' : '') . '>' . htmlspecialchars($entryTag['name']) . '</a>'); 
     42                foreach ($entryTags as $entryTag) { 
     43                    $tags[$entryTag['name']] = "<a href=\"$defaultURL/tag/" . encodeURL($entryTag['name']) . '"' . ((count($entries) == 1 && getUserSetting('useRelTag', true)) ? ' rel="tag"' : '') . '>' . htmlspecialchars($entryTag['name']) . '</a>'; 
     44                } 
    4445                $tags = fireEvent('ViewTagLists', $tags, $entry['id']); 
    45                 dress('tag_label_rep', implode(",\r\n", $tags), $tagLabelView); 
     46                dress('tag_label_rep', implode(",\r\n", array_values($tags)), $tagLabelView); 
    4647                dress('tag_label', $tagLabelView, $entryView); 
    4748            } 
  • sandbox/plugins/KeywordUI/index.php

    r3111 r3333  
    22/* KeywordUI for Textcube 1.1 
    33   ---------------------------------- 
    4    Version 1.0 
    5    Tatter and Friends development team. 
     4   Version 1.5 
     5   Needlworks. 
    66 
    77   Creator          : inureyes 
     
    99 
    1010   Created at       : 2006.10.3 
    11    Last modified at : 2006.10.26 
     11   Last modified at : 2007.5.25 
    1212  
    1313 This plugin enables keyword / keylog feature in Textcube. 
     
    3737    return $pluginPath."/keylogSkin.html"; 
    3838} 
     39function KeywordUI_bindTag($target,$mother) { 
     40    global $owner, $entries, $blogURL, $pluginURL, $configVal; 
     41    if(isset($mother) && isset($target)){ 
     42        $tagsWithKeywords = array(); 
     43        $keywordNames = getKeywordNames($owner); 
     44        foreach($target as $tag => $tagLink) { 
     45            if(array_search($tag,$keywordNames) !== false) 
     46                array_push($tagsWithKeywords, $tagLink."<a class=\"key1\" onclick=\"openKeyword('$blogURL/keylog/".encodeURL($tag)."')\">T</a>"); 
     47            else array_push($tagsWithKeywords, $tagLink); 
     48        } 
     49        $target = $tagsWithKeywords; 
     50    } 
     51    return $target; 
     52} 
    3953?> 
  • sandbox/plugins/KeywordUI/index.xml

    r3157 r3333  
    1717    <listener event="BindKeyword">KeywordUI_bindKeyword</listener> 
    1818    <listener event="setKeylogSkin">KeywordUI_setSkin</listener> 
     19    <listener event="ViewTagLists">KeywordUI_bindTag</listener> 
    1920  </binding> 
    2021</plugin>