This commit is contained in:
joyqi 2021-09-09 18:20:30 +08:00
parent 729dcf729a
commit bf2cb07e4b
22 changed files with 100 additions and 98 deletions

View File

@ -64,7 +64,7 @@ class Plugin
public function __construct(string $handle)
{
if (defined('__TYPECHO_CLASS_ALIASES__')) {
$alias = array_search($handle, __TYPECHO_CLASS_ALIASES__);
$alias = array_search('\\' . ltrim($handle, '\\'), __TYPECHO_CLASS_ALIASES__);
$handle = $alias ?: $handle;
}

View File

@ -356,7 +356,7 @@ abstract class Widget
public function __call(string $name, array $args)
{
$method = 'call' . ucfirst($name);
$this->pluginHandle()->trigger($plugged)->{$method}($this, $args);
self::pluginHandle()->trigger($plugged)->{$method}($this, $args);
if (!$plugged) {
echo $this->{$name};
@ -389,7 +389,7 @@ abstract class Widget
if (method_exists($this, $method)) {
return $this->$method();
} else {
$return = $this->pluginHandle()->trigger($plugged)->{$method}($this);
$return = self::pluginHandle()->trigger($plugged)->{$method}($this);
if ($plugged) {
return $return;
}

View File

@ -667,7 +667,7 @@ class Archive extends Contents
$hasPushed = false;
/** select初始化 */
$select = $this->pluginHandle()->trigger($selectPlugged)->select($this);
$select = self::pluginHandle()->trigger($selectPlugged)->select($this);
/** 定时发布功能 */
if (!$selectPlugged) {
@ -708,7 +708,7 @@ class Archive extends Contents
}
/** handle初始化 */
$this->pluginHandle()->handleInit($this, $select);
self::pluginHandle()->handleInit($this, $select);
/** 初始化其它变量 */
$this->feedUrl = $this->options->feedUrl;
@ -721,7 +721,7 @@ class Archive extends Contents
$handle = $handles[$this->parameter->type];
$this->{$handle}($select, $hasPushed);
} else {
$hasPushed = $this->pluginHandle()->handle($this->parameter->type, $this, $select);
$hasPushed = self::pluginHandle()->handle($this->parameter->type, $this, $select);
}
/** 初始化皮肤函数 */
@ -809,7 +809,7 @@ class Archive extends Contents
$template = array_merge($default, $config);
$total = $this->getTotal();
$this->pluginHandle()->trigger($hasNav)->pageNav(
self::pluginHandle()->trigger($hasNav)->pageNav(
$this->currentPage,
$total,
$this->parameter->pageSize,
@ -1056,7 +1056,7 @@ class Archive extends Contents
$allows = array_merge($allows, $rules);
}
$allows = $this->pluginHandle()->headerOptions($allows, $this);
$allows = self::pluginHandle()->headerOptions($allows, $this);
$title = (empty($this->archiveTitle) ? '' : $this->archiveTitle . ' » ') . $this->options->title;
$header = '';
@ -1240,7 +1240,7 @@ class Archive extends Contents
echo $header;
/** 插件支持 */
$this->pluginHandle()->header($header, $this);
self::pluginHandle()->header($header, $this);
}
/**
@ -1248,7 +1248,7 @@ class Archive extends Contents
*/
public function footer()
{
$this->pluginHandle()->footer($this);
self::pluginHandle()->footer($this);
}
/**
@ -1389,13 +1389,13 @@ class Archive extends Contents
}
/** 挂接插件 */
$this->pluginHandle()->beforeRender($this);
self::pluginHandle()->beforeRender($this);
/** 输出模板 */
require_once $this->themeDir . $this->themeFile;
/** 挂接插件 */
$this->pluginHandle()->afterRender($this);
self::pluginHandle()->afterRender($this);
}
/**
@ -1426,7 +1426,7 @@ class Archive extends Contents
}
while ($comments->next()) {
$suffix = $this->pluginHandle()->trigger($plugged)->commentFeedItem($this->feedType, $comments);
$suffix = self::pluginHandle()->trigger($plugged)->commentFeedItem($this->feedType, $comments);
if (!$plugged) {
$suffix = null;
}
@ -1449,7 +1449,7 @@ class Archive extends Contents
$this->feed->setTitle($this->options->title . ($this->archiveTitle ? ' - ' . $this->archiveTitle : null));
while ($this->next()) {
$suffix = $this->pluginHandle()->trigger($plugged)->feedItem($this->feedType, $this);
$suffix = self::pluginHandle()->trigger($plugged)->feedItem($this->feedType, $this);
if (!$plugged) {
$suffix = null;
}
@ -1508,7 +1508,7 @@ class Archive extends Contents
*/
public function query($select)
{
$this->pluginHandle()->trigger($queryPlugged)->query($this, $select);
self::pluginHandle()->trigger($queryPlugged)->query($this, $select);
if (!$queryPlugged) {
$this->db->fetchAll($select, [$this, 'push']);
}
@ -1616,7 +1616,7 @@ class Archive extends Contents
$select->where('table.contents.type = ?', 'post');
/** 插件接口 */
$this->pluginHandle()->indexHandle($this, $select);
self::pluginHandle()->indexHandle($this, $select);
}
/**
@ -1660,7 +1660,7 @@ class Archive extends Contents
$hasPushed = true;
/** 插件接口 */
$this->pluginHandle()->error404Handle($this, $select);
self::pluginHandle()->error404Handle($this, $select);
}
/**
@ -1823,7 +1823,7 @@ class Archive extends Contents
$hasPushed = true;
/** 插件接口 */
$this->pluginHandle()->singleHandle($this, $select);
self::pluginHandle()->singleHandle($this, $select);
}
/**
@ -1907,7 +1907,7 @@ class Archive extends Contents
$this->archiveSlug = $category['slug'];
/** 插件接口 */
$this->pluginHandle()->categoryHandle($this, $select);
self::pluginHandle()->categoryHandle($this, $select);
}
/**
@ -1976,7 +1976,7 @@ class Archive extends Contents
$this->archiveSlug = $tag['slug'];
/** 插件接口 */
$this->pluginHandle()->tagHandle($this, $select);
self::pluginHandle()->tagHandle($this, $select);
}
/**
@ -2032,7 +2032,7 @@ class Archive extends Contents
$this->archiveSlug = $author['uid'];
/** 插件接口 */
$this->pluginHandle()->authorHandle($this, $select);
self::pluginHandle()->authorHandle($this, $select);
}
/**
@ -2115,7 +2115,7 @@ class Archive extends Contents
$this->feedAtomUrl = Router::url($currentRoute, $value, $this->options->feedAtomUrl);
/** 插件接口 */
$this->pluginHandle()->dateHandle($this, $select);
self::pluginHandle()->dateHandle($this, $select);
}
/**
@ -2131,7 +2131,7 @@ class Archive extends Contents
/** 增加自定义搜索引擎接口 */
//~ fix issue 40
$keywords = $this->request->filter('url', 'search')->keywords;
$this->pluginHandle()->trigger($hasPushed)->search($keywords, $this);
self::pluginHandle()->trigger($hasPushed)->search($keywords, $this);
if (!$hasPushed) {
$searchQuery = '%' . str_replace(' ', '%', $keywords) . '%';
@ -2175,6 +2175,6 @@ class Archive extends Contents
$this->archiveSlug = $keywords;
/** 插件接口 */
$this->pluginHandle()->searchHandle($this, $select);
self::pluginHandle()->searchHandle($this, $select);
}
}

View File

@ -126,7 +126,7 @@ class Backup extends BaseOptions implements ActionInterface
} while (count($rows) == 20);
}
$this->pluginHandle()->export($fp);
self::pluginHandle()->export($fp);
fwrite($fp, $header);
fclose($fp);
@ -322,7 +322,7 @@ class Backup extends BaseOptions implements ActionInterface
$this->importData($table, $data);
} else {
$this->pluginHandle()->import($type, $header, $body);
self::pluginHandle()->import($type, $header, $body);
}
}

View File

@ -235,7 +235,7 @@ class Comments extends Base implements QueryInterface
public function filter(array $value): array
{
$value['date'] = new Date($value['created']);
return $this->pluginHandle()->filter($value, $this);
return Comments::pluginHandle()->filter($value, $this);
}
/**
@ -278,7 +278,7 @@ class Comments extends Base implements QueryInterface
if ($this->options->commentsAvatar && 'comment' == $this->type) {
$rating = $this->options->commentsAvatarRating;
$this->pluginHandle()->trigger($plugged)->gravatar($size, $rating, $default, $this);
Comments::pluginHandle()->trigger($plugged)->gravatar($size, $rating, $default, $this);
if (!$plugged) {
$url = Common::gravatarUrl($this->mail, $size, $rating, $default, $this->request->isSecure());
echo '<img class="avatar" src="' . $url . '" alt="' .
@ -333,7 +333,7 @@ class Comments extends Base implements QueryInterface
*/
public function markdown(?string $text): string
{
$html = $this->pluginHandle()->trigger($parsed)->markdown($text);
$html = Comments::pluginHandle()->trigger($parsed)->markdown($text);
if (!$parsed) {
$html = Markdown::convert($text);
@ -350,7 +350,7 @@ class Comments extends Base implements QueryInterface
*/
public function autoP(?string $text): string
{
$html = $this->pluginHandle()->trigger($parsed)->autoP($text);
$html = Comments::pluginHandle()->trigger($parsed)->autoP($text);
if (!$parsed) {
static $parser;
@ -457,13 +457,13 @@ class Comments extends Base implements QueryInterface
{
$text = $this->parentContent['hidden'] ? _t('内容被隐藏') : $this->text;
$text = $this->pluginHandle()->trigger($plugged)->content($text, $this);
$text = Comments::pluginHandle()->trigger($plugged)->content($text, $this);
if (!$plugged) {
$text = $this->options->commentsMarkdown ? $this->markdown($text)
: $this->autoP($text);
}
$text = $this->pluginHandle()->contentEx($text, $this);
$text = Comments::pluginHandle()->contentEx($text, $this);
return Common::stripTags($text, '<p><br>' . $this->options->commentsHTMLTagAllowed);
}

View File

@ -311,7 +311,7 @@ class Contents extends Base implements QueryInterface
continue;
}
$isFieldReadOnly = $this->pluginHandle()->trigger($plugged)->isFieldReadOnly($name);
$isFieldReadOnly = Contents::pluginHandle()->trigger($plugged)->isFieldReadOnly($name);
if ($plugged && $isFieldReadOnly) {
continue;
}
@ -593,7 +593,7 @@ class Contents extends Base implements QueryInterface
$value['hidden'] = true;
}
$value = $this->pluginHandle()->filter($value, $this);
$value = Contents::pluginHandle()->filter($value, $this);
/** 如果访问权限被禁止 */
if ($value['hidden']) {
@ -655,7 +655,7 @@ class Contents extends Base implements QueryInterface
*/
public function title(int $length = 0, string $trim = '...')
{
$title = $this->pluginHandle()->trigger($plugged)->title($this->title, $this);
$title = Contents::pluginHandle()->trigger($plugged)->title($this->title, $this);
if (!$plugged) {
echo $length > 0 ? Common::subStr($this->title, 0, $length, $trim) : $this->title;
} else {
@ -882,7 +882,7 @@ class Contents extends Base implements QueryInterface
return $this->text;
}
$content = $this->pluginHandle()->trigger($plugged)->excerpt($this->text, $this);
$content = Contents::pluginHandle()->trigger($plugged)->excerpt($this->text, $this);
if (!$plugged) {
$content = $this->isMarkdown ? $this->markdown($content)
: $this->autoP($content);
@ -891,7 +891,7 @@ class Contents extends Base implements QueryInterface
$contents = explode('<!--more-->', $content);
[$excerpt] = $contents;
return Common::fixHtml($this->pluginHandle()->excerptEx($excerpt, $this));
return Common::fixHtml(Contents::pluginHandle()->excerptEx($excerpt, $this));
}
/**
@ -902,7 +902,7 @@ class Contents extends Base implements QueryInterface
*/
public function markdown(?string $text): string
{
$html = $this->pluginHandle()->trigger($parsed)->markdown($text);
$html = Contents::pluginHandle()->trigger($parsed)->markdown($text);
if (!$parsed) {
$html = Markdown::convert($text);
@ -919,7 +919,7 @@ class Contents extends Base implements QueryInterface
*/
public function autoP(?string $text): string
{
$html = $this->pluginHandle()->trigger($parsed)->autoP($text);
$html = Contents::pluginHandle()->trigger($parsed)->autoP($text);
if (!$parsed) {
static $parser;
@ -945,14 +945,14 @@ class Contents extends Base implements QueryInterface
return $this->text;
}
$content = $this->pluginHandle()->trigger($plugged)->content($this->text, $this);
$content = Contents::pluginHandle()->trigger($plugged)->content($this->text, $this);
if (!$plugged) {
$content = $this->isMarkdown ? $this->markdown($content)
: $this->autoP($content);
}
return $this->pluginHandle()->contentEx($content, $this);
return Contents::pluginHandle()->contentEx($content, $this);
}
/**

View File

@ -5,6 +5,7 @@ namespace Widget\Base;
use Typecho\Common;
use Typecho\Db\Exception;
use Typecho\Db\Query;
use Typecho\Plugin;
use Typecho\Router;
use Widget\Base;
@ -83,7 +84,7 @@ class Metas extends Base implements QueryInterface
$value['feedAtomUrl'] = $routeExists ? Router::url($type, $value, $this->options->feedAtomUrl) : '#';
$value['slug'] = $tmpSlug;
$value = $this->pluginHandle()->filter($value, $this);
$value = Metas::pluginHandle()->filter($value, $this);
return $value;
}

View File

@ -6,6 +6,7 @@ use Typecho\Common;
use Typecho\Config;
use Typecho\Db\Exception;
use Typecho\Db\Query;
use Typecho\Plugin;
use Typecho\Router;
use Widget\Base;
@ -136,7 +137,7 @@ class Users extends Base implements QueryInterface
/** ATOM 1.0 */
$value['feedAtomUrl'] = $routeExists ? Router::url('author', $value, $this->options->feedAtomUrl) : '#';
$value = $this->pluginHandle()->filter($value, $this);
$value = Users::pluginHandle()->filter($value, $this);
return $value;
}

View File

@ -273,7 +273,7 @@ class Archive extends Comments
'avatarSize' => 32,
'defaultAvatar' => null
]);
$this->pluginHandle()->trigger($plugged)->listComments($this->singleCommentOptions, $this);
self::pluginHandle()->trigger($plugged)->listComments($this->singleCommentOptions, $this);
if (!$plugged) {
if ($this->have()) {
@ -390,7 +390,7 @@ class Archive extends Comments
{
if ($this->options->commentsThreaded && !$this->isTopLevel && $this->parameter->allowComment) {
$word = empty($word) ? _t('回复') : $word;
$this->pluginHandle()->trigger($plugged)->reply($word, $this);
self::pluginHandle()->trigger($plugged)->reply($word, $this);
if (!$plugged) {
echo '<a href="' . substr($this->permalink, 0, - strlen($this->theId) - 1) . '?replyTo=' . $this->coid .
@ -436,7 +436,7 @@ class Archive extends Comments
{
if ($this->options->commentsThreaded) {
$word = empty($word) ? _t('取消回复') : $word;
$this->pluginHandle()->trigger($plugged)->cancelReply($word, $this);
self::pluginHandle()->trigger($plugged)->cancelReply($word, $this);
if (!$plugged) {
$replyId = $this->request->filter('int')->replyTo;

View File

@ -62,7 +62,7 @@ class Edit extends Comments implements ActionInterface
if ($comment && $this->commentIsWriteable()) {
/** 增加评论编辑插件接口 */
$this->pluginHandle()->mark($comment, $this, $status);
self::pluginHandle()->mark($comment, $this, $status);
/** 不必更新的情况 */
if ($status == $comment['status']) {
@ -158,7 +158,7 @@ class Edit extends Comments implements ActionInterface
->where('coid = ?', $coid)->limit(1), [$this, 'push']);
if ($comment && $this->commentIsWriteable()) {
$this->pluginHandle()->delete($comment, $this);
self::pluginHandle()->delete($comment, $this);
/** 删除评论 */
$this->db->query($this->db->delete('table.comments')->where('coid = ?', $coid));
@ -169,7 +169,7 @@ class Edit extends Comments implements ActionInterface
->expression('commentsNum', 'commentsNum - 1')->where('cid = ?', $comment['cid']));
}
$this->pluginHandle()->finishDelete($comment, $this);
self::pluginHandle()->finishDelete($comment, $this);
$deleteRows++;
}
@ -275,7 +275,7 @@ class Edit extends Comments implements ActionInterface
}
/** 评论插件接口 */
$this->pluginHandle()->edit($comment, $this);
self::pluginHandle()->edit($comment, $this);
/** 更新评论 */
$this->update($comment, $this->db->sql()->where('coid = ?', $coid));
@ -285,7 +285,7 @@ class Edit extends Comments implements ActionInterface
$updatedComment['content'] = $this->content;
/** 评论插件接口 */
$this->pluginHandle()->finishEdit($this);
self::pluginHandle()->finishEdit($this);
$this->response->throwJson([
'success' => 1,
@ -328,7 +328,7 @@ class Edit extends Comments implements ActionInterface
];
/** 评论插件接口 */
$this->pluginHandle()->comment($comment, $this);
self::pluginHandle()->comment($comment, $this);
/** 回复评论 */
$commentId = $this->insert($comment);
@ -338,7 +338,7 @@ class Edit extends Comments implements ActionInterface
$insertComment['content'] = $this->content;
/** 评论完成接口 */
$this->pluginHandle()->finishComment($this);
self::pluginHandle()->finishComment($this);
$this->response->throwJson([
'success' => 1,

View File

@ -234,7 +234,7 @@ class Edit extends PostEdit implements ActionInterface
foreach ($posts as $post) {
// 删除插件接口
$this->pluginHandle()->delete($post, $this);
self::pluginHandle()->delete($post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$row = $this->db->fetchRow($this->select()
@ -251,7 +251,7 @@ class Edit extends PostEdit implements ActionInterface
->where('cid = ?', $post));
// 完成删除插件接口
$this->pluginHandle()->finishDelete($post, $this);
self::pluginHandle()->finishDelete($post, $this);
$deleteCount++;
}
@ -296,7 +296,7 @@ class Edit extends PostEdit implements ActionInterface
foreach ($posts as $post) {
// 删除插件接口
$this->pluginHandle()->delete($post, $this);
self::pluginHandle()->delete($post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$row = $this->db->fetchRow($this->select()
@ -315,7 +315,7 @@ class Edit extends PostEdit implements ActionInterface
$status = $this->status;
// 完成删除插件接口
$this->pluginHandle()->finishDelete($post, $this);
self::pluginHandle()->finishDelete($post, $this);
$deleteCount++;
}

View File

@ -89,7 +89,7 @@ class Edit extends PostEdit implements ActionInterface
$contents['text'] = '<!--markdown-->' . $contents['text'];
}
$contents = $this->pluginHandle()->write($contents, $this);
$contents = self::pluginHandle()->write($contents, $this);
if ($this->request->is('do=publish')) {
/** 重新发布已经存在的文章 */
@ -97,7 +97,7 @@ class Edit extends PostEdit implements ActionInterface
$this->publish($contents);
// 完成发布插件接口
$this->pluginHandle()->finishPublish($contents, $this);
self::pluginHandle()->finishPublish($contents, $this);
/** 发送ping */
Service::alloc()->sendPing($this->cid);
@ -119,7 +119,7 @@ class Edit extends PostEdit implements ActionInterface
$this->save($contents);
// 完成发布插件接口
$this->pluginHandle()->finishSave($contents, $this);
self::pluginHandle()->finishSave($contents, $this);
/** 设置高亮 */
Notice::alloc()->highlight($this->cid);
@ -164,7 +164,7 @@ class Edit extends PostEdit implements ActionInterface
foreach ($pages as $page) {
// 标记插件接口
$this->pluginHandle()->mark($status, $page, $this);
self::pluginHandle()->mark($status, $page, $this);
$condition = $this->db->sql()->where('cid = ?', $page);
if ($this->db->query($condition->update('table.contents')->rows(['status' => $status]))) {
@ -180,7 +180,7 @@ class Edit extends PostEdit implements ActionInterface
}
// 完成标记插件接口
$this->pluginHandle()->finishMark($status, $page, $this);
self::pluginHandle()->finishMark($status, $page, $this);
$markCount++;
}
@ -211,7 +211,7 @@ class Edit extends PostEdit implements ActionInterface
foreach ($pages as $page) {
// 删除插件接口
$this->pluginHandle()->delete($page, $this);
self::pluginHandle()->delete($page, $this);
if ($this->delete($this->db->sql()->where('cid = ?', $page))) {
/** 删除评论 */
@ -243,7 +243,7 @@ class Edit extends PostEdit implements ActionInterface
}
// 完成删除插件接口
$this->pluginHandle()->finishDelete($page, $this);
self::pluginHandle()->finishDelete($page, $this);
$deleteCount++;
}

View File

@ -201,7 +201,7 @@ class Edit extends Contents implements ActionInterface
$fields = $this->fields;
}
$this->pluginHandle()->getDefaultFieldItems($layout);
self::pluginHandle()->getDefaultFieldItems($layout);
if (file_exists($configFile)) {
require_once $configFile;
@ -277,7 +277,7 @@ class Edit extends Contents implements ActionInterface
$contents['text'] = '<!--markdown-->' . $contents['text'];
}
$contents = $this->pluginHandle()->write($contents, $this);
$contents = self::pluginHandle()->write($contents, $this);
if ($this->request->is('do=publish')) {
/** 重新发布已经存在的文章 */
@ -285,7 +285,7 @@ class Edit extends Contents implements ActionInterface
$this->publish($contents);
// 完成发布插件接口
$this->pluginHandle()->finishPublish($contents, $this);
self::pluginHandle()->finishPublish($contents, $this);
/** 发送ping */
$trackback = array_unique(preg_split("/(\r|\n|\r\n)/", trim($this->request->trackback)));
@ -310,7 +310,7 @@ class Edit extends Contents implements ActionInterface
$this->save($contents);
// 完成保存插件接口
$this->pluginHandle()->finishSave($contents, $this);
self::pluginHandle()->finishSave($contents, $this);
/** 设置高亮 */
Notice::alloc()->highlight($this->cid);
@ -786,7 +786,7 @@ class Edit extends Contents implements ActionInterface
foreach ($posts as $post) {
// 标记插件接口
$this->pluginHandle()->mark($status, $post, $this);
self::pluginHandle()->mark($status, $post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$postObject = $this->db->fetchObject($this->db->select('status', 'type')
@ -831,7 +831,7 @@ class Edit extends Contents implements ActionInterface
}
// 完成标记插件接口
$this->pluginHandle()->finishMark($status, $post, $this);
self::pluginHandle()->finishMark($status, $post, $this);
$markCount++;
}
@ -862,7 +862,7 @@ class Edit extends Contents implements ActionInterface
foreach ($posts as $post) {
// 删除插件接口
$this->pluginHandle()->delete($post, $this);
self::pluginHandle()->delete($post, $this);
$condition = $this->db->sql()->where('cid = ?', $post);
$postObject = $this->db->fetchObject($this->db->select('status', 'type')
@ -900,7 +900,7 @@ class Edit extends Contents implements ActionInterface
}
// 完成删除插件接口
$this->pluginHandle()->finishDelete($post, $this);
self::pluginHandle()->finishDelete($post, $this);
$deleteCount++;
}

View File

@ -255,7 +255,7 @@ class Feedback extends Comments implements ActionInterface
/** 生成过滤器 */
try {
$comment = $this->pluginHandle()->comment($comment, $this->content);
$comment = self::pluginHandle()->comment($comment, $this->content);
} catch (\Typecho\Exception $e) {
Cookie::set('__typecho_remember_text', $comment['text']);
throw $e;
@ -268,7 +268,7 @@ class Feedback extends Comments implements ActionInterface
->limit(1), [$this, 'push']);
/** 评论完成接口 */
$this->pluginHandle()->finishComment($this);
self::pluginHandle()->finishComment($this);
$this->response->goBack('#' . $this->theId);
}
@ -337,13 +337,13 @@ class Feedback extends Comments implements ActionInterface
}
/** 生成过滤器 */
$trackback = $this->pluginHandle()->trackback($trackback, $this->content);
$trackback = self::pluginHandle()->trackback($trackback, $this->content);
/** 添加引用 */
$this->insert($trackback);
/** 评论完成接口 */
$this->pluginHandle()->finishTrackback($this);
self::pluginHandle()->finishTrackback($this);
/** 返回正确 */
$this->response->throwXml(['success' => 0, 'message' => 'Trackback has registered.']);

View File

@ -64,7 +64,7 @@ class Login extends Users implements ActionInterface
/** 防止穷举,休眠3秒 */
sleep(3);
$this->pluginHandle()->loginFail(
self::pluginHandle()->loginFail(
$this->user,
$this->request->name,
$this->request->password,
@ -76,7 +76,7 @@ class Login extends Users implements ActionInterface
$this->response->goBack('?referer=' . urlencode($this->request->referer));
}
$this->pluginHandle()->loginSucceed(
self::pluginHandle()->loginSucceed(
$this->user,
$this->request->name,
$this->request->password,

View File

@ -30,7 +30,7 @@ class Logout extends Users implements ActionInterface
$this->security->protect();
$this->user->logout();
$this->pluginHandle()->logout();
self::pluginHandle()->logout();
@session_destroy();
$this->response->goBack(null, $this->options->index);
}

View File

@ -173,7 +173,7 @@ class Rows extends Metas
]);
// 插件插件接口
$this->pluginHandle()->trigger($plugged)->listCategories($this->categoryOptions, $this);
self::pluginHandle()->trigger($plugged)->listCategories($this->categoryOptions, $this);
if (!$plugged) {
$this->stack = $this->getCategories($this->top);

View File

@ -80,13 +80,13 @@ class Register extends Users implements ActionInterface
'group' => 'subscriber'
];
$dataStruct = $this->pluginHandle()->register($dataStruct);
$dataStruct = self::pluginHandle()->register($dataStruct);
$insertId = $this->insert($dataStruct);
$this->db->fetchRow($this->select()->where('uid = ?', $insertId)
->limit(1), [$this, 'push']);
$this->pluginHandle()->finishRegister($this);
self::pluginHandle()->finishRegister($this);
$this->user->login($this->request->name, $generatedPassword);

View File

@ -259,7 +259,7 @@ class Service extends BaseOptions implements ActionInterface
}
$requests = json_decode($this->request->requests, true);
$plugin = $this->pluginHandle();
$plugin = self::pluginHandle();
if (!empty($requests)) {
foreach ($requests as $request) {

View File

@ -130,7 +130,7 @@ class Upload extends Contents implements ActionInterface
$result = self::modifyHandle($this->row, $file);
if (false !== $result) {
$this->pluginHandle()->beforeModify($result);
self::pluginHandle()->beforeModify($result);
$this->update([
'text' => serialize($result)
@ -140,7 +140,7 @@ class Upload extends Contents implements ActionInterface
->where('table.contents.type = ?', 'attachment'), [$this, 'push']);
/** 增加插件接口 */
$this->pluginHandle()->modify($this);
self::pluginHandle()->modify($this);
$this->response->throwJson([$this->attachment->url, [
'cid' => $this->cid,
@ -301,7 +301,7 @@ class Upload extends Contents implements ActionInterface
$result = self::uploadHandle($file);
if (false !== $result) {
$this->pluginHandle()->beforeUpload($result);
self::pluginHandle()->beforeUpload($result);
$struct = [
'title' => $result['name'],
@ -328,7 +328,7 @@ class Upload extends Contents implements ActionInterface
->where('table.contents.type = ?', 'attachment'), [$this, 'push']);
/** 增加插件接口 */
$this->pluginHandle()->upload($this);
self::pluginHandle()->upload($this);
$this->response->throwJson([$this->attachment->url, [
'cid' => $insertId,

View File

@ -122,7 +122,7 @@ class User extends Users
*/
public function logout()
{
$this->pluginHandle()->trigger($logoutPluggable)->logout();
self::pluginHandle()->trigger($logoutPluggable)->logout();
if ($logoutPluggable) {
return;
}
@ -145,7 +145,7 @@ class User extends Users
public function login(string $name, string $password, bool $temporarily = false, int $expire = 0): bool
{
//插件接口
$result = $this->pluginHandle()->trigger($loginPluggable)->login($name, $password, $temporarily, $expire);
$result = self::pluginHandle()->trigger($loginPluggable)->login($name, $password, $temporarily, $expire);
if ($loginPluggable) {
return $result;
}
@ -160,7 +160,7 @@ class User extends Users
return false;
}
$hashValidate = $this->pluginHandle()->trigger($hashPluggable)->hashValidate($password, $user['password']);
$hashValidate = self::pluginHandle()->trigger($hashPluggable)->hashValidate($password, $user['password']);
if (!$hashPluggable) {
if ('$P$' == substr($user['password'], 0, 3)) {
$hasher = new PasswordHash(8, true);
@ -179,12 +179,12 @@ class User extends Users
$this->push($user);
$this->currentUser = $user;
$this->hasLogin = true;
$this->pluginHandle()->loginSucceed($this, $name, $password, $temporarily, $expire);
self::pluginHandle()->loginSucceed($this, $name, $password, $temporarily, $expire);
return true;
}
$this->pluginHandle()->loginFail($this, $name, $password, $temporarily, $expire);
self::pluginHandle()->loginFail($this, $name, $password, $temporarily, $expire);
return false;
}
@ -231,7 +231,7 @@ class User extends Users
}
if (empty($user)) {
$this->pluginHandle()->simpleLoginFail($this);
self::pluginHandle()->simpleLoginFail($this);
return false;
}
@ -243,7 +243,7 @@ class User extends Users
$this->currentUser = $user;
$this->hasLogin = true;
$this->pluginHandle()->simpleLoginSucceed($this, $user);
self::pluginHandle()->simpleLoginSucceed($this, $user);
return true;
}

View File

@ -354,7 +354,7 @@ class XmlRpc extends Contents implements ActionInterface, Hook
$input['text'] = !empty($content['mt_text_more']) ? $content['description']
. "\n<!--more-->\n" . $content['mt_text_more'] : $content['description'];
$input['text'] = $this->pluginHandle()->textFilter($input['text'], $this);
$input['text'] = self::pluginHandle()->textFilter($input['text'], $this);
$input['password'] = $content["wp_password"] ?? null;
$input['order'] = $content["wp_page_order"] ?? null;
@ -1396,7 +1396,7 @@ class XmlRpc extends Contents implements ActionInterface, Hook
->where('table.contents.type = ?', 'attachment'), [$this, 'push']);
/** 增加插件接口 */
$this->pluginHandle()->upload($this);
self::pluginHandle()->upload($this);
return [
'file' => $this->attachment->name,
@ -1729,13 +1729,13 @@ class XmlRpc extends Contents implements ActionInterface, Hook
];
/** 加入plugin */
$pingback = $this->pluginHandle()->pingback($pingback, $post);
$pingback = self::pluginHandle()->pingback($pingback, $post);
/** 执行插入*/
$insertId = Comments::alloc()->insert($pingback);
/** 评论完成接口 */
$this->pluginHandle()->finishPingback($this);
self::pluginHandle()->finishPingback($this);
return $insertId;
} catch (WidgetException $e) {