replace theme and plugin file
This commit is contained in:
@@ -94,7 +94,7 @@ $isAllPosts = ('on' == $request->get('__typecho_all_posts') || 'on' == \Typecho\
|
||||
value="<?php echo htmlspecialchars($request->keywords); ?>" name="keywords"/>
|
||||
<select name="category">
|
||||
<option value=""><?php _e('所有分类'); ?></option>
|
||||
<?php \Typecho\Widget::widget('Widget_Metas_Category_List')->to($category); ?>
|
||||
<?php \Widget\Metas\Category\Rows::alloc()->to($category); ?>
|
||||
<?php while ($category->next()): ?>
|
||||
<option
|
||||
value="<?php $category->mid(); ?>"<?php if ($request->get('category') == $category->mid): ?> selected="true"<?php endif; ?>><?php $category->name(); ?></option>
|
||||
|
||||
@@ -60,7 +60,7 @@ include 'menu.php';
|
||||
|
||||
</div>
|
||||
<div class="col-mb-12 col-tb-4" role="form">
|
||||
<?php \Typecho\Widget::widget('Widget_Metas_Tag_Edit')->form()->render(); ?>
|
||||
<?php \Widget\Metas\Tag\Edit::alloc()->form()->render(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,14 +29,14 @@ $stat = \Widget\Stat::alloc();
|
||||
<div class="col-mb-12 col-tb-6 col-tb-offset-1 typecho-content-panel" role="form">
|
||||
<section>
|
||||
<h3><?php _e('个人资料'); ?></h3>
|
||||
<?php \Typecho\Widget::widget('Widget_Users_Profile')->profileForm()->render(); ?>
|
||||
<?php \Widget\Users\Profile::alloc()->profileForm()->render(); ?>
|
||||
</section>
|
||||
|
||||
<?php if ($user->pass('contributor', true)): ?>
|
||||
<br>
|
||||
<section id="writing-option">
|
||||
<h3><?php _e('撰写设置'); ?></h3>
|
||||
<?php \Typecho\Widget::widget('Widget_Users_Profile')->optionsForm()->render(); ?>
|
||||
<?php \Widget\Users\Profile::alloc()->optionsForm()->render(); ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -44,10 +44,10 @@ $stat = \Widget\Stat::alloc();
|
||||
|
||||
<section id="change-password">
|
||||
<h3><?php _e('密码修改'); ?></h3>
|
||||
<?php \Typecho\Widget::widget('Widget_Users_Profile')->passwordForm()->render(); ?>
|
||||
<?php \Widget\Users\Profile::alloc()->passwordForm()->render(); ?>
|
||||
</section>
|
||||
|
||||
<?php \Typecho\Widget::widget('Widget_Users_Profile')->personalFormList(); ?>
|
||||
<?php \Widget\Users\Profile::alloc()->personalFormList(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php if(!defined('__TYPECHO_ADMIN__')) exit; ?>
|
||||
<?php \Typecho\Plugin::factory('admin/write-js.php')->write(); ?>
|
||||
<?php \Typecho\Widget::widget('Widget_Metas_Tag_Cloud', 'sort=count&desc=1&limit=200')->to($tags); ?>
|
||||
<?php \Widget\Metas\Tag\Cloud::alloc('sort=count&desc=1&limit=200')->to($tags); ?>
|
||||
|
||||
<script src="<?php $options->adminStaticUrl('js', 'timepicker.js'); ?>"></script>
|
||||
<script src="<?php $options->adminStaticUrl('js', 'tokeninput.js'); ?>"></script>
|
||||
|
||||
@@ -82,7 +82,7 @@ include 'menu.php';
|
||||
|
||||
<section class="typecho-post-option category-option">
|
||||
<label class="typecho-label"><?php _e('分类'); ?></label>
|
||||
<?php \Typecho\Widget::widget('Widget_Metas_Category_List')->to($category); ?>
|
||||
<?php \Widget\Metas\Category\Rows::alloc()->to($category); ?>
|
||||
<ul>
|
||||
<?php
|
||||
if ($post->have()) {
|
||||
|
||||
@@ -692,7 +692,7 @@ function install_check_extension(array $extensions): ?string
|
||||
|
||||
function install_step_1()
|
||||
{
|
||||
$langs = Widget_Options_General::getLangs();
|
||||
$langs = \Widget\Options\General::getLangs();
|
||||
$lang = install_get_lang();
|
||||
?>
|
||||
<div class="row typecho-page-main">
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace HellWorld;
|
||||
|
||||
use Typecho\Plugin\PluginInterface;
|
||||
use Typecho\Widget\Helper\Form;
|
||||
use Typecho\Widget\Helper\Form\Element\Text;
|
||||
use Widget\Options;
|
||||
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
|
||||
/**
|
||||
* Hello World
|
||||
*
|
||||
* @package HelloWorld
|
||||
*
|
||||
* @package HelloWorld
|
||||
* @author qining
|
||||
* @version 1.0.0
|
||||
* @link http://typecho.org
|
||||
*/
|
||||
class HelloWorld_Plugin implements Typecho_Plugin_Interface
|
||||
class Plugin implements PluginInterface
|
||||
{
|
||||
/**
|
||||
* 激活插件方法,如果激活失败,直接抛出异常
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @throws Typecho_Plugin_Exception
|
||||
*/
|
||||
public static function activate()
|
||||
{
|
||||
Typecho_Plugin::factory('admin/menu.php')->navBar = array('HelloWorld_Plugin', 'render');
|
||||
\Typecho\Plugin::factory('admin/menu.php')->navBar = ['HelloWorld_Plugin', 'render'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 禁用插件方法,如果禁用失败,直接抛出异常
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return void
|
||||
* @throws Typecho_Plugin_Exception
|
||||
*/
|
||||
public static function deactivate(){}
|
||||
|
||||
public static function deactivate()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件配置面板
|
||||
*
|
||||
* @access public
|
||||
* @param Typecho_Widget_Helper_Form $form 配置面板
|
||||
* @return void
|
||||
*
|
||||
* @param Form $form 配置面板
|
||||
*/
|
||||
public static function config(Typecho_Widget_Helper_Form $form)
|
||||
public static function config(Form $form)
|
||||
{
|
||||
/** 分类名称 */
|
||||
$name = new Typecho_Widget_Helper_Form_Element_Text('word', NULL, 'Hello World', _t('说点什么'));
|
||||
$name = new Text('word', null, 'Hello World', _t('说点什么'));
|
||||
$form->addInput($name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 个人用户的配置面板
|
||||
*
|
||||
* @access public
|
||||
* @param Typecho_Widget_Helper_Form $form
|
||||
* @return void
|
||||
*
|
||||
* @param Form $form
|
||||
*/
|
||||
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
|
||||
|
||||
public static function personalConfig(Form $form)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件实现方法
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function render()
|
||||
{
|
||||
echo '<span class="message success">'
|
||||
. htmlspecialchars(Typecho_Widget::widget('Widget_Options')->plugin('HelloWorld')->word)
|
||||
. htmlspecialchars(Options::alloc()->plugin('HelloWorld')->word)
|
||||
. '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,44 @@
|
||||
<?php
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
|
||||
function themeConfig($form) {
|
||||
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点 LOGO 地址'), _t('在这里填入一个图片 URL 地址, 以在网站标题前加上一个 LOGO'));
|
||||
function themeConfig($form)
|
||||
{
|
||||
$logoUrl = new \Typecho\Widget\Helper\Form\Element\Text(
|
||||
'logoUrl',
|
||||
null,
|
||||
null,
|
||||
_t('站点 LOGO 地址'),
|
||||
_t('在这里填入一个图片 URL 地址, 以在网站标题前加上一个 LOGO')
|
||||
);
|
||||
|
||||
$form->addInput($logoUrl);
|
||||
|
||||
$sidebarBlock = new Typecho_Widget_Helper_Form_Element_Checkbox('sidebarBlock',
|
||||
array('ShowRecentPosts' => _t('显示最新文章'),
|
||||
'ShowRecentComments' => _t('显示最近回复'),
|
||||
'ShowCategory' => _t('显示分类'),
|
||||
'ShowArchive' => _t('显示归档'),
|
||||
'ShowOther' => _t('显示其它杂项')),
|
||||
array('ShowRecentPosts', 'ShowRecentComments', 'ShowCategory', 'ShowArchive', 'ShowOther'), _t('侧边栏显示'));
|
||||
|
||||
|
||||
$sidebarBlock = new \Typecho\Widget\Helper\Form\Element\Checkbox(
|
||||
'sidebarBlock',
|
||||
[
|
||||
'ShowRecentPosts' => _t('显示最新文章'),
|
||||
'ShowRecentComments' => _t('显示最近回复'),
|
||||
'ShowCategory' => _t('显示分类'),
|
||||
'ShowArchive' => _t('显示归档'),
|
||||
'ShowOther' => _t('显示其它杂项')
|
||||
],
|
||||
['ShowRecentPosts', 'ShowRecentComments', 'ShowCategory', 'ShowArchive', 'ShowOther'],
|
||||
_t('侧边栏显示')
|
||||
);
|
||||
|
||||
$form->addInput($sidebarBlock->multiMode());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function themeFields($layout) {
|
||||
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点LOGO地址'), _t('在这里填入一个图片URL地址, 以在网站标题前加上一个LOGO'));
|
||||
function themeFields($layout)
|
||||
{
|
||||
$logoUrl = new \Typecho\Widget\Helper\Form\Element\Text(
|
||||
'logoUrl',
|
||||
null,
|
||||
null,
|
||||
_t('站点LOGO地址'),
|
||||
_t('在这里填入一个图片URL地址, 以在网站标题前加上一个LOGO')
|
||||
);
|
||||
$layout->addItem($logoUrl);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="col-mb-12">
|
||||
<nav id="nav-menu" class="clearfix" role="navigation">
|
||||
<a<?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
|
||||
<?php self::widget('Widget_Contents_Page_List')->to($pages); ?>
|
||||
<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
|
||||
<?php while($pages->next()): ?>
|
||||
<a<?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
|
||||
<?php endwhile; ?>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<section class="widget">
|
||||
<h3 class="widget-title"><?php _e('最新文章'); ?></h3>
|
||||
<ul class="widget-list">
|
||||
<?php self::widget('Widget_Contents_Post_Recent')
|
||||
<?php \Widget\Contents\Post\Recent::alloc()
|
||||
->parse('<li><a href="{permalink}">{title}</a></li>'); ?>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -14,7 +14,7 @@
|
||||
<section class="widget">
|
||||
<h3 class="widget-title"><?php _e('最近回复'); ?></h3>
|
||||
<ul class="widget-list">
|
||||
<?php self::widget('Widget_Comments_Recent')->to($comments); ?>
|
||||
<?php \Widget\Comments\Recent::alloc()->to($comments); ?>
|
||||
<?php while($comments->next()): ?>
|
||||
<li><a href="<?php $comments->permalink(); ?>"><?php $comments->author(false); ?></a>: <?php $comments->excerpt(35, '...'); ?></li>
|
||||
<?php endwhile; ?>
|
||||
@@ -25,7 +25,7 @@
|
||||
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowCategory', $this->options->sidebarBlock)): ?>
|
||||
<section class="widget">
|
||||
<h3 class="widget-title"><?php _e('分类'); ?></h3>
|
||||
<?php self::widget('Widget_Metas_Category_List')->listCategories('wrapClass=widget-list'); ?>
|
||||
<?php \Widget\Metas\Category\Rows::alloc()->listCategories('wrapClass=widget-list'); ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<section class="widget">
|
||||
<h3 class="widget-title"><?php _e('归档'); ?></h3>
|
||||
<ul class="widget-list">
|
||||
<?php self::widget('Widget_Contents_Post_Date', 'type=month&format=F Y')
|
||||
<?php \Widget\Contents\Post\Date::alloc('type=month&format=F Y')
|
||||
->parse('<li><a href="{permalink}">{date}</a></li>'); ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
@@ -18,7 +18,7 @@ class Helper
|
||||
*/
|
||||
public static function security()
|
||||
{
|
||||
return \Typecho\Widget::widget('Widget_Security');
|
||||
return \Widget\Security::alloc();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -130,10 +130,10 @@ class Edit extends PostEdit implements ActionInterface
|
||||
->limit(1), [$this, 'push']);
|
||||
|
||||
/** 设置高亮 */
|
||||
self::widget('Widget_Notice')->highlight($this->theId);
|
||||
Notice::alloc()->highlight($this->theId);
|
||||
|
||||
/** 提示信息 */
|
||||
self::widget('Widget_Notice')->set('publish' == $this->status ?
|
||||
Notice::alloc()->set('publish' == $this->status ?
|
||||
_t('文件 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->title) :
|
||||
_t('未归档文件 %s 已经被更新', $this->title), 'success');
|
||||
|
||||
@@ -326,7 +326,7 @@ class Edit extends PostEdit implements ActionInterface
|
||||
} while (count($posts) == 100);
|
||||
|
||||
/** 设置提示信息 */
|
||||
self::widget('Widget_Notice')->set(
|
||||
Notice::alloc()->set(
|
||||
$deleteCount > 0 ? _t('未归档文件已经被清理') : _t('没有未归档文件被清理'),
|
||||
$deleteCount > 0 ? 'success' : 'notice'
|
||||
);
|
||||
|
||||
@@ -11,12 +11,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget_Metas_Category_Admin
|
||||
*
|
||||
* @uses Widget_Metas_Category_List
|
||||
* @copyright Copyright (c) 2012 Typecho Team. (http://typecho.org)
|
||||
* @author Joyqi <magike.net@gmail.com>
|
||||
* @license GNU General Public License 2.0
|
||||
* Category Admin
|
||||
*/
|
||||
class Admin extends Rows
|
||||
{
|
||||
|
||||
@@ -171,12 +171,8 @@ class XmlRpc extends Contents implements ActionInterface, Hook
|
||||
|
||||
/** 获取页面 */
|
||||
try {
|
||||
/** 由于Widget_Contents_Page_Edit是从request中获取参数, 因此我们需要强行设置flush一下request */
|
||||
/** widget方法的第三个参数可以指定强行转换传入此widget的request参数 */
|
||||
/** 此组件会进行复杂的权限检测 */
|
||||
$page = PageEdit::alloc(null, ['cid' => $pageId]);
|
||||
} catch (Exception $e) {
|
||||
/** 截获可能会抛出的异常(参见 Widget_Contents_Page_Edit 的 execute 方法) */
|
||||
return new Error($e->getCode(), $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -535,7 +531,6 @@ class XmlRpc extends Contents implements ActionInterface, Hook
|
||||
/** 此组件会进行复杂的权限检测 */
|
||||
PageEdit::alloc(null, ['cid' => $pageId], false)->deletePage();
|
||||
} catch (Exception $e) {
|
||||
/** 截获可能会抛出的异常(参见 Widget_Contents_Page_Edit 的 execute 方法) */
|
||||
return new Error($e->getCode(), $e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user