Plugin Directory

Changeset 2256501


Ignore:
Timestamp:
03/07/2020 07:33:26 PM (5 years ago)
Author:
litefeel
Message:

auto deploy from deploy2wp:https://github.com/litefeel/deploy2wp

Location:
writing-on-github/trunk
Files:
1 added
18 edited

Legend:

Unmodified
Added
Removed
  • writing-on-github/trunk/lib/function.php

    r1713007 r2256501  
    2727}
    2828
     29function wogh_equal_path( $post, $blob ) {
     30    $str1 = $post->github_path();
     31    $str2 = $blob->path();
     32    return trim($str1) === trim($str2);
     33}
     34
    2935/**
    3036 * Check is dont export wordpress content
  • writing-on-github/trunk/lib/import.php

    r1836044 r2256501  
    4747
    4848        if ( is_wp_error( $result ) ) {
    49             return $files;
     49            return $result;
    5050        }
    5151
     
    135135
    136136        // only _pages, _posts and images
    137         $prefixs = array( '_pages/', '_posts/', 'images/');
     137        $prefixs = array( '_pages/', '_posts/', '_drafts/', 'images/');
    138138        foreach ($prefixs as $prefix) {
    139139            if ( ! strncasecmp($path, $prefix, strlen( $prefix ) ) ) {
     
    177177     */
    178178    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       
    180187        if ( empty( $id ) ) {
    181188            return false;
     
    209216
    210217        if ( $post->is_new() ||
     218                ! wogh_equal_path( $post, $blob ) ||
    211219                ! wogh_equal_front_matter( $post, $blob ) ) {
    212220
  • writing-on-github/trunk/lib/post.php

    r1713007 r2256501  
    233233    public function github_filename() {
    234234        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';
    236236        } else {
    237237            $filename = $this->get_name() . '.md';
  • writing-on-github/trunk/readme.txt

    r1838306 r2256501  
    66Donate link: https://www.paypal.me/litefeel 
    77Requires at least: 3.9 
    8 Tested up to: 4.9.4 
    9 Stable tag: 1.9 
     8Tested up to: 5.3.2 
     9Stable tag: 1.10 
    1010License: GPLv2 
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    136136== Changelog ==
    137137
     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
    138144= 1.9 =
    139145
     
    211217  [1.8]: https://github.com/litefeel/writing-on-github/releases/tag/1.8
    212218  [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  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit08110c1eacaf0ad159241b30b6754f00::getLoader();
     7return ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233::getLoader();
  • writing-on-github/trunk/vendor/composer/ClassLoader.php

    r1836044 r2256501  
    280280    public function setApcuPrefix($apcuPrefix)
    281281    {
    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;
    283283    }
    284284
     
    378378            while (false !== $lastPos = strrpos($subPath, '\\')) {
    379379                $subPath = substr($subPath, 0, $lastPos);
    380                 $search = $subPath.'\\';
     380                $search = $subPath . '\\';
    381381                if (isset($this->prefixDirsPsr4[$search])) {
    382382                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  • writing-on-github/trunk/vendor/composer/autoload_real.php

    r1838306 r2256501  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit08110c1eacaf0ad159241b30b6754f00
     5class ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit08110c1eacaf0ad159241b30b6754f00', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit08110c1eacaf0ad159241b30b6754f00', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit051339a7349c855ad78f9936e9de8233', 'loadClassLoader'));
    2525
    2626        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInit08110c1eacaf0ad159241b30b6754f00::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInit051339a7349c855ad78f9936e9de8233::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
     
    4949
    5050        if ($useStaticLoader) {
    51             $includeFiles = Composer\Autoload\ComposerStaticInit08110c1eacaf0ad159241b30b6754f00::$files;
     51            $includeFiles = Composer\Autoload\ComposerStaticInit051339a7349c855ad78f9936e9de8233::$files;
    5252        } else {
    5353            $includeFiles = require __DIR__ . '/autoload_files.php';
    5454        }
    5555        foreach ($includeFiles as $fileIdentifier => $file) {
    56             composerRequire08110c1eacaf0ad159241b30b6754f00($fileIdentifier, $file);
     56            composerRequire051339a7349c855ad78f9936e9de8233($fileIdentifier, $file);
    5757        }
    5858
     
    6161}
    6262
    63 function composerRequire08110c1eacaf0ad159241b30b6754f00($fileIdentifier, $file)
     63function composerRequire051339a7349c855ad78f9936e9de8233($fileIdentifier, $file)
    6464{
    6565    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • writing-on-github/trunk/vendor/composer/autoload_static.php

    r1838306 r2256501  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit08110c1eacaf0ad159241b30b6754f00
     7class ComposerStaticInit051339a7349c855ad78f9936e9de8233
    88{
    99    public static $files = array (
     
    3535    {
    3636        return \Closure::bind(function () use ($loader) {
    37             $loader->classMap = ComposerStaticInit08110c1eacaf0ad159241b30b6754f00::$classMap;
     37            $loader->classMap = ComposerStaticInit051339a7349c855ad78f9936e9de8233::$classMap;
    3838
    3939        }, null, ClassLoader::class);
  • writing-on-github/trunk/vendor/composer/installed.json

    r1713007 r2256501  
    22    {
    33        "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",
    66        "source": {
    77            "type": "git",
    8             "url": "https://github.com/mustangostang/spyc.git",
    9             "reference": "23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d"
     8            "url": "[email protected]:mustangostang/spyc.git",
     9            "reference": "4627c838b16550b666d15aeae1e5289dd5b77da0"
    1010        },
    1111        "dist": {
    1212            "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",
    1515            "shasum": ""
    1616        },
     
    2121            "phpunit/phpunit": "4.3.*@dev"
    2222        },
    23         "time": "2017-02-24T16:06:33+00:00",
     23        "time": "2019-09-10T13:16:29+00:00",
    2424        "type": "library",
    2525        "extra": {
  • writing-on-github/trunk/vendor/mustangostang/spyc/.gitignore

    r1713007 r2256501  
    11vendor
     2composer.lock
    23.DS_Store
  • writing-on-github/trunk/vendor/mustangostang/spyc/README.md

    r1713007 r2256501  
    1212Using Spyc is trivial:
    1313
    14 ```
     14```php
    1515<?php
    1616require_once "spyc.php";
     
    2020or (if you prefer functional syntax)
    2121
    22 ```
     22```php
    2323<?php
    2424require_once "spyc.php";
  • writing-on-github/trunk/vendor/mustangostang/spyc/Spyc.php

    r1713007 r2256501  
    8989  public $setting_use_syck_is_possible = false;
    9090
     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;
    9197
    9298
     
    148154     * @return array
    149155     * @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 = []) {
    152159    $Spyc = new Spyc;
     160    foreach ($options as $key => $value) {
     161        if (property_exists($Spyc, $key)) {
     162            $Spyc->$key = $value;
     163        }
     164    }
    153165    return $Spyc->_load($input);
    154166  }
     
    172184     * @return array
    173185     * @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 = []) {
    176189    $Spyc = new Spyc;
     190    foreach ($options as $key => $value) {
     191        if (property_exists($Spyc, $key)) {
     192            $Spyc->$key = $value;
     193        }
     194    }
    177195    return $Spyc->_loadString($input);
    178196  }
     
    575593    }
    576594
    577     if ($this->startsMappedSequence($line))
     595    if ($this->startsMappedSequence($line)) {
    578596      return $this->returnMappedSequence($line);
    579 
    580     if ($this->startsMappedValue($line))
     597    }
     598
     599    if ($this->startsMappedValue($line)) {
    581600      return $this->returnMappedValue($line);
     601    }
    582602
    583603    if ($this->isArrayElement($line))
    584      return $this->returnArrayElement($line);
     604      return $this->returnArrayElement($line);
    585605
    586606    if ($this->isPlainArray($line))
    587607     return $this->returnPlainArray($line);
    588 
    589608
    590609    return $this->returnKeyValuePair($line);
     
    600619  private function _toType($value) {
    601620    if ($value === '') return "";
     621
     622    if ($this->setting_empty_hash_as_object && $value === '{}') {
     623      return new stdClass();
     624    }
     625
    602626    $first_character = $value[0];
    603627    $last_character = substr($value, -1, 1);
     
    11021126      // Set the type of the value.  Int, string, etc
    11031127      $value = $this->_toType($value);
     1128
    11041129      if ($key === '0') $key = '__!YAMLZero';
    11051130      $array[$key] = $value;
  • writing-on-github/trunk/vendor/mustangostang/spyc/tests/DumpTest.php

    r1713007 r2256501  
    11<?php
    2 
    3 require_once ("../Spyc.php");
    42
    53class DumpTest extends PHPUnit_Framework_TestCase {
     
    86
    97    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');
    119    }
    1210
  • writing-on-github/trunk/vendor/mustangostang/spyc/tests/IndentTest.php

    r1713007 r2256501  
    11<?php
    2 
    3 require_once ("../Spyc.php");
    42
    53class IndentTest extends PHPUnit_Framework_TestCase {
     
    86
    97    protected function setUp() {
    10         $this->Y = Spyc::YAMLLoad("indent_1.yaml");
     8        $this->Y = Spyc::YAMLLoad(__DIR__."/indent_1.yaml");
    119    }
    1210
  • writing-on-github/trunk/vendor/mustangostang/spyc/tests/LoadTest.php

    r1713007 r2256501  
    11<?php
    2 
    3 require_once ("../Spyc.php");
    42
    53class LoadTest extends PHPUnit_Framework_TestCase {
  • writing-on-github/trunk/vendor/mustangostang/spyc/tests/ParseTest.php

    r1713007 r2256501  
    11<?php
    22
    3 require_once ("../Spyc.php");
    4 
    53class ParseTest extends PHPUnit_Framework_TestCase {
    64
     
    86
    97    protected function setUp() {
    10       $this->yaml = spyc_load_file('../spyc.yaml');
     8      $this->yaml = spyc_load_file(__DIR__.'/../spyc.yaml');
    119    }
    1210
     
    1614        array ('step' => array('instrument' => 'Lasik 2000', 'pulseEnergy' => 5.4, 'pulseDuration' => 12, 'repetition' => 1000, 'spotSize' => '2mm')),
    1715      );
    18       $Actual = spyc_load_file ('indent_1.yaml');
     16      $Actual = spyc_load_file (__DIR__.'/indent_1.yaml');
    1917      $this->assertEquals ($Expected, $Actual['steps']);
    2018    }
     
    2220    public function testDeathMasks() {
    2321      $Expected = array ('sad' => 2, 'magnificent' => 4);
    24       $Actual = spyc_load_file ('indent_1.yaml');
     22      $Actual = spyc_load_file (__DIR__.'/indent_1.yaml');
    2523      $this->assertEquals ($Expected, $Actual['death masks are']);
    2624    }
     
    2826    public function testDevDb() {
    2927      $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');
    3129      $this->assertEquals ($Expected, $Actual['development']);
    3230    }
     
    342340
    343341    public function testAngleQuotes() {
    344       $Quotes = Spyc::YAMLLoad('quotes.yaml');
     342      $Quotes = Spyc::YAMLLoad(__DIR__.'/quotes.yaml');
    345343      $this->assertEquals (array ('html_tags' => array ('<br>', '<p>'), 'html_content' => array ('<p>hello world</p>', 'hello<br>world'), 'text_content' => array ('hello world')),
    346344          $Quotes);
     
    348346
    349347    public function testFailingColons() {
    350       $Failing = Spyc::YAMLLoad('failing1.yaml');
     348      $Failing = Spyc::YAMLLoad(__DIR__.'/failing1.yaml');
    351349      $this->assertSame (array ('MyObject' => array ('Prop1' => array ('key1:val1'))),
    352350          $Failing);
     
    355353    public function testQuotesWithComments() {
    356354      $Expected = 'bar';
    357       $Actual = spyc_load_file ('comments.yaml');
     355      $Actual = spyc_load_file (__DIR__.'/comments.yaml');
    358356      $this->assertEquals ($Expected, $Actual['foo']);
    359357    }
     
    361359    public function testArrayWithComments() {
    362360      $Expected = array ('x', 'y', 'z');
    363       $Actual = spyc_load_file ('comments.yaml');
     361      $Actual = spyc_load_file (__DIR__.'/comments.yaml');
    364362      $this->assertEquals ($Expected, $Actual['arr']);
    365363    }
     
    367365    public function testAfterArrayWithKittens() {
    368366      $Expected = 'kittens';
    369       $Actual = spyc_load_file ('comments.yaml');
     367      $Actual = spyc_load_file (__DIR__.'/comments.yaml');
    370368      $this->assertEquals ($Expected, $Actual['bar']);
    371369    }
     
    374372    public function testKai() {
    375373      $Expected = array('-example' => 'value');
    376       $Actual = spyc_load_file ('indent_1.yaml');
     374      $Actual = spyc_load_file (__DIR__.'/indent_1.yaml');
    377375      $this->assertEquals ($Expected, $Actual['kai']);
    378376    }
     
    380378    public function testKaiList() {
    381379      $Expected = array ('-item', '-item', '-item');
    382       $Actual = spyc_load_file ('indent_1.yaml');
     380      $Actual = spyc_load_file (__DIR__.'/indent_1.yaml');
    383381      $this->assertEquals ($Expected, $Actual['kai_list_of_items']);
    384382    }
     
    399397      $this->assertSame($expected, Spyc::YAMLLoad("- - - x"));
    400398    }
     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    }
    401413}
  • writing-on-github/trunk/vendor/mustangostang/spyc/tests/RoundTripTest.php

    r1713007 r2256501  
    11<?php
    2 
    3 require_once ("../Spyc.php");
    42
    53function roundTrip($a) { return Spyc::YAMLLoad(Spyc::YAMLDump(array('x' => $a))); }
  • writing-on-github/trunk/writing-on-github.php

    r1838306 r2256501  
    44 * Plugin URI: https://github.com/litefeel/writing-on-github
    55 * Description: A WordPress plugin to allow you writing on GitHub (or Jekyll site).
    6  * Version: 1.9
     6 * Version: 1.10
    77 * Author:  litefeel
    88 * Author URI: https://www.litefeel.com
     
    381381                WP_CLI::$write( $msg );
    382382            }
    383         } elseif ( true === WP_DEBUG ) {
     383        } elseif ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
    384384            if ( is_array( $msg ) || is_object( $msg ) ) {
    385385                error_log( print_r( $msg, true ) );
Note: See TracChangeset for help on using the changeset viewer.