リビジョン | d6b0e6a1c3ee23b1ebc63b42cabffaa72db51dad (tree) |
---|---|
日時 | 2015-03-05 22:02:07 |
作者 | naoki hirata <naoki@magi...> |
コミッター | naoki hirata |
「ブログメイン」ウィジェット更新。
@@ -18,17 +18,22 @@ class blog_mainCommonDef | ||
18 | 18 | { |
19 | 19 | static $_deviceType = 0; // デバイスタイプ |
20 | 20 | |
21 | + // ##### 定義値 ##### | |
22 | + const USER_ID_SEPARATOR = ','; // ユーザID区切り用セパレータ | |
23 | + const ATTACH_FILE_DIR = '/etc/blog'; // 添付ファイル格納ディレクトリ | |
24 | + const DOWNLOAD_CONTENT_TYPE = '-file'; // ダウンロードするコンテンツのタイプ | |
25 | + | |
21 | 26 | // ##### DB定義値 ##### |
22 | - const CF_RECEIVE_COMMENT = 'receive_comment'; // コメントを受け付けるかどうか | |
23 | - const CF_RECEIVE_TRACKBACK = 'receive_trackback'; // トラックバックを受け付けるかどうか | |
24 | 27 | const CF_ENTRY_VIEW_COUNT = 'entry_view_count'; // 記事表示数 |
25 | 28 | const CF_ENTRY_VIEW_ORDER = 'entry_view_order'; // 記事表示方向 |
26 | 29 | const CF_ENTRY_DEFAULT_IMAGE = 'entry_default_image'; // 記事デフォルト画像 |
30 | + const CF_CATEGORY_COUNT = 'category_count'; // カテゴリ数 | |
31 | + const CF_RECEIVE_COMMENT = 'receive_comment'; // コメントを受け付けるかどうか | |
32 | + const CF_RECEIVE_TRACKBACK = 'receive_trackback'; // トラックバックを受け付けるかどうか | |
27 | 33 | const CF_MAX_COMMENT_LENGTH = 'comment_max_length'; // コメント最大文字数 |
28 | 34 | const CF_COMMENT_USER_LIMITED = 'comment_user_limited'; // コメントのユーザ制限 |
29 | 35 | const CF_USE_MULTI_BLOG = 'use_multi_blog'; // マルチブログ機能を使用するかどうか |
30 | 36 | const CF_MULTI_BLOG_TOP_CONTENT = 'multi_blog_top_content'; // マルチブログ時のトップコンテンツ |
31 | - const CF_CATEGORY_COUNT = 'category_count'; // カテゴリ数 | |
32 | 37 | const CF_OUTPUT_HEAD = 'output_head'; // ヘッダ出力するかどうか |
33 | 38 | const CF_HEAD_VIEW_DETAIL = 'head_view_detail'; // ヘッダ出力(詳細表示) |
34 | 39 | const CF_LAYOUT_ENTRY_SINGLE = 'layout_entry_single'; // コンテンツレイアウト(記事詳細) |
@@ -44,9 +49,10 @@ class blog_mainCommonDef | ||
44 | 49 | const CF_TITLE_TAG_LEVEL = 'title_tag_level'; // タイトルのタグレベル |
45 | 50 | const CF_THUMB_TYPE = 'thumb_type'; // サムネールタイプ |
46 | 51 | |
47 | - const USER_ID_SEPARATOR = ','; // ユーザID区切り用セパレータ | |
48 | - const ATTACH_FILE_DIR = '/etc/blog'; // 添付ファイル格納ディレクトリ | |
49 | - const DOWNLOAD_CONTENT_TYPE = '-file'; // ダウンロードするコンテンツのタイプ | |
52 | + // ##### デフォルト値 ##### | |
53 | + const DEFAULT_VIEW_COUNT = 10; // デフォルトの表示記事数 | |
54 | + const DEFAULT_COMMENT_LENGTH = 300; // デフォルトのコメント最大文字数 | |
55 | + const DEFAULT_CATEGORY_COUNT = 2; // デフォルトのカテゴリー数 | |
50 | 56 | const DEFAULT_LAYOUT_ENTRY_SINGLE = '<small>[#CT_AUTHOR#] [#CT_DATE#] [#CT_TIME#] [#BLOG_LINK#]</small>[#BODY#][#CATEGORY#][#LINKS#]'; // デフォルトのコンテンツレイアウト(記事詳細) |
51 | 57 | const DEFAULT_LAYOUT_ENTRY_LIST = '[#TITLE#]<small>[#CT_AUTHOR#] [#CT_DATE#] [#CT_TIME#] [#BLOG_LINK#]</small>[#BODY#][#CATEGORY#][#COMMENT_LINK#]'; // デフォルトのコンテンツレイアウト(記事一覧) |
52 | 58 | const DEFAULT_LAYOUT_COMMENT_LIST = '[#AVATAR#]<dl><dt>[#TITLE#] <small>[#CM_AUTHOR#] [#CM_DATE#] [#CM_TIME#] [#URL#]</small></dt><dd>[#BODY#]</dd></dl>'; // デフォルトのコンテンツレイアウト(コメント一覧) |
@@ -59,11 +65,6 @@ class blog_mainCommonDef | ||
59 | 65 | const DEFAULT_MESSAGE_FIND_NO_ENTRY = 'ブログ記事が見つかりません'; // ブログ記事が見つからないメッセージ |
60 | 66 | const DEFAULT_TITLE_TAG_LEVEL = 2; // デフォルトのタイトルタグレベル |
61 | 67 | |
62 | - // ##### デフォルト値 ##### | |
63 | - const DEFAULT_VIEW_COUNT = 10; // デフォルトの表示記事数 | |
64 | - const DEFAULT_COMMENT_LENGTH = 300; // デフォルトのコメント最大文字数 | |
65 | - const DEFAULT_CATEGORY_COUNT = 2; // デフォルトのカテゴリー数 | |
66 | - | |
67 | 68 | /** |
68 | 69 | * ブログ定義値をDBから取得 |
69 | 70 | * |
@@ -130,80 +131,6 @@ class blog_mainCommonDef | ||
130 | 131 | return $fields; |
131 | 132 | } |
132 | 133 | /** |
133 | - * サムネール画像を作成 | |
134 | - * | |
135 | - * @param string $srcHtml 画像を検索するHTML | |
136 | - * @param int $entryId ブログ記事ID | |
137 | - * @param timestamp $updateDt 記事の更新日付 | |
138 | - * @return string 画像URL | |
139 | - */ | |
140 | -/* static function createThumbnail($srcHtml, $entryId, $updateDt) | |
141 | - { | |
142 | - global $gEnvManager; | |
143 | - global $gInstanceManager; | |
144 | - | |
145 | - // サムネール | |
146 | - $thumbUrl = $gInstanceManager->getImageManager()->getDefaultThumbUrl(M3_VIEW_TYPE_BLOG, $entryId); | |
147 | - $thumbPath = $gInstanceManager->getImageManager()->getDefaultThumbPath(M3_VIEW_TYPE_BLOG, $entryId); | |
148 | - | |
149 | - // ファイルと日時をチェック | |
150 | - $createImage = true; | |
151 | - if (file_exists($thumbPath) && strtotime($updateDt) < filemtime($thumbPath)){ | |
152 | - $createImage = false; | |
153 | - } | |
154 | - | |
155 | - // サムネールを作成 | |
156 | - if ($createImage){ | |
157 | - // ブログ記事から最初の画像を取得 | |
158 | - // 読み飛ばしが指定されている場合は飛ばす | |
159 | - $regex = '/<img[^<]*?src\s*=\s*[\'"]+(.+?)[\'"]+[^>]*?>/si'; | |
160 | - if (preg_match($regex, $srcHtml, $matches)){ // 画像が取得できたとき | |
161 | - // 相対パスを取得 | |
162 | - $imageUrl = str_replace(M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $gEnvManager->getRootUrl(), $matches[1]); | |
163 | - if (strStartsWith($imageUrl, '/')){ | |
164 | - $relativePath = $gEnvManager->getRelativePathToSystemRootUrl($gEnvManager->getDocumentRootUrl() . $imageUrl); | |
165 | - } else { | |
166 | - if ($gEnvManager->isSystemUrlAccess($imageUrl)){ // システム内のファイルのとき | |
167 | - $relativePath = $gEnvManager->getRelativePathToSystemRootUrl($imageUrl); | |
168 | - } | |
169 | - } | |
170 | - | |
171 | - if (strStartsWith($relativePath, '/' . M3_DIR_NAME_RESOURCE . '/')){ // リソースディレクトリ以下のリソースのみ変換 | |
172 | - $imagePath = $gEnvManager->getSystemRootPath() . $relativePath; // 元画像のファイルパス | |
173 | - | |
174 | - // 画像格納用のディレクトリ作成 | |
175 | - $destDir = dirname($thumbPath); | |
176 | - if (!file_exists($destDir)) mkdir($destDir, M3_SYSTEM_DIR_PERMISSION, true); | |
177 | - | |
178 | - // サムネール作成 | |
179 | - $ret = $gInstanceManager->getImageManager()->createDefaultThumb(M3_VIEW_TYPE_BLOG, $entryId, $imagePath); | |
180 | - if (!$ret) $thumbUrl = ''; | |
181 | - } else { | |
182 | - $thumbUrl = ''; | |
183 | - } | |
184 | - } else { // 画像が取得できないとき | |
185 | - // サムネール画像を削除 | |
186 | - if (file_exists($thumbPath)) @unlink($thumbPath); | |
187 | - $thumbUrl = ''; | |
188 | - } | |
189 | - } | |
190 | - return $thumbUrl; | |
191 | - }*/ | |
192 | - /** | |
193 | - * サムネール画像を削除 | |
194 | - * | |
195 | - * @param int $entryId ブログ記事ID | |
196 | - * @return bool true=成功、false=失敗 | |
197 | - */ | |
198 | -/* static function removeThumbnail($entryId) | |
199 | - { | |
200 | - global $gInstanceManager; | |
201 | - | |
202 | - $thumbPath = $gInstanceManager->getImageManager()->getDefaultThumbPath(M3_VIEW_TYPE_BLOG, $entryId); | |
203 | - if (file_exists($thumbPath)) @unlink($thumbPath); | |
204 | - return true; | |
205 | - }*/ | |
206 | - /** | |
207 | 134 | * アイキャッチ用画像のURLを取得 |
208 | 135 | * |
209 | 136 | * @param string $filenames 作成済みファイル名(「;」区切り) |
@@ -257,7 +257,6 @@ class blog_mainTopWidgetContainer extends blog_mainBaseWidgetContainer | ||
257 | 257 | } |
258 | 258 | |
259 | 259 | // 運用可能ユーザの場合は編集用ボタンを表示 |
260 | - //if ($this->isExistsViewData && self::$_canEditEntry){ // 記事編集権限ありのとき | |
261 | 260 | if (self::$_canEditEntry){ // 記事編集権限ありのとき |
262 | 261 | // 共通ボタン埋め込み |
263 | 262 | $this->tmpl->setAttribute('button_list', 'visibility', 'visible'); |