晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/stando/public_html/wp-content/plugins/wordpress-seo-premium/config/composer/ |
Upload File : |
<?php
/**
* Yoast SEO Plugin File.
*
* @package Yoast\YoastSEO\Composer
*/
namespace Yoast\WP\SEO\Composer;
use Composer\Script\Event;
use Exception;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Yoast\WP\SEO\Dependency_Injection\Container_Compiler;
/**
* Class to handle Composer actions and events.
*/
class Actions {
/**
* Prefixes dependencies if composer install is ran with dev mode.
*
* Used in composer in the post-install script hook.
*
* @codeCoverageIgnore
*
* @param Event $event Composer event that triggered this script.
*
* @return void
*/
public static function prefix_dependencies( Event $event ) {
$io = $event->getIO();
if ( ! $event->isDevMode() ) {
$io->write( 'Not prefixing dependencies, due to not being in dev move.' );
return;
}
if ( ! \file_exists( __DIR__ . '/../../vendor/bin/php-scoper' ) ) {
$io->write( 'Not prefixing dependencies, due to PHP scoper not being installed' );
return;
}
$io->write( 'Prefixing dependencies...' );
$event_dispatcher = $event->getComposer()->getEventDispatcher();
$event_dispatcher->dispatchScript( 'prefix-dependencies', $event->isDevMode() );
}
/**
* Compiles the dependency injection container.
*
* Used the composer compile-dependency-injection-container command.
*
* @codeCoverageIgnore
*
* @param Event $event Composer event that triggered this script.
*
* @return void
*/
public static function compile_dependency_injection_container( Event $event ) {
$io = $event->getIO();
if ( ! \class_exists( ContainerBuilder::class ) ) {
$io->write( 'Not compiling dependency injection container, due to the container builder not being installed' );
return;
}
$io->write( 'Compiling the dependency injection container...' );
// Pas true as debug to force a recheck of the container.
Container_Compiler::compile( true );
$io->write( 'The dependency injection container has been compiled.' );
}
/**
* Runs PHPCS on the staged files.
*
* Used the composer check-staged-cs command.
*
* @codeCoverageIgnore
*
* @return void
*/
public static function check_staged_cs() {
self::check_cs_for_changed_files( '--staged' );
}
/**
* Runs PHPCS on the staged files.
*
* Used the composer check-staged-cs command.
*
* @codeCoverageIgnore
*
* @param Event $event Composer event that triggered this script.
*
* @return void
*/
public static function check_branch_cs( Event $event ) {
$args = $event->getArguments();
if ( empty( $args ) ) {
self::check_cs_for_changed_files( 'trunk' );
return;
}
self::check_cs_for_changed_files( $args[0] );
}
/**
* Runs PHPCS on changed files compared to some git reference.
*
* @param string $compare The git reference.
*
* @codeCoverageIgnore
*
* @return void
*/
private static function check_cs_for_changed_files( $compare ) {
\exec( 'git diff --name-only --diff-filter=d ' . \escapeshellarg( $compare ), $files );
$files = \array_filter(
$files,
function ( $file ) {
return \substr( $file, -4 ) === '.php';
}
);
if ( empty( $files ) ) {
echo 'No files to compare! Exiting.';
return;
}
\system( 'composer check-cs -- ' . \implode( ' ', \array_map( 'escapeshellarg', $files ) ) );
}
/**
* Generates a migration.
*
* @param Event $event Composer event that triggered this script.
*
* @return void
*
* @throws Exception If no migration name is provided.
*/
public static function generate_migration( Event $event ) {
$args = $event->getArguments();
if ( empty( $args[0] ) ) {
throw new Exception( 'You must provide an argument with the migration name.' );
}
$name = $args[0];
$timestamp = \gmdate( 'YmdHis', \time() );
// Camelcase the name.
$name = \preg_replace( '/\\s+/', '_', $name );
$parts = \explode( '_', $name );
$name = '';
foreach ( $parts as $word ) {
$name .= \ucfirst( $word );
}
$correct_class_name_regex = '/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/';
if ( ! \preg_match( $correct_class_name_regex, $name ) ) {
throw new Exception( "$name is not a valid migration name." );
}
if ( \class_exists( $name ) ) {
throw new Exception( "A class with the name $name already exists." );
}
$file_name = $timestamp . '_' . $name . '.php';
$template = <<<TPL
<?php
/**
* Yoast SEO Plugin File.
*
* @package Yoast\WP\SEO\Config\Migrations
*/
namespace Yoast\WP\SEO\Config\Migrations;
use Yoast\WP\Lib\Migrations\Migration;
/**
* {$name} class.
*/
class {$name} extends Migration {
/**
* The plugin this migration belongs to.
*
* @var string
*/
public static \$plugin = 'free';
/**
* Migration up.
*
* @return void
*/
public function up() {
}
/**
* Migration down.
*
* @return void
*/
public function down() {
}
}
TPL;
\file_put_contents( __DIR__ . '/../../src/config/migrations/' . $file_name, $template );
}
}