Changeset 2256501
- Timestamp:
- 03/07/2020 07:33:26 PM (5 years ago)
- Location:
- writing-on-github/trunk
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
writing-on-github/trunk/lib/function.php
r1713007 r2256501 27 27 } 28 28 29 function wogh_equal_path( $post, $blob ) { 30 $str1 = $post->github_path(); 31 $str2 = $blob->path(); 32 return trim($str1) === trim($str2); 33 } 34 29 35 /** 30 36 * Check is dont export wordpress content -
writing-on-github/trunk/lib/import.php
r1836044 r2256501 47 47 48 48 if ( is_wp_error( $result ) ) { 49 return $ files;49 return $result; 50 50 } 51 51 … … 135 135 136 136 // only _pages, _posts and images 137 $prefixs = array( '_pages/', '_posts/', ' images/');137 $prefixs = array( '_pages/', '_posts/', '_drafts/', 'images/'); 138 138 foreach ($prefixs as $prefix) { 139 139 if ( ! strncasecmp($path, $prefix, strlen( $prefix ) ) ) { … … 177 177 */ 178 178 protected function delete_post( Writing_On_GitHub_Blob $blob ) { 179 $id = $blob->id(); 179 $id = false; 180 $meta = $blob->meta(); 181 if ( ! empty( $meta ) ) { 182 if ( array_key_exists( 'ID', $meta ) ) { 183 $id = $meta['ID']; 184 } 185 } 186 180 187 if ( empty( $id ) ) { 181 188 return false; … … 209 216 210 217 if ( $post->is_new() || 218 ! wogh_equal_path( $post, $blob ) || 211 219 ! wogh_equal_front_matter( $post, $blob ) ) { 212 220 -
writing-on-github/trunk/lib/post.php
r1713007 r2256501 233 233 public function github_filename() { 234 234 if ( 'post' === $this->type() ) { 235 $filename = get_the_time( 'Y -m-d-', $this->id ) . $this->get_name() . '.md';235 $filename = get_the_time( 'Y/', $this->id ) . $this->get_name() . '.md'; 236 236 } else { 237 237 $filename = $this->get_name() . '.md'; -
writing-on-github/trunk/readme.txt
r1838306 r2256501 6 6 Donate link: https://www.paypal.me/litefeel 7 7 Requires at least: 3.9 8 Tested up to: 4.9.49 Stable tag: 1. 98 Tested up to: 5.3.2 9 Stable tag: 1.10 10 10 License: GPLv2 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 136 136 == Changelog == 137 137 138 = 1.10 = 139 140 * Fixed cannot publish post from github in _draffts 141 * Fixed cannot delete post from github 142 * Change github path to /_posts/$year/$postname 143 138 144 = 1.9 = 139 145 … … 211 217 [1.8]: https://github.com/litefeel/writing-on-github/releases/tag/1.8 212 218 [1.9]: https://github.com/litefeel/writing-on-github/releases/tag/1.9 219 [1.10]: https://github.com/litefeel/writing-on-github/releases/tag/1.10 -
writing-on-github/trunk/vendor/autoload.php
r1838306 r2256501 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit0 8110c1eacaf0ad159241b30b6754f00::getLoader();7 return ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233::getLoader(); -
writing-on-github/trunk/vendor/composer/ClassLoader.php
r1836044 r2256501 280 280 public function setApcuPrefix($apcuPrefix) 281 281 { 282 $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;282 $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; 283 283 } 284 284 … … 378 378 while (false !== $lastPos = strrpos($subPath, '\\')) { 379 379 $subPath = substr($subPath, 0, $lastPos); 380 $search = $subPath .'\\';380 $search = $subPath . '\\'; 381 381 if (isset($this->prefixDirsPsr4[$search])) { 382 382 $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); -
writing-on-github/trunk/vendor/composer/autoload_real.php
r1838306 r2256501 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit0 8110c1eacaf0ad159241b30b6754f005 class ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit0 8110c1eacaf0ad159241b30b6754f00', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit0 8110c1eacaf0ad159241b30b6754f00', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233', 'loadClassLoader')); 25 25 26 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit0 8110c1eacaf0ad159241b30b6754f00::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit051339a7349c855ad78f9936e9de8233::getInitializer($loader)); 31 31 } else { 32 32 $map = require __DIR__ . '/autoload_namespaces.php'; … … 49 49 50 50 if ($useStaticLoader) { 51 $includeFiles = Composer\Autoload\ComposerStaticInit0 8110c1eacaf0ad159241b30b6754f00::$files;51 $includeFiles = Composer\Autoload\ComposerStaticInit051339a7349c855ad78f9936e9de8233::$files; 52 52 } else { 53 53 $includeFiles = require __DIR__ . '/autoload_files.php'; 54 54 } 55 55 foreach ($includeFiles as $fileIdentifier => $file) { 56 composerRequire0 8110c1eacaf0ad159241b30b6754f00($fileIdentifier, $file);56 composerRequire051339a7349c855ad78f9936e9de8233($fileIdentifier, $file); 57 57 } 58 58 … … 61 61 } 62 62 63 function composerRequire0 8110c1eacaf0ad159241b30b6754f00($fileIdentifier, $file)63 function composerRequire051339a7349c855ad78f9936e9de8233($fileIdentifier, $file) 64 64 { 65 65 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
writing-on-github/trunk/vendor/composer/autoload_static.php
r1838306 r2256501 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit0 8110c1eacaf0ad159241b30b6754f007 class ComposerStaticInit051339a7349c855ad78f9936e9de8233 8 8 { 9 9 public static $files = array ( … … 35 35 { 36 36 return \Closure::bind(function () use ($loader) { 37 $loader->classMap = ComposerStaticInit0 8110c1eacaf0ad159241b30b6754f00::$classMap;37 $loader->classMap = ComposerStaticInit051339a7349c855ad78f9936e9de8233::$classMap; 38 38 39 39 }, null, ClassLoader::class); -
writing-on-github/trunk/vendor/composer/installed.json
r1713007 r2256501 2 2 { 3 3 "name": "mustangostang/spyc", 4 "version": "0.6. 2",5 "version_normalized": "0.6. 2.0",4 "version": "0.6.3", 5 "version_normalized": "0.6.3.0", 6 6 "source": { 7 7 "type": "git", 8 "url": " https://github.com/mustangostang/spyc.git",9 "reference": " 23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d"8 "url": "[email protected]:mustangostang/spyc.git", 9 "reference": "4627c838b16550b666d15aeae1e5289dd5b77da0" 10 10 }, 11 11 "dist": { 12 12 "type": "zip", 13 "url": "https://api.github.com/repos/mustangostang/spyc/zipball/ 23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d",14 "reference": " 23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d",13 "url": "https://api.github.com/repos/mustangostang/spyc/zipball/4627c838b16550b666d15aeae1e5289dd5b77da0", 14 "reference": "4627c838b16550b666d15aeae1e5289dd5b77da0", 15 15 "shasum": "" 16 16 }, … … 21 21 "phpunit/phpunit": "4.3.*@dev" 22 22 }, 23 "time": "201 7-02-24T16:06:33+00:00",23 "time": "2019-09-10T13:16:29+00:00", 24 24 "type": "library", 25 25 "extra": { -
writing-on-github/trunk/vendor/mustangostang/spyc/.gitignore
r1713007 r2256501 1 1 vendor 2 composer.lock 2 3 .DS_Store -
writing-on-github/trunk/vendor/mustangostang/spyc/README.md
r1713007 r2256501 12 12 Using Spyc is trivial: 13 13 14 ``` 14 ```php 15 15 <?php 16 16 require_once "spyc.php"; … … 20 20 or (if you prefer functional syntax) 21 21 22 ``` 22 ```php 23 23 <?php 24 24 require_once "spyc.php"; -
writing-on-github/trunk/vendor/mustangostang/spyc/Spyc.php
r1713007 r2256501 89 89 public $setting_use_syck_is_possible = false; 90 90 91 /** 92 * Setting this to true will forse YAMLLoad to use syck_load function when 93 * possible. False by default. 94 * @var bool 95 */ 96 public $setting_empty_hash_as_object = false; 91 97 92 98 … … 148 154 * @return array 149 155 * @param string $input Path of YAML file or string containing YAML 150 */ 151 public static function YAMLLoad($input) { 156 * @param array set options 157 */ 158 public static function YAMLLoad($input, $options = []) { 152 159 $Spyc = new Spyc; 160 foreach ($options as $key => $value) { 161 if (property_exists($Spyc, $key)) { 162 $Spyc->$key = $value; 163 } 164 } 153 165 return $Spyc->_load($input); 154 166 } … … 172 184 * @return array 173 185 * @param string $input String containing YAML 174 */ 175 public static function YAMLLoadString($input) { 186 * @param array set options 187 */ 188 public static function YAMLLoadString($input, $options = []) { 176 189 $Spyc = new Spyc; 190 foreach ($options as $key => $value) { 191 if (property_exists($Spyc, $key)) { 192 $Spyc->$key = $value; 193 } 194 } 177 195 return $Spyc->_loadString($input); 178 196 } … … 575 593 } 576 594 577 if ($this->startsMappedSequence($line)) 595 if ($this->startsMappedSequence($line)) { 578 596 return $this->returnMappedSequence($line); 579 580 if ($this->startsMappedValue($line)) 597 } 598 599 if ($this->startsMappedValue($line)) { 581 600 return $this->returnMappedValue($line); 601 } 582 602 583 603 if ($this->isArrayElement($line)) 584 return $this->returnArrayElement($line);604 return $this->returnArrayElement($line); 585 605 586 606 if ($this->isPlainArray($line)) 587 607 return $this->returnPlainArray($line); 588 589 608 590 609 return $this->returnKeyValuePair($line); … … 600 619 private function _toType($value) { 601 620 if ($value === '') return ""; 621 622 if ($this->setting_empty_hash_as_object && $value === '{}') { 623 return new stdClass(); 624 } 625 602 626 $first_character = $value[0]; 603 627 $last_character = substr($value, -1, 1); … … 1102 1126 // Set the type of the value. Int, string, etc 1103 1127 $value = $this->_toType($value); 1128 1104 1129 if ($key === '0') $key = '__!YAMLZero'; 1105 1130 $array[$key] = $value; -
writing-on-github/trunk/vendor/mustangostang/spyc/tests/DumpTest.php
r1713007 r2256501 1 1 <?php 2 3 require_once ("../Spyc.php");4 2 5 3 class DumpTest extends PHPUnit_Framework_TestCase { … … 8 6 9 7 public function setUp() { 10 $this->files_to_test = array ( '../spyc.yaml', 'failing1.yaml', 'indent_1.yaml', 'quotes.yaml');8 $this->files_to_test = array (__DIR__.'/../spyc.yaml', 'failing1.yaml', 'indent_1.yaml', 'quotes.yaml'); 11 9 } 12 10 -
writing-on-github/trunk/vendor/mustangostang/spyc/tests/IndentTest.php
r1713007 r2256501 1 1 <?php 2 3 require_once ("../Spyc.php");4 2 5 3 class IndentTest extends PHPUnit_Framework_TestCase { … … 8 6 9 7 protected function setUp() { 10 $this->Y = Spyc::YAMLLoad( "indent_1.yaml");8 $this->Y = Spyc::YAMLLoad(__DIR__."/indent_1.yaml"); 11 9 } 12 10 -
writing-on-github/trunk/vendor/mustangostang/spyc/tests/LoadTest.php
r1713007 r2256501 1 1 <?php 2 3 require_once ("../Spyc.php");4 2 5 3 class LoadTest extends PHPUnit_Framework_TestCase { -
writing-on-github/trunk/vendor/mustangostang/spyc/tests/ParseTest.php
r1713007 r2256501 1 1 <?php 2 2 3 require_once ("../Spyc.php");4 5 3 class ParseTest extends PHPUnit_Framework_TestCase { 6 4 … … 8 6 9 7 protected function setUp() { 10 $this->yaml = spyc_load_file( '../spyc.yaml');8 $this->yaml = spyc_load_file(__DIR__.'/../spyc.yaml'); 11 9 } 12 10 … … 16 14 array ('step' => array('instrument' => 'Lasik 2000', 'pulseEnergy' => 5.4, 'pulseDuration' => 12, 'repetition' => 1000, 'spotSize' => '2mm')), 17 15 ); 18 $Actual = spyc_load_file ( 'indent_1.yaml');16 $Actual = spyc_load_file (__DIR__.'/indent_1.yaml'); 19 17 $this->assertEquals ($Expected, $Actual['steps']); 20 18 } … … 22 20 public function testDeathMasks() { 23 21 $Expected = array ('sad' => 2, 'magnificent' => 4); 24 $Actual = spyc_load_file ( 'indent_1.yaml');22 $Actual = spyc_load_file (__DIR__.'/indent_1.yaml'); 25 23 $this->assertEquals ($Expected, $Actual['death masks are']); 26 24 } … … 28 26 public function testDevDb() { 29 27 $Expected = array ('adapter' => 'mysql', 'host' => 'localhost', 'database' => 'rails_dev'); 30 $Actual = spyc_load_file ( 'indent_1.yaml');28 $Actual = spyc_load_file (__DIR__.'/indent_1.yaml'); 31 29 $this->assertEquals ($Expected, $Actual['development']); 32 30 } … … 342 340 343 341 public function testAngleQuotes() { 344 $Quotes = Spyc::YAMLLoad( 'quotes.yaml');342 $Quotes = Spyc::YAMLLoad(__DIR__.'/quotes.yaml'); 345 343 $this->assertEquals (array ('html_tags' => array ('<br>', '<p>'), 'html_content' => array ('<p>hello world</p>', 'hello<br>world'), 'text_content' => array ('hello world')), 346 344 $Quotes); … … 348 346 349 347 public function testFailingColons() { 350 $Failing = Spyc::YAMLLoad( 'failing1.yaml');348 $Failing = Spyc::YAMLLoad(__DIR__.'/failing1.yaml'); 351 349 $this->assertSame (array ('MyObject' => array ('Prop1' => array ('key1:val1'))), 352 350 $Failing); … … 355 353 public function testQuotesWithComments() { 356 354 $Expected = 'bar'; 357 $Actual = spyc_load_file ( 'comments.yaml');355 $Actual = spyc_load_file (__DIR__.'/comments.yaml'); 358 356 $this->assertEquals ($Expected, $Actual['foo']); 359 357 } … … 361 359 public function testArrayWithComments() { 362 360 $Expected = array ('x', 'y', 'z'); 363 $Actual = spyc_load_file ( 'comments.yaml');361 $Actual = spyc_load_file (__DIR__.'/comments.yaml'); 364 362 $this->assertEquals ($Expected, $Actual['arr']); 365 363 } … … 367 365 public function testAfterArrayWithKittens() { 368 366 $Expected = 'kittens'; 369 $Actual = spyc_load_file ( 'comments.yaml');367 $Actual = spyc_load_file (__DIR__.'/comments.yaml'); 370 368 $this->assertEquals ($Expected, $Actual['bar']); 371 369 } … … 374 372 public function testKai() { 375 373 $Expected = array('-example' => 'value'); 376 $Actual = spyc_load_file ( 'indent_1.yaml');374 $Actual = spyc_load_file (__DIR__.'/indent_1.yaml'); 377 375 $this->assertEquals ($Expected, $Actual['kai']); 378 376 } … … 380 378 public function testKaiList() { 381 379 $Expected = array ('-item', '-item', '-item'); 382 $Actual = spyc_load_file ( 'indent_1.yaml');380 $Actual = spyc_load_file (__DIR__.'/indent_1.yaml'); 383 381 $this->assertEquals ($Expected, $Actual['kai_list_of_items']); 384 382 } … … 399 397 $this->assertSame($expected, Spyc::YAMLLoad("- - - x")); 400 398 } 399 400 public function testElementWithEmptyHash() 401 { 402 $element = "hash: {}\narray: []"; 403 $yaml = Spyc::YAMLLoadString($element); 404 $this->assertEquals($yaml['hash'], []); 405 $this->assertEquals($yaml['array'], []); 406 407 $yaml = Spyc::YAMLLoadString($element, [ 408 'setting_empty_hash_as_object' => true 409 ]); 410 $this->assertInstanceOf(stdClass::class, $yaml['hash']); 411 $this->assertEquals($yaml['array'], []); 412 } 401 413 } -
writing-on-github/trunk/vendor/mustangostang/spyc/tests/RoundTripTest.php
r1713007 r2256501 1 1 <?php 2 3 require_once ("../Spyc.php");4 2 5 3 function roundTrip($a) { return Spyc::YAMLLoad(Spyc::YAMLDump(array('x' => $a))); } -
writing-on-github/trunk/writing-on-github.php
r1838306 r2256501 4 4 * Plugin URI: https://github.com/litefeel/writing-on-github 5 5 * Description: A WordPress plugin to allow you writing on GitHub (or Jekyll site). 6 * Version: 1. 96 * Version: 1.10 7 7 * Author: litefeel 8 8 * Author URI: https://www.litefeel.com … … 381 381 WP_CLI::$write( $msg ); 382 382 } 383 } elseif ( true ===WP_DEBUG ) {383 } elseif ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 384 384 if ( is_array( $msg ) || is_object( $msg ) ) { 385 385 error_log( print_r( $msg, true ) );
Note: See TracChangeset
for help on using the changeset viewer.