Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 645ea78

Browse files
committedAug 15, 2020
Psr4ize: Remove unnecessary qualifier
1 parent ad0fce0 commit 645ea78

21 files changed

+92
-90
lines changed
 

‎app/src/App.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static function calcStartAndEndDate($year=0, $month=0, $day=0)
149149
public static function getDeviceType()
150150
{
151151
// パラメータによりデバイスタイプを変更(FC2の引数順守)
152-
$request = \Fc2blog\Web\Request::getInstance();
152+
$request = Request::getInstance();
153153
if ($request->isArgs('pc')) {
154154
return Config::get('DEVICE_PC');
155155
}

‎app/src/Debug.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Debug{
1313
private static $logs = array();
1414

1515
public static function log($msg, $params=array(), $class='log', $file=null, $line=null){
16-
switch(\Fc2blog\Config::get('DEBUG')){
16+
switch(Config::get('DEBUG')){
1717
// Debug文の表示はしない
1818
default: case 0:
1919
break;
@@ -118,7 +118,7 @@ private static function initLogs(){
118118
* セッションに現在のログを保存する(ページをまたがったログ用)
119119
*/
120120
public static function setSessionLogs(){
121-
if (\Fc2blog\Config::get('DEBUG')!=2) {
121+
if (Config::get('DEBUG')!=2) {
122122
// DebugをHTMLへ吐き出す以外は処理を行わない
123123
return ;
124124
}
@@ -136,25 +136,25 @@ public static function removeSessionLogs(){
136136
* DebugLogのアウトプットを行う
137137
*/
138138
public static function output($controller){
139-
$debug = \Fc2blog\Config::get('DEBUG');
139+
$debug = Config::get('DEBUG');
140140
if (!($debug==2 || $debug==3)) {
141141
// htmlでデバッグ以外は何も処理を行わない
142142
return ;
143143
}
144144

145-
\Fc2blog\Debug::log('\Fc2blog\Debug::output()', false, 'system', __FILE__, __LINE__); // 最後の出力処理
146-
\Fc2blog\Config::set('DEBUG_TEMPLATE_VARS', 0); // デバッグ用テンプレートには使用可能変数一覧は非表示
145+
Debug::log('\Fc2blog\Debug::output()', false, 'system', __FILE__, __LINE__); // 最後の出力処理
146+
Config::set('DEBUG_TEMPLATE_VARS', 0); // デバッグ用テンプレートには使用可能変数一覧は非表示
147147

148148
// logsデータを元にdebug用htmlをfetch
149149
$html = $controller->fetch('Common/debug.html', array('logs'=>self::getLogs()), false);
150150

151151
// 10分前以前のファイルは削除
152-
$cmd = "find " . \Fc2blog\Config::get('TEMP_DIR') . 'debug_html/' . " -amin +10 -name '*.html' | xargs rm -f";
152+
$cmd = "find " . Config::get('TEMP_DIR') . 'debug_html/' . " -amin +10 -name '*.html' | xargs rm -f";
153153
system($cmd);
154154

155155
// fetchしたデータでhtmlを作成
156156
$key = time() . '.html'; // 後でキー名はセッションIDやログインIDを付与する
157-
$filePath = \Fc2blog\Config::get('TEMP_DIR') . 'debug_html/' . $key;
157+
$filePath = Config::get('TEMP_DIR') . 'debug_html/' . $key;
158158
file_put_contents($filePath, $html); // 結果をデバッグ用HTMLに書き込み
159159
chmod($filePath, 0777);
160160

‎app/src/Model/BlogPluginsModel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Fc2blog\Config;
77
use Fc2blog\Web\Session;
88

9-
class BlogPluginsModel extends \Fc2blog\Model\Model
9+
class BlogPluginsModel extends Model
1010
{
1111

1212
public static $instance = null;
@@ -150,7 +150,7 @@ public static function fc2PluginSyntax($value)
150150
}
151151

152152
// HTMLをPHPテンプレートに変換してテンプレートファイルの作成
153-
\Fc2blog\Model\Model::load('BlogTemplates');
153+
Model::load('BlogTemplates');
154154
$html = BlogTemplatesModel::convertFC2Template($value);
155155
file_put_contents($plugin_path, $html);
156156
chmod($plugin_path, 0777);
@@ -379,7 +379,7 @@ public static function createPlugin($html, $blog_id, $id='preview')
379379
}
380380

381381
// HTMLをPHPテンプレートに変換してテンプレートファイルの作成
382-
\Fc2blog\Model\Model::load('BlogTemplates');
382+
Model::load('BlogTemplates');
383383
$html = BlogTemplatesModel::convertFC2Template($html);
384384
file_put_contents($plugin_path, $html);
385385
chmod($plugin_path, 0777);

‎app/src/Model/BlogSettingsModel.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
use Fc2blog\Config;
66

7-
class BlogSettingsModel extends \Fc2blog\Model\Model{
7+
class BlogSettingsModel extends Model
8+
{
89

910
public $validates = array();
1011

‎app/src/Model/BlogTemplatesModel.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Fc2blog\Config;
77
use Fc2blog\Web\Session;
88

9-
class BlogTemplatesModel extends \Fc2blog\Model\Model
9+
class BlogTemplatesModel extends Model
1010
{
1111

1212
public static $instance = null;
@@ -119,7 +119,7 @@ public static function createTemplate($templateId, $blog_id, $device_type, $html
119119

120120
if (!$isPreview) {
121121
// DBからHTMLとCSSを取得
122-
$blog_templates_model = \Fc2blog\Model\Model::load('BlogTemplates');
122+
$blog_templates_model = Model::load('BlogTemplates');
123123
$blogTemplate = $blog_templates_model->findByIdAndBlogId($templateId, $blog_id);
124124
$html = $blogTemplate['html'];
125125
$css = $blogTemplate['css'];
@@ -217,12 +217,12 @@ public function updateByIdAndBlogId($values, $id, $blog_id, $options=array())
217217
is_file($cssFilePath) && unlink($cssFilePath);
218218

219219
// 適用中のテンプレート取得
220-
if (\Fc2blog\Model\Model::load('Blogs')->isAppliedTemplate($id, $blog_id, $device_type)) {
220+
if (Model::load('Blogs')->isAppliedTemplate($id, $blog_id, $device_type)) {
221221
// コメントの表示タイプをテンプレートから判断
222222
$reply_type = strstr($values['html'], '<%comment_reply_body>') ?
223223
Config::get('BLOG_TEMPLATE.COMMENT_TYPE.REPLY') : Config::get('BLOG_TEMPLATE.COMMENT_TYPE.AFTER');
224224
// コメントの表示タイプを更新
225-
\Fc2blog\Model\Model::load('BlogSettings')->updateReplyType($device_type, $reply_type, $blog_id);
225+
Model::load('BlogSettings')->updateReplyType($device_type, $reply_type, $blog_id);
226226
}
227227

228228
return true;

‎app/src/Model/BlogsModel.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Fc2blog\App;
66
use Fc2blog\Config;
77

8-
class BlogsModel extends \Fc2blog\Model\Model
8+
class BlogsModel extends Model
99
{
1010

1111
public static $instance = null;
@@ -108,9 +108,9 @@ public function validate($data, &$valid_data, $white_list=array())
108108
*/
109109
public static function isValidBlogId(string $blog_id)
110110
{
111-
if (\Fc2blog\Model\Validate::alphanumeric($blog_id, []) !== true) return false;
112-
if (\Fc2blog\Model\Validate::minlength($blog_id, ['min' => 3]) !== true) return false;
113-
if (\Fc2blog\Model\Validate::maxlength($blog_id, ['max' => 50]) !== true) return false;
111+
if (Validate::alphanumeric($blog_id, []) !== true) return false;
112+
if (Validate::minlength($blog_id, ['min' => 3]) !== true) return false;
113+
if (Validate::maxlength($blog_id, ['max' => 50]) !== true) return false;
114114
if (strtolower($blog_id) !== $blog_id) return false;
115115
return true;
116116
}
@@ -282,21 +282,21 @@ public function insert($data, $options=array())
282282
{
283283
// 主キーがauto_incrementじゃないのでreturn値の受け取り方を変更
284284
$data['created_at'] = $data['updated_at'] = date('Y-m-d H:i:s');
285-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
285+
$options['result'] = DBInterface::RESULT_SUCCESS;
286286
if (!parent::insert($data, $options)) {
287287
return false;
288288
}
289289
$id = $data['id'];
290290

291291
// CategoryのSystem用Nodeの追加(id=1の削除できないノード)
292292
$data = array('name'=>__('Unclassified'), 'blog_id'=>$id);
293-
\Fc2blog\Model\Model::load('Categories')->addNode($data, 'blog_id=?', array($id));
293+
Model::load('Categories')->addNode($data, 'blog_id=?', array($id));
294294

295295
// ブログ用の設定作成
296-
\Fc2blog\Model\Model::load('BlogSettings')->insert(array('blog_id'=>$id));
296+
Model::load('BlogSettings')->insert(array('blog_id'=>$id));
297297

298298
// 初期のテンプレートを作成する(pc,mb,sp,tb)
299-
$blog_templates_model = \Fc2blog\Model\Model::load('BlogTemplates');
299+
$blog_templates_model = Model::load('BlogTemplates');
300300

301301
$blog_data = array();
302302

@@ -366,13 +366,13 @@ public function switchTemplate($blog_template, $blog_id)
366366
$reply_type = strstr($blog_template['html'], '<%comment_reply_body>') ?
367367
Config::get('BLOG_TEMPLATE.COMMENT_TYPE.REPLY') : Config::get('BLOG_TEMPLATE.COMMENT_TYPE.AFTER');
368368
// コメントの表示タイプを更新
369-
\Fc2blog\Model\Model::load('BlogSettings')->updateReplyType($device_type, $reply_type, $blog_id);
369+
Model::load('BlogSettings')->updateReplyType($device_type, $reply_type, $blog_id);
370370

371371
$ret = $this->updateById($data, $blog_id);
372372

373373
if ($ret) {
374374
// 更新に成功した場合 現在のテンプレートを削除
375-
\Fc2blog\Model\Model::load('BlogTemplates');
375+
Model::load('BlogTemplates');
376376
$template_path = BlogTemplatesModel::getTemplateFilePath($blog_id, $device_type);
377377
is_file($template_path) && unlink($template_path);
378378
$css_path = BlogTemplatesModel::getCssFilePath($blog_id, $device_type);

‎app/src/Model/CategoriesModel.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Fc2blog\Config;
66

7-
class CategoriesModel extends \Fc2blog\Model\Model
7+
class CategoriesModel extends Model
88
{
99

1010
public static $instance = null;
@@ -159,7 +159,7 @@ public function getEntryCategories($blog_id, $entry_id)
159159
SQL;
160160
$params = array($blog_id, $entry_id, $blog_id);
161161
$options = array();
162-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_ALL;
162+
$options['result'] = DBInterface::RESULT_ALL;
163163
return $this->findSql($sql, $params, $options);
164164
}
165165

@@ -183,7 +183,7 @@ public function getEntriesCategories($blog_id, $entry_ids=array())
183183
SQL;
184184
$params = array_merge(array($blog_id), $entry_ids, array($blog_id));
185185
$options = array();
186-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_ALL;
186+
$options['result'] = DBInterface::RESULT_ALL;
187187
$categories = $this->findSql($sql, $params, $options);
188188

189189
$entries_categories = array();
@@ -220,7 +220,7 @@ public function increaseCount($blog_id, $ids=array())
220220
}
221221
$sql = 'UPDATE ' . $this->getTableName() . ' SET count=count+1 WHERE blog_id=? AND id IN (' . implode(',', array_fill(0, count($ids), '?')) . ')';
222222
$params = array_merge(array($blog_id), $ids);
223-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
223+
$options['result'] = DBInterface::RESULT_SUCCESS;
224224
return $this->executeSql($sql, $params, $options);
225225
}
226226

@@ -234,7 +234,7 @@ public function decreaseCount($blog_id, $ids=array())
234234
}
235235
$sql = 'UPDATE ' . $this->getTableName() . ' SET count=count-1 WHERE blog_id=? AND count>0 AND id IN (' . implode(',', array_fill(0, count($ids), '?')) . ')';
236236
$params = array_merge(array($blog_id), $ids);
237-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
237+
$options['result'] = DBInterface::RESULT_SUCCESS;
238238
return $this->executeSql($sql, $params, $options);
239239
}
240240

@@ -286,7 +286,7 @@ public function deleteNodeByIdAndBlogId($id, $blog_id)
286286
'where' => 'blog_id=? AND category_id=1',
287287
'params' => array($blog_id),
288288
);
289-
$count = \Fc2blog\Model\Model::load('EntryCategories')->find('one', $options);
289+
$count = Model::load('EntryCategories')->find('one', $options);
290290
$this->updateByIdAndBlogId(array('count'=>$count), 1, $blog_id);
291291

292292
// カテゴリー削除

‎app/src/Model/CommentsModel.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Fc2blog\Web\Cookie;
77
use Fc2blog\Web\Html;
88

9-
class CommentsModel extends \Fc2blog\Model\Model
9+
class CommentsModel extends Model
1010
{
1111

1212
public static $instance = null;
@@ -193,7 +193,7 @@ public function deleteEntryRelation($blog_id, $entry_id)
193193
public function insertByBlogSetting($data, $blog_setting)
194194
{
195195
// Entry記事数増加処理
196-
\Fc2blog\Model\Model::load('Entries')->increaseCommentCount($data['blog_id'], $data['entry_id']);
196+
Model::load('Entries')->increaseCommentCount($data['blog_id'], $data['entry_id']);
197197

198198
// パスワードの入力が合った場合ハッシュ化
199199
if (isset($data['password']) && $data['password']!=='') {
@@ -258,7 +258,7 @@ public function deleteByIdAndBlogId($comment_id, $blog_id, $options=array())
258258
}
259259

260260
// Entry記事数増加処理
261-
\Fc2blog\Model\Model::load('Entries')->decreaseCommentCount($blog_id, $comment['entry_id']);
261+
Model::load('Entries')->decreaseCommentCount($blog_id, $comment['entry_id']);
262262

263263
// 記事本体削除
264264
return parent::deleteByIdAndBlogId($comment_id, $blog_id, $options);
@@ -326,7 +326,7 @@ public function decorateByBlogSetting($tmp_comments, $blog_setting, $self_blog=f
326326
$flag_pending = Config::get('COMMENT.OPEN_STATUS.PENDING');
327327
$flag_private = Config::get('COMMENT.OPEN_STATUS.PRIVATE');
328328

329-
$blog = \Fc2blog\Model\Model::load('Blogs')->findById($blog_setting['blog_id']);
329+
$blog = Model::load('Blogs')->findById($blog_setting['blog_id']);
330330

331331
// コメントを追加で表示するかどうか
332332
$is_add_comment = $blog_setting[Config::get('BLOG_TEMPLATE_REPLY_TYPE_COLUMN.' . Config::get('DeviceType'))] == Config::get('BLOG_TEMPLATE.COMMENT_TYPE.AFTER');
@@ -411,7 +411,7 @@ public function getReplyComment($blog_id, $comment_id){
411411
return array();
412412
}
413413
$entry_id = $comment['entry_id'];
414-
if (!$entry=\Fc2blog\Model\Model::load('Entries')->findByIdAndBlogId($entry_id, $blog_id)) {
414+
if (!$entry= Model::load('Entries')->findByIdAndBlogId($entry_id, $blog_id)) {
415415
return array();
416416
}
417417
$comment['entry_title'] = $entry['title'];
@@ -438,7 +438,7 @@ public function updateApproval($blog_id, $comment_id=null)
438438
$params[] = $comment_id;
439439
}
440440
$sql .= ' AND open_status=' . Config::get('COMMENT.OPEN_STATUS.PENDING');
441-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
441+
$options['result'] = DBInterface::RESULT_SUCCESS;
442442
return $this->executeSql($sql, $params, $options);
443443
}
444444

@@ -471,7 +471,7 @@ public function updateReply($data, $comment)
471471
public function getTemplateRecentCommentList($blog_id, $limit=0)
472472
{
473473
if ($limit==0) {
474-
$blog_setting = \Fc2blog\Model\Model::load('BlogSettings')->findByBlogId($blog_id);
474+
$blog_setting = Model::load('BlogSettings')->findByBlogId($blog_id);
475475
$limit = $blog_setting['comment_display_count'];
476476
}
477477

‎app/src/Model/EntriesModel.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Fc2blog\App;
66
use Fc2blog\Config;
77

8-
class EntriesModel extends \Fc2blog\Model\Model
8+
class EntriesModel extends Model
99
{
1010

1111
public static $instance = null;
@@ -127,7 +127,7 @@ public function getArchives($blog_id)
127127
ORDER BY posted_at DESC
128128
SQL;
129129
$params = array($blog_id);
130-
$options = array('result'=>\Fc2blog\Model\DBInterface::RESULT_ALL);
130+
$options = array('result'=> DBInterface::RESULT_ALL);
131131
$archives = $this->findSql($sql, $params, $options);
132132
return $archives;
133133
}
@@ -150,8 +150,8 @@ public function getEntry($id, $blog_id)
150150
}
151151

152152
// 記事のカテゴリ一覧を取得 TODO:後でcacheを使用する形に
153-
$entry['categories'] = \Fc2blog\Model\Model::load('Categories')->getEntryCategories($entry['blog_id'], $entry['id']);
154-
$entry['tags'] = \Fc2blog\Model\Model::load('Tags')->getEntryTags($entry['blog_id'], $entry['id']);
153+
$entry['categories'] = Model::load('Categories')->getEntryCategories($entry['blog_id'], $entry['id']);
154+
$entry['tags'] = Model::load('Tags')->getEntryTags($entry['blog_id'], $entry['id']);
155155

156156
return $entry;
157157
}
@@ -226,7 +226,7 @@ public function insert($data, $options=array())
226226
$flag = parent::insert($data, $options);
227227

228228
if ($flag && isset($data['blog_id'])) {
229-
\Fc2blog\Model\Model::load('Blogs')->updateLastPostedAt($data['blog_id']);
229+
Model::load('Blogs')->updateLastPostedAt($data['blog_id']);
230230
}
231231
return $flag;
232232
}
@@ -261,13 +261,13 @@ private function getFirstImage($data)
261261
public function deleteByIdAndBlogId($entry_id, $blog_id, $options=array())
262262
{
263263
// コメント削除
264-
\Fc2blog\Model\Model::load('Comments')->deleteEntryRelation($blog_id, $entry_id);
264+
Model::load('Comments')->deleteEntryRelation($blog_id, $entry_id);
265265

266266
// カテゴリー削除
267-
\Fc2blog\Model\Model::load('EntryCategories')->deleteEntryRelation($blog_id, $entry_id);
267+
Model::load('EntryCategories')->deleteEntryRelation($blog_id, $entry_id);
268268

269269
// タグ削除
270-
\Fc2blog\Model\Model::load('EntryTags')->deleteEntryRelation($blog_id, $entry_id);
270+
Model::load('EntryTags')->deleteEntryRelation($blog_id, $entry_id);
271271

272272
// 記事本体削除
273273
return parent::deleteByIdAndBlogId($entry_id, $blog_id, $options);
@@ -354,7 +354,7 @@ public function increaseCommentCount($blog_id, $entry_id)
354354
{
355355
$sql = 'UPDATE ' . $this->getTableName() . ' SET comment_count=comment_count+1 WHERE blog_id=? AND id=?';
356356
$params = array($blog_id, $entry_id);
357-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
357+
$options['result'] = DBInterface::RESULT_SUCCESS;
358358
return $this->executeSql($sql, $params, $options);
359359
}
360360

@@ -365,7 +365,7 @@ public function decreaseCommentCount($blog_id, $entry_id)
365365
{
366366
$sql = 'UPDATE ' . $this->getTableName() . ' SET comment_count=comment_count-1 WHERE blog_id=? AND id=? AND comment_count>0';
367367
$params = array($blog_id, $entry_id);
368-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
368+
$options['result'] = DBInterface::RESULT_SUCCESS;
369369
return $this->executeSql($sql, $params, $options);
370370
}
371371

@@ -375,7 +375,7 @@ public function decreaseCommentCount($blog_id, $entry_id)
375375
*/
376376
public function getTemplateRecents($blog_id)
377377
{
378-
$blog_setting = \Fc2blog\Model\Model::load('BlogSettings')->findByBlogId($blog_id);
378+
$blog_setting = Model::load('BlogSettings')->findByBlogId($blog_id);
379379
$options = array(
380380
'where' => 'blog_id=?',
381381
'params' => array($blog_id),

‎app/src/Model/EntryCategoriesModel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Fc2blog\Model;
44

5-
class EntryCategoriesModel extends \Fc2blog\Model\Model
5+
class EntryCategoriesModel extends Model
66
{
77

88
public static $instance = null;
@@ -64,7 +64,7 @@ public function getCategoryIds($blog_id, $entry_id)
6464
*/
6565
public function save($blog_id, $entry_id, $data)
6666
{
67-
$categories_model = \Fc2blog\Model\Model::load('Categories');
67+
$categories_model = Model::load('Categories');
6868

6969
// 登録済みのカテゴリを取得
7070
$now_category_ids = $this->getCategoryIds($blog_id, $entry_id);
@@ -112,7 +112,7 @@ public function deleteEntryRelation($blog_id, $entry_id)
112112
{
113113
$category_ids = $this->getCategoryIds($blog_id, $entry_id);
114114
if (count($category_ids)) {
115-
\Fc2blog\Model\Model::load('Categories')->decreaseCount($blog_id, $category_ids);
115+
Model::load('Categories')->decreaseCount($blog_id, $category_ids);
116116
}
117117
return $this->delete('blog_id=? AND entry_id=?', array($blog_id, $entry_id));
118118
}

‎app/src/Model/EntryTagsModel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Fc2blog\Model;
44

5-
class EntryTagsModel extends \Fc2blog\Model\Model
5+
class EntryTagsModel extends Model
66
{
77

88
public static $instance = null;
@@ -64,7 +64,7 @@ public function getTagIds($blog_id, $entry_id)
6464
*/
6565
public function save($blog_id, $entry_id, $tags)
6666
{
67-
$tags_model = \Fc2blog\Model\Model::load('Tags');
67+
$tags_model = Model::load('Tags');
6868

6969
// 入力値整形処理
7070
if (!is_array($tags)) {
@@ -137,7 +137,7 @@ public function deleteEntryRelation($blog_id, $entry_id)
137137
{
138138
$tag_ids = $this->getTagIds($blog_id, $entry_id);
139139
if (count($tag_ids)) {
140-
\Fc2blog\Model\Model::load('Tags')->decreaseCount($blog_id, $tag_ids);
140+
Model::load('Tags')->decreaseCount($blog_id, $tag_ids);
141141
}
142142
return $this->delete('blog_id=? AND entry_id=?', array($blog_id, $entry_id));
143143
}

‎app/src/Model/Fc2TemplatesModel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Fc2blog\Model;
88

9-
class Fc2TemplatesModel extends \Fc2blog\Model\Model
9+
class Fc2TemplatesModel extends Model
1010
{
1111

1212
public static $instance = null;

‎app/src/Model/FilesModel.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
use Fc2blog\App;
66
use Fc2blog\Config;
77

8-
class FilesModel extends \Fc2blog\Model\Model{
8+
class FilesModel extends Model
9+
{
910

1011
public static $instance = null;
1112

‎app/src/Model/MSDB.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function find($sql, $params=array(), $options=array()){
109109
$_options = array(
110110
'master' => false, // Masterから取得するかどうか
111111
'types' => '', // paramsの型設定(sdi)
112-
'result' => \Fc2blog\Model\DBInterface::RESULT_ALL, // 戻り値 one/row/all/statment...
112+
'result' => DBInterface::RESULT_ALL, // 戻り値 one/row/all/statment...
113113
);
114114
$options = array_merge($_options, $options);
115115
$db = $this->getDB($options['master']);
@@ -122,7 +122,7 @@ public function find($sql, $params=array(), $options=array()){
122122
public function execute($sql, $params=array(), $options=array()){
123123
$_options = array(
124124
'types' => '', // paramsの型設定(sdi)
125-
'result' => \Fc2blog\Model\DBInterface::RESULT_AFFECTED, // 戻り値 one/row/all/statment...
125+
'result' => DBInterface::RESULT_AFFECTED, // 戻り値 one/row/all/statment...
126126
);
127127
$options = array_merge($_options, $options);
128128
$db = $this->getMasterDB();

‎app/src/Model/Model.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use Fc2blog\Debug;
1010

11-
abstract class Model implements \Fc2blog\Model\ModelInterface
11+
abstract class Model implements ModelInterface
1212
{
1313
const LIKE_WILDCARD = '\\_%'; // MySQL用
1414

@@ -25,7 +25,7 @@ protected function getAutoIncrementCompositeKey()
2525

2626
public function getDB()
2727
{
28-
return \Fc2blog\Model\MSDB::getInstance();
28+
return MSDB::getInstance();
2929
}
3030

3131
public function close()
@@ -56,7 +56,7 @@ public function validate($data, &$valid_data, $white_list=array())
5656
if (!isset($data[$key])) {
5757
$data[$key] = null;
5858
}
59-
$error = \Fc2blog\Model\Validate::$method($data[$key], $options, $key, $data, $this);
59+
$error = Validate::$method($data[$key], $options, $key, $data, $this);
6060
if ($error === false) {
6161
break;
6262
}
@@ -131,24 +131,24 @@ public function find($type, $options=array())
131131
case 'count':
132132
$options['fields'] = 'COUNT(*)';
133133
$options['limit'] = 1;
134-
$options['options']['result'] = \Fc2blog\Model\DBInterface::RESULT_ONE;
134+
$options['options']['result'] = DBInterface::RESULT_ONE;
135135
break;
136136
case 'one':
137137
$options['limit'] = 1;
138-
$options['options']['result'] = \Fc2blog\Model\DBInterface::RESULT_ONE;
138+
$options['options']['result'] = DBInterface::RESULT_ONE;
139139
break;
140140
case 'row':
141141
$options['limit'] = 1;
142-
$options['options']['result'] = \Fc2blog\Model\DBInterface::RESULT_ROW;
142+
$options['options']['result'] = DBInterface::RESULT_ROW;
143143
break;
144144
case 'list':
145-
$options['options']['result'] = \Fc2blog\Model\DBInterface::RESULT_LIST;
145+
$options['options']['result'] = DBInterface::RESULT_LIST;
146146
break;
147147
case 'all':
148-
$options['options']['result'] = \Fc2blog\Model\DBInterface::RESULT_ALL;
148+
$options['options']['result'] = DBInterface::RESULT_ALL;
149149
break;
150150
case 'statment': default:
151-
$options['options']['result'] = \Fc2blog\Model\DBInterface::RESULT_STAT;
151+
$options['options']['result'] = DBInterface::RESULT_STAT;
152152
break;
153153
}
154154
$fields = '*';
@@ -266,7 +266,7 @@ public function getPaging($options=array())
266266
public function getFoundRows()
267267
{
268268
$sql = 'SELECT FOUND_ROWS()';
269-
return $this->findSql($sql, array(), array('result'=>\Fc2blog\Model\DBInterface::RESULT_ONE));
269+
return $this->findSql($sql, array(), array('result'=> DBInterface::RESULT_ONE));
270270
}
271271

272272
/**
@@ -308,7 +308,7 @@ public function insert($values, $options=array())
308308
$values = array_values($values);
309309
}
310310
if (!isset($options['result'])) {
311-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_INSERT_ID;
311+
$options['result'] = DBInterface::RESULT_INSERT_ID;
312312
}
313313
return $this->executeSql($sql, $values, $options);
314314
}
@@ -324,7 +324,7 @@ public function update($values, $where, $params=array(), $options=array())
324324
}
325325
$sql = 'UPDATE ' . $this->getTableName() . ' SET ' . implode(',', $sets) . ' WHERE ' . $where;
326326
$params = array_merge(array_values($values), $params);
327-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
327+
$options['result'] = DBInterface::RESULT_SUCCESS;
328328
return $this->executeSql($sql, $params, $options);
329329
}
330330

@@ -350,7 +350,7 @@ public function updateByIdAndBlogId($values, $id, $blog_id, $options=array())
350350
public function delete($where, $params=array(), $options=array())
351351
{
352352
$sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE ' . $where;
353-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
353+
$options['result'] = DBInterface::RESULT_SUCCESS;
354354
return $this->executeSql($sql, $params, $options);
355355
}
356356

@@ -387,13 +387,13 @@ public function multipleInsert($columns=array(), $params=array(), $options=array
387387
$sqls[] = '(' . implode(',',array_fill(0, count($columns), '?')) . ')';
388388
}
389389
$sql .= implode(',', $sqls);
390-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_INSERT_ID;
390+
$options['result'] = DBInterface::RESULT_INSERT_ID;
391391
return $this->executeSql($sql, $params, $options);
392392
}
393393

394394
public function insertSql($sql, $params=array(), $options=array())
395395
{
396-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_INSERT_ID;
396+
$options['result'] = DBInterface::RESULT_INSERT_ID;
397397
return $this->executeSql($sql, $params, $options);
398398
}
399399

‎app/src/Model/TagsModel.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Fc2blog\Model;
44

5-
class TagsModel extends \Fc2blog\Model\Model
5+
class TagsModel extends Model
66
{
77

88
public static $instance = null;
@@ -154,7 +154,7 @@ public function getEntryTags($blog_id, $entry_id)
154154
SQL;
155155
$params = array($blog_id, $entry_id, $blog_id);
156156
$options = array();
157-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_ALL;
157+
$options['result'] = DBInterface::RESULT_ALL;
158158
return $this->findSql($sql, $params, $options);
159159
}
160160

@@ -178,7 +178,7 @@ public function getEntriesTags($blog_id, $entry_ids)
178178
SQL;
179179
$params = array_merge(array($blog_id), $entry_ids, array($blog_id));
180180
$options = array();
181-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_ALL;
181+
$options['result'] = DBInterface::RESULT_ALL;
182182
$tags = $this->findSql($sql, $params, $options);
183183
$entries_tags = array();
184184

@@ -202,7 +202,7 @@ public function increaseCount($blog_id, $ids=array())
202202
}
203203
$sql = 'UPDATE ' . $this->getTableName() . ' SET count=count+1 WHERE blog_id=? AND id IN (' . implode(',', array_fill(0, count($ids), '?')) . ')';
204204
$params = array_merge(array($blog_id), $ids);
205-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
205+
$options['result'] = DBInterface::RESULT_SUCCESS;
206206
return $this->executeSql($sql, $params, $options);
207207
}
208208

@@ -216,7 +216,7 @@ public function decreaseCount($blog_id, $ids=array())
216216
}
217217
$sql = 'UPDATE ' . $this->getTableName() . ' SET count=count-1 WHERE blog_id=? AND count>0 AND id IN (' . implode(',', array_fill(0, count($ids), '?')) . ')';
218218
$params = array_merge(array($blog_id), $ids);
219-
$options['result'] = \Fc2blog\Model\DBInterface::RESULT_SUCCESS;
219+
$options['result'] = DBInterface::RESULT_SUCCESS;
220220
return $this->executeSql($sql, $params, $options) && $this->delete('blog_id=? AND count<=0', array($blog_id));
221221
}
222222

@@ -226,7 +226,7 @@ public function decreaseCount($blog_id, $ids=array())
226226
public function deleteByIdAndBlogId($tag_id, $blog_id, $options=array())
227227
{
228228
// タグの紐付け情報削除
229-
\Fc2blog\Model\Model::load('EntryTags')->delete('blog_id=? AND tag_id=?', array($blog_id, $tag_id));
229+
Model::load('EntryTags')->delete('blog_id=? AND tag_id=?', array($blog_id, $tag_id));
230230

231231
// 記事本体削除
232232
return parent::deleteByIdAndBlogId($tag_id, $blog_id, $options);

‎app/src/Model/UsersModel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Fc2blog\Config;
66
use Fc2blog\Web\Session;
77

8-
class UsersModel extends \Fc2blog\Model\Model
8+
class UsersModel extends Model
99
{
1010

1111
public static $instance = null;
@@ -45,7 +45,7 @@ private function setValidate($white_list)
4545
);
4646
if (in_array('login_blog_id', $white_list)) {
4747
$this->validates['login_blog_id'] = array(
48-
'in_array' => array('values'=>array_keys(\Fc2blog\Model\Model::load('Blogs')->getListByUserId(Session::get('user_id')))),
48+
'in_array' => array('values'=>array_keys(Model::load('Blogs')->getListByUserId(Session::get('user_id')))),
4949
);
5050
}
5151
}
@@ -147,7 +147,7 @@ public function isExistAdmin()
147147
*/
148148
public function deleteById($user_id, $options=array())
149149
{
150-
$blogs_model = \Fc2blog\Model\Model::load('Blogs');
150+
$blogs_model = Model::load('Blogs');
151151

152152
// ユーザーが所持しているブログを全て削除
153153
$blogs = $blogs_model->findByUserId($user_id);

‎app/src/Model/Validate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public static function multiple(&$values, $valid, $k, $d, $model)
235235
foreach ($valid as $mKey => $options) {
236236
$method = is_array($options) && isset($options['rule']) ? $options['rule'] : $mKey;
237237
foreach ($values as $key => $value) {
238-
$error = \Fc2blog\Model\Validate::$method($values[$key], $options, $key, $values, $model);
238+
$error = Validate::$method($values[$key], $options, $key, $values, $model);
239239
if ($error === false) {
240240
break;
241241
}

‎app/src/Web/Controller/AppController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Fc2blog\Web\Request;
1414
use Fc2blog\Web\Session;
1515

16-
abstract class AppController extends \Fc2blog\Web\Controller\Controller
16+
abstract class AppController extends Controller
1717
{
1818

1919
/**

‎app/src/Web/Session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static function destroy()
9797
{
9898
$_SESSION = array();
9999
if (isset($_COOKIE[Config::get('SESSION_NAME')])) {
100-
\Fc2blog\Web\Cookie::remove(Config::get('SESSION_NAME'), '');
100+
Cookie::remove(Config::get('SESSION_NAME'), '');
101101
}
102102
session_destroy();
103103
}

‎app/src/Web/html.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Html
2222
public static function url($args=array(), $reused=false, $full_url=false){
2323
// 現在のURLの引数を引き継ぐ
2424
if ($reused==true) {
25-
$gets = \Fc2blog\Web\Request::getInstance()->getGet();;
25+
$gets = Request::getInstance()->getGet();;
2626
unset($gets[Config::get('ARGS_CONTROLLER')]);
2727
unset($gets[Config::get('ARGS_ACTION')]);
2828
$args = array_merge($gets, $args);
@@ -97,7 +97,7 @@ public static function url($args=array(), $reused=false, $full_url=false){
9797
}
9898

9999
public static function input($name, $type, $attrs=array(), $option_attrs=array()){
100-
$request = \Fc2blog\Web\Request::getInstance();
100+
$request = Request::getInstance();
101101

102102
$default = isset($attrs['default']) ? $attrs['default'] : null; // デフォルト文字列
103103
$options = isset($attrs['options']) ? $attrs['options'] : array(); // オプション
@@ -155,7 +155,7 @@ public static function input($name, $type, $attrs=array(), $option_attrs=array()
155155
break;
156156

157157
case 'token':
158-
$html = '<input type="hidden" ' . $attr . ' value="' . h(\Fc2blog\Web\Session::get($name)) . '" />';
158+
$html = '<input type="hidden" ' . $attr . ' value="' . h(Session::get($name)) . '" />';
159159
break;
160160

161161
case 'captcha':

0 commit comments

Comments
 (0)
Please sign in to comment.