Skip to content

Commit

Permalink
0.55
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Oct 23, 2019
1 parent 66d2397 commit 47665dc
Show file tree
Hide file tree
Showing 86 changed files with 10,336 additions and 13 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Argon - 一个轻盈、简洁、美观的 WordPress 主题

# 更新日志

## 20191023 v0.55
+ 修复手机端侧栏的小问题
+ 提升后台管理中"Argon 主题选项"菜单层级
+ 采用新的检测更新库,修复更新问题
+ 其他细节调整

## 20191017 v0.54
+ 修改手机端侧栏效果
+ 合并 CSS 文件
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</main>
</div>
</div>
<script src="<?php bloginfo('template_url'); ?>/js/argontheme.js"></script>
<script src="<?php bloginfo('template_url'); ?>/argontheme.js?v<?php echo wp_get_theme('argon' )-> Version; ?>"></script>
<?php if (get_option('argon_mathjax_enable') == 'true') { /*Mathjax*/?>
<script type="text/x-mathjax-config" id="mathjax_script">
MathJax.Hub.Config({
Expand Down
11 changes: 6 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ function theme_slug_setup() {
}
add_action('after_setup_theme','theme_slug_setup');
//检测更新
require_once(get_template_directory() . '/theme-update-checker.php');
$argonThemeUpdateChecker = new ThemeUpdateChecker(
'argon',
'https://raw.githubusercontent.com/abc2237512422/argon-theme/master/info.json'
require_once(get_template_directory() . '/theme-update-checker/plugin-update-checker.php');
$argonThemeUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://raw.githubusercontent.com/abc2237512422/argon-theme/master/info.json',
get_template_directory() . '/functions.php',
'argon'
);
//初次使用时发送安装量统计信息
function post_analytics_info(){
Expand Down Expand Up @@ -912,7 +913,7 @@ function shortcode_hide_reading_time($attr,$content=""){
//主题选项页面
function themeoptions_admin_menu(){
/*后台管理面板侧栏添加选项*/
add_theme_page("Argon 主题设置", "Argon 主题选项", 'edit_themes', basename(__FILE__), 'themeoptions_page');
add_menu_page("Argon 主题设置", "Argon 主题选项", 'edit_themes', basename(__FILE__), 'themeoptions_page');
}
function themeoptions_page(){
/*具体选项*/
Expand Down
2 changes: 1 addition & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link href="<?php bloginfo('template_url'); ?>/assets/vendor/nucleo/css/nucleo.css" rel="stylesheet">
<link href="<?php bloginfo('template_url'); ?>/assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/argon.min.css" rel="stylesheet">
<link href="<?php bloginfo('template_url'); ?>/style.css" type='text/css' media='all' rel='stylesheet'>
<link href="<?php bloginfo('template_url'); ?>/style.css?v<?php echo wp_get_theme('argon' )-> Version; ?>" type='text/css' media='all' rel='stylesheet'>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/jquery/jquery.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/bootstrap/bootstrap.min.js"></script>
<script src="<?php bloginfo('template_url'); ?>/assets/vendor/popper/popper.min.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version" : "0.54",
"version" : "0.55",
"details_url" : "https://github.com/abc2237512422/argon-theme/releases",
"download_url" : "https://github.com/abc2237512422/argon-theme/releases/download/v0.54/argon.zip"
"download_url" : "https://github.com/abc2237512422/argon-theme/releases/download/v0.55/argon.zip"
}
12 changes: 8 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Theme Name: argon
Author: abc2237512422
Author URI: https://abc233.site/
Description: 轻盈、简洁、美观的 Wordpress 主题 (Beta)
Version: 0.54
Description: 轻盈、简洁、美观的 Wordpress 主题
Version: 0.55
License: MIT License
License URI: https://opensource.org/licenses/MIT
Tags: 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应, 夜间模式, 可自定义
Tags: 简约, 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应, 夜间模式, 可自定义
*/

body{
Expand Down Expand Up @@ -1912,6 +1912,7 @@ html.darkmode .github-info-card {
padding-top: 20px;
padding-bottom: 20px;
margin-bottom: 0;
padding: 0;
overflow: auto;
z-index: 1002;
box-shadow: 0 15px 35px rgba(50,50,93,.1),0 5px 15px rgba(0,0,0,.07)!important;
Expand All @@ -1938,9 +1939,11 @@ html.darkmode .github-info-card {
#leftbar::-webkit-scrollbar{
display: none;
}
html.leftbar-opened {
overflow: hidden;
}
.leftbar-opened #leftbar{
left: 0px;
padding: 0;
}
#sidebar_mask{
position: fixed;
Expand Down Expand Up @@ -1992,6 +1995,7 @@ html.darkmode .github-info-card {
}
}


@media screen and (max-width:900px){
/*TimeLine*/
.argon-timeline {
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions theme-update-checker/Puc/v4/Factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
if ( !class_exists('Puc_v4_Factory', false) ):

class Puc_v4_Factory extends Puc_v4p8_Factory { }

endif;
47 changes: 47 additions & 0 deletions theme-update-checker/Puc/v4p8/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

if ( !class_exists('Puc_v4p8_Autoloader', false) ):

class Puc_v4p8_Autoloader {
private $prefix = '';
private $rootDir = '';
private $libraryDir = '';

private $staticMap;

public function __construct() {
$this->rootDir = dirname(__FILE__) . '/';
$nameParts = explode('_', __CLASS__, 3);
$this->prefix = $nameParts[0] . '_' . $nameParts[1] . '_';

$this->libraryDir = realpath($this->rootDir . '../..') . '/';
$this->staticMap = array(
'PucReadmeParser' => 'vendor/PucReadmeParser.php',
'Parsedown' => 'vendor/Parsedown.php',
'Puc_v4_Factory' => 'Puc/v4/Factory.php',
);

spl_autoload_register(array($this, 'autoload'));
}

public function autoload($className) {
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) {
/** @noinspection PhpIncludeInspection */
include ($this->libraryDir . $this->staticMap[$className]);
return;
}

if (strpos($className, $this->prefix) === 0) {
$path = substr($className, strlen($this->prefix));
$path = str_replace('_', '/', $path);
$path = $this->rootDir . $path . '.php';

if (file_exists($path)) {
/** @noinspection PhpIncludeInspection */
include $path;
}
}
}
}

endif;
177 changes: 177 additions & 0 deletions theme-update-checker/Puc/v4p8/DebugBar/Extension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?php
if ( !class_exists('Puc_v4p8_DebugBar_Extension', false) ):

class Puc_v4p8_DebugBar_Extension {
const RESPONSE_BODY_LENGTH_LIMIT = 4000;

/** @var Puc_v4p8_UpdateChecker */
protected $updateChecker;
protected $panelClass = 'Puc_v4p8_DebugBar_Panel';

public function __construct($updateChecker, $panelClass = null) {
$this->updateChecker = $updateChecker;
if ( isset($panelClass) ) {
$this->panelClass = $panelClass;
}

add_filter('debug_bar_panels', array($this, 'addDebugBarPanel'));
add_action('debug_bar_enqueue_scripts', array($this, 'enqueuePanelDependencies'));

add_action('wp_ajax_puc_v4_debug_check_now', array($this, 'ajaxCheckNow'));
}

/**
* Register the PUC Debug Bar panel.
*
* @param array $panels
* @return array
*/
public function addDebugBarPanel($panels) {
if ( $this->updateChecker->userCanInstallUpdates() ) {
$panels[] = new $this->panelClass($this->updateChecker);
}
return $panels;
}

/**
* Enqueue our Debug Bar scripts and styles.
*/
public function enqueuePanelDependencies() {
wp_enqueue_style(
'puc-debug-bar-style-v4',
$this->getLibraryUrl("/css/puc-debug-bar.css"),
array('debug-bar'),
'20171124'
);

wp_enqueue_script(
'puc-debug-bar-js-v4',
$this->getLibraryUrl("/js/debug-bar.js"),
array('jquery'),
'20170516'
);
}

/**
* Run an update check and output the result. Useful for making sure that
* the update checking process works as expected.
*/
public function ajaxCheckNow() {
if ( $_POST['uid'] !== $this->updateChecker->getUniqueName('uid') ) {
return;
}
$this->preAjaxRequest();
$update = $this->updateChecker->checkForUpdates();
if ( $update !== null ) {
echo "An update is available:";
echo '<pre>', htmlentities(print_r($update, true)), '</pre>';
} else {
echo 'No updates found.';
}

$errors = $this->updateChecker->getLastRequestApiErrors();
if ( !empty($errors) ) {
printf('<p>The update checker encountered %d API error%s.</p>', count($errors), (count($errors) > 1) ? 's' : '');

foreach (array_values($errors) as $num => $item) {
$wpError = $item['error'];
/** @var WP_Error $wpError */
printf('<h4>%d) %s</h4>', $num + 1, esc_html($wpError->get_error_message()));

echo '<dl>';
printf('<dt>Error code:</dt><dd><code>%s</code></dd>', esc_html($wpError->get_error_code()));

if ( isset($item['url']) ) {
printf('<dt>Requested URL:</dt><dd><code>%s</code></dd>', esc_html($item['url']));
}

if ( isset($item['httpResponse']) ) {
if ( is_wp_error($item['httpResponse']) ) {
$httpError = $item['httpResponse'];
/** @var WP_Error $httpError */
printf(
'<dt>WordPress HTTP API error:</dt><dd>%s (<code>%s</code>)</dd>',
esc_html($httpError->get_error_message()),
esc_html($httpError->get_error_code())
);
} else {
//Status code.
printf(
'<dt>HTTP status:</dt><dd><code>%d %s</code></dd>',
wp_remote_retrieve_response_code($item['httpResponse']),
wp_remote_retrieve_response_message($item['httpResponse'])
);

//Headers.
echo '<dt>Response headers:</dt><dd><pre>';
foreach (wp_remote_retrieve_headers($item['httpResponse']) as $name => $value) {
printf("%s: %s\n", esc_html($name), esc_html($value));
}
echo '</pre></dd>';

//Body.
$body = wp_remote_retrieve_body($item['httpResponse']);
if ( $body === '' ) {
$body = '(Empty response.)';
} else if ( strlen($body) > self::RESPONSE_BODY_LENGTH_LIMIT ) {
$length = strlen($body);
$body = substr($body, 0, self::RESPONSE_BODY_LENGTH_LIMIT)
. sprintf("\n(Long string truncated. Total length: %d bytes.)", $length);
}

printf('<dt>Response body:</dt><dd><pre>%s</pre></dd>', esc_html($body));
}
}
echo '<dl>';
}
}

exit;
}

/**
* Check access permissions and enable error display (for debugging).
*/
protected function preAjaxRequest() {
if ( !$this->updateChecker->userCanInstallUpdates() ) {
die('Access denied');
}
check_ajax_referer('puc-ajax');

error_reporting(E_ALL);
@ini_set('display_errors', 'On');
}

/**
* @param string $filePath
* @return string
*/
private function getLibraryUrl($filePath) {
$absolutePath = realpath(dirname(__FILE__) . '/../../../' . ltrim($filePath, '/'));

//Where is the library located inside the WordPress directory structure?
$absolutePath = Puc_v4p8_Factory::normalizePath($absolutePath);

$pluginDir = Puc_v4p8_Factory::normalizePath(WP_PLUGIN_DIR);
$muPluginDir = Puc_v4p8_Factory::normalizePath(WPMU_PLUGIN_DIR);
$themeDir = Puc_v4p8_Factory::normalizePath(get_theme_root());

if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) {
//It's part of a plugin.
return plugins_url(basename($absolutePath), $absolutePath);
} else if ( strpos($absolutePath, $themeDir) === 0 ) {
//It's part of a theme.
$relativePath = substr($absolutePath, strlen($themeDir) + 1);
$template = substr($relativePath, 0, strpos($relativePath, '/'));
$baseUrl = get_theme_root_uri($template);

if ( !empty($baseUrl) && $relativePath ) {
return $baseUrl . '/' . $relativePath;
}
}

return '';
}
}

endif;
Loading

0 comments on commit 47665dc

Please sign in to comment.