filename
stringlengths
11
137
content
stringlengths
6
292k
projects/packages/transport-helper/actions.php
<?php /** * Action Hooks for Jetpack Transport Helper module. * * @package automattic/jetpack-transport-helper */ // If WordPress's plugin API is available already, use it. If not, // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`. if ( function_exists( 'add_filter' ) ) { $add_filter = 'a...
projects/packages/transport-helper/tests/php/test-package-version.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName namespace Automattic\Jetpack\Transport_Helper; use PHPUnit\Framework\TestCase; use function add_filter; use function apply_filters; /** * Unit tests for the Package_Version class. * * @package automattic/jetpack-transport-helper */ class Test_Pa...
projects/packages/transport-helper/tests/php/bootstrap.php
<?php /** * Initialize the testing environment. * * @package automattic/jetpack-transport-helper */ /** * Load the composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; define( 'WP_DEBUG', true ); \WorDBless\Load::load();
projects/packages/transport-helper/tests/php/test-rest-controller.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName // After changing this file, consider increasing the version number ("VXXX") in all the files using this namespace, in // order to ensure that the specific version of this file always get loaded. Otherwise, Jetpack autoloader might decide // to load a...
projects/packages/transport-helper/src/class-package-version.php
<?php /** * The Package_Version class. * * @package automattic/jetpack-transport-helper */ namespace Automattic\Jetpack\Transport_Helper; /** * The Package_Version class. * * Does *not* use namespaced versioning ("VXXXX") because send_package_version_to_tracker() is used as a * "jetpack_package_versions" filt...
projects/packages/transport-helper/src/class-rest-controller.php
<?php /** * The Jetpack Helper Script Rest Controller class. * Registers the REST routes. * * @package automattic/jetpack-transport-helper */ // After changing this file, consider increasing the version number ("VXXX") in all the files using this namespace, in // order to ensure that the specific version of this ...
projects/packages/transport-helper/src/class-package-version-compat.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * The Package_Version class's compatibility shim. * * @package automattic/jetpack-transport-helper */ // Do *not* update the "V0001" namespace version on changes. namespace Automattic\Jetpack\Transport_Helper\V0001; /** * Package_Version pro...
projects/packages/password-checker/tests/php/test-class-password-checker.php
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests the Password_Checker package. * * @package automattic/jetpack-password-checker */ namespace Automattic\Jetpack; use WorDBless\BaseTestCase; /** * Test Password_Checker class */ class Password_Checker_Test extends BaseTestCase { /*...
projects/packages/password-checker/tests/php/bootstrap.php
<?php /** * Bootstrap. * * @package automattic/jetpack-password-checker */ /** * Include the Composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; /** * Load WorDBless */ \WorDBless\Load::load();
projects/packages/password-checker/src/class-password-checker.php
<?php /** * Password Checker package. * * @package automattic/jetpack-password-checker */ namespace Automattic\Jetpack; /** * Checks passwords strength. */ class Password_Checker { /** * Minimum entropy bits a password should contain. 36 bits of entropy is considered * to be a reasonable password, 28 stan...
projects/packages/redirect/tests/php/bootstrap.php
<?php //phpcs:ignore Squiz.Commenting.FileComment.Missing require_once __DIR__ . '/../../vendor/autoload.php'; // phpcs:disable // Core WP functions clones function get_home_url() { return 'http://example.org'; } function wp_parse_url( $url, $component = -1 ) { return parse_url( $url, $component ); } function a...
projects/packages/redirect/tests/php/test-redirect.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * File for testing Redirects. * * @package Automattic/jetpack-redirect */ namespace Automattic\Jetpack; use Brain\Monkey; use Brain\Monkey\Functions; use PHPUnit\Framework\TestCase; /** * Test Redirect class */ class RedirectTest extends T...
projects/packages/redirect/src/class-redirect.php
<?php /** * Jetpack Redirect package. * * @package automattic/jetpack-redirect */ namespace Automattic\Jetpack; /** * Class Redirect */ class Redirect { /** * Constructor. * * Static-only class, so nothing here. */ private function __construct() {} /** * Builds and returns an URL using the jetpac...
projects/packages/phpcs-filter/stdin-bootstrap.php
<?php /** * This is a phpcs bootstrap file to apply the filter's Config and RuleSet modifications * when phpcs is passed a file via stdin. * * @package automattic/jetpack-phpcs-filter */ use PHP_CodeSniffer\Autoload; use PHP_CodeSniffer\Util; call_user_func( function () { global $runner; $config = $runner-...
projects/packages/phpcs-filter/tests/php/StdinBootstrapTest.php
<?php /** * Tests for stdin-bootstrap.php. * * @package automattic/jetpack-phpcs-filter */ namespace Automattic\Jetpack\PhpcsFilter\Tests; use PHPUnit\Framework\TestCase; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; /** * Tests for stdin-bootstrap.php. */ class StdinBootstrapTest extends Test...
projects/packages/phpcs-filter/tests/php/bootstrap.php
<?php /** * PHPUnit bootstrap. * * @package automattic/jetpack-phpcs-filter */ // Include the Composer autoloader. require_once __DIR__ . '/../../vendor/autoload.php'; // Phpcs needs some bootstrapping of its own for tests to work. require_once __DIR__ . '/../../vendor/squizlabs/php_codesniffer/tests/bootstrap.ph...
projects/packages/phpcs-filter/tests/php/PhpcsFilterTest.php
<?php /** * Tests for PhpcsFilter.php. * * @package automattic/jetpack-phpcs-filter */ namespace Automattic\Jetpack\PhpcsFilter\Tests; use Automattic\Jetpack\PhpcsFilter; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Files\FileList; use PHP_CodeSniffer\Files\LocalFile; use PHP_CodeSniffer\Ruleset; use PHPUnit\F...
projects/packages/phpcs-filter/tests/fixtures/perdir/excludedfile.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/exclude-4/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/exclude-3/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/severity-to-0/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/exclude-pattern/excludedfile.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/exclude-pattern/excluded2.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/exclude-pattern/excluded1.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir/control/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir-custom/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir-custom/test/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/perdir-custom/control/file.php
<?php $y = array( 'a', 'b', 'c' ); if ( 1 === $_SERVER['argc'] ) { delete( $y[0] ); echo "ok\n"; }
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/ignoredfile.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/file.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/gitignored-but-overridden-file.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/gitignoredfile.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/gitignoredir/file.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/ignoredir/file.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/4.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/2.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/3.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/1.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/4.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/2.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/3.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/1.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/c3/4.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/c3/2.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/c3/3.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/c1/c2/c3/1.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/a/anotherfile.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/a/ignoredfile.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/a/file.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/b/anotherfile.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/b/ignoredfile.php
<?php
projects/packages/phpcs-filter/tests/fixtures/phpcsignore/b/file.php
<?php
projects/packages/phpcs-filter/src/PhpcsFilter.php
<?php /** * A filter for PHP CodeSniffer to add support for .phpcsignore files and per-directory configuration files. * * @package automattic/jetpack-phpcs-filter */ namespace Automattic\Jetpack; use Automattic\IgnoreFile; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Exceptions\DeepExitException; use PHP_CodeS...
projects/packages/wp-js-data-sync/tests/php/bootstrap.php
<?php /** * Bootstrap. * * @package automattic/ */ /** * Include the composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; \WorDBless\Load::load();
projects/packages/wp-js-data-sync/tests/php/schema/integration/test-integration-serialization.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use PHPUnit\Framework\TestCase; class Test_Integration_Serialization extends TestCase { public function test_serialization_to_string() { // String $string = Schema::as_string(); $this->assertSame( 'string', (string) $string ); $this->assertSame( a...
projects/packages/wp-js-data-sync/tests/php/schema/integration/test-integration-array-schemas.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use PHPUnit\Framework\TestCase; class Test_Integration_Array_Schemas extends TestCase { /** * When you define a given shape, * The validation should be applied to each item in the array. */ public function test_arrays_of_assoc_arrays() { // Create ...
projects/packages/wp-js-data-sync/tests/php/schema/integration/test-integration-fallback-values.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Data_Sync_Entry_Adapter; use Automattic\Jetpack\WP_JS_Data_Sync\Data_Sync_Option; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Context; use Automattic\Jetpack\WP_J...
projects/packages/wp-js-data-sync/tests/php/schema/integration/test-integration-parsing-errors.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Context; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Test_Integration_Parsing_Errors extends TestCase { /** * This unit test has internal methods d...
projects/packages/wp-js-data-sync/tests/php/schema/type/test-modifier-fallback.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Test_Modifier_Fallback extends TestCase { public function test_parse_with_first_parser() { $schema = Schema::either( Schema::as_string(), Schema::as_array( ...
projects/packages/wp-js-data-sync/tests/php/schema/type/test-type-array.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Type_Array_Test extends TestCase { public function test_regular_arrays() { $type_array = Schema::as_array( Schema::as_string() ); // Test with valid arra...
projects/packages/wp-js-data-sync/tests/php/schema/type/test-type-string.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Test_Type_String extends TestCase { public function simple_strings() { $validator = Schema::as_string(); $this->assertSame( 'hello world', $validator->par...
projects/packages/wp-js-data-sync/tests/php/schema/type/test-type-number.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Test_Type_Number extends TestCase { public function cast_strings_to_numbers() { $validator = Schema::as_number(); $this->assertSame( 123, $validator->pars...
projects/packages/wp-js-data-sync/tests/php/schema/type/test-type-enum.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Test_Type_Enum extends TestCase { public function test_parse_valid_enum() { $validator = Schema::enum( array( 'foo', 'bar', 'baz' ) ); $this->assertSame( ...
projects/packages/wp-js-data-sync/tests/php/schema/type/test-type-assoc-array.php
<?php use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; use PHPUnit\Framework\TestCase; class Type_Assoc_Array_Test extends TestCase { public function test_valid_assoc_array() { $assoc_schema = Schema::...
projects/packages/wp-js-data-sync/src/class-ds-utils.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; class DS_Utils { private static $mode; /** * Is the current environment a development environment? * * @return bool */ public static function is_debug(): bool { return ( ( defined( 'DATASYNC_DE...
projects/packages/wp-js-data-sync/src/class-data-sync-option.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Delete; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Get; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Set; final class Data_Sync_Option implements Entry_Can_Get, Entry_Can_Set, ...
projects/packages/wp-js-data-sync/src/class-data-sync-readonly.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Get; final class Data_Sync_Readonly implements Entry_Can_Get { private $callback; public function __construct( $callback ) { $this->callback = $callback; } public function get( $fallback_value = fals...
projects/packages/wp-js-data-sync/src/class-data-sync.php
<?php /** * This is the main file for the Data_Sync package. * * It's responsible for setting up the registry and the endpoints. * * Setting up with something like this: * * ``` * class Widget_Status extends Data_Sync_Handler {} * class Widget_Data extends Data_Sync_Handler {} * * $instance = ...
projects/packages/wp-js-data-sync/src/class-data-sync-entry-adapter.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Data_Sync_Entry; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Delete; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Get; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Merge; use...
projects/packages/wp-js-data-sync/src/class-registry.php
<?php /** * The Registry class is a singleton that stores references to all Data_Sync_Entry instances. * It also stores references to all Endpoint instances. * It is namespaced to allow for multiple registries. * * @package automattic/jetpack-wp-js-data-sync */ namespace Automattic\Jetpack\WP_JS_Data_Sync; use ...
projects/packages/wp-js-data-sync/src/endpoints/class-endpoint.php
<?php /** * Register and handle REST API Endpoints for each data sync entry. * * @package automattic/jetpack-wp-js-data-sync */ namespace Automattic\Jetpack\WP_JS_Data_Sync\Endpoints; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Data_Sync_Entry; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Delet...
projects/packages/wp-js-data-sync/src/endpoints/class-authenticated-nonce.php
<?php /** * Every Data Sync endpoint should be protected by nonce that belongs to an authenticated user. * and is generated and verified for that specific endpoint. * * @package automattic/jetpack-wp-js-data-sync */ namespace Automattic\Jetpack\WP_JS_Data_Sync\Endpoints; use Automattic\Jetpack\WP_JS_Data_Sync\DS...
projects/packages/wp-js-data-sync/src/endpoints/class-action-endpoint.php
<?php /** * Register and handle custom action REST API Endpoints for data sync entries. * * @package automattic/jetpack-wp-js-data-sync */ namespace Automattic\Jetpack\WP_JS_Data_Sync\Endpoints; use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Data_Sync_Action; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use...
projects/packages/wp-js-data-sync/src/contracts/interface-entry-can-merge.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; interface Entry_Can_Merge extends Entry_Can_Set { public function merge( $previous_value, $partial_value ); }
projects/packages/wp-js-data-sync/src/contracts/interface-entry-custom-endpoint.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; interface Entry_Has_Custom_Endpoints { public function set( $value ); }
projects/packages/wp-js-data-sync/src/contracts/interface-entry-can-set.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; interface Entry_Can_Set { public function set( $value ); }
projects/packages/wp-js-data-sync/src/contracts/interface-lazy-entry.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; use Automattic\Jetpack\WP_JS_Data_Sync\Data_Sync; interface Lazy_Entry { /** * "Look pal, I'm so lazy I can't even finish this sente.." - Lazy Entry * * Entries can tag themselves as "lazy" by implementing this interface. * By tagging an entry as...
projects/packages/wp-js-data-sync/src/contracts/interface-data-sync-action.php
<?php /** * Interface for action classes in the data sync system. * * @package automattic/jetpack-wp-js-data-sync */ namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; /** * Interface Action_Interface */ interface Data_Sync_Action { /** * Handles the action logic. * * @param mixed $data JSON Data pa...
projects/packages/wp-js-data-sync/src/contracts/interface-entry-can-get.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; interface Entry_Can_Get { public function get( $fallback_value ); }
projects/packages/wp-js-data-sync/src/contracts/interface-data-sync-entry.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; /** * Data Sync Entry Interface: * ========================== * This interface defines what is a Data Sync Entry. */ interface Data_Sync_Entry { /** * Checks if this Data Sync Entry implements a specific interface. * * @param string $interface_...
projects/packages/wp-js-data-sync/src/contracts/interface-entry-can-delete.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Contracts; interface Entry_Can_Delete { public function delete(); }
projects/packages/wp-js-data-sync/src/schema/class-schema.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Modifiers\Modifier_Fallback; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types\Type_Any; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types\Type_Any_JSON; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types\Typ...
projects/packages/wp-js-data-sync/src/schema/class-schema-error.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema; class Schema_Error extends \RuntimeException { private $value; private $context; public function __construct( $message, $value, $context = null ) { $this->value = $value; $this->context = $context; parent::__construct( $message ); } public func...
projects/packages/wp-js-data-sync/src/schema/interface-parser.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema; /** * The Parser interface defines the contract for schema type classes. * * Each schema type class implementing this interface should provide a parse * method to handle converting the input value to the correct data type. * * The purpose of the interfa...
projects/packages/wp-js-data-sync/src/schema/class-schema-parser.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Modifiers\Modifier_Fallback; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types\Type_Literal; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types\Type_Void; class...
projects/packages/wp-js-data-sync/src/schema/class-schema-context.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; class Schema_Context { private $name; private $data; private $path = array(); /** * @var array $log Log of notable actions taken during parsing. */ private $log = array(); /** * @param string $n...
projects/packages/wp-js-data-sync/src/schema/modifiers/class-modifier-fallback.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Modifiers; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Modifier_Fallback implements Parser { private $parsers = array(); public fun...
projects/packages/wp-js-data-sync/src/schema/types/class-type-literal.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; class Type_Literal implements Parser { /** * @var mixed */ private $literal_value; public function __construct( $literal_value ) { $this->literal_value = $literal_value; } public functi...
projects/packages/wp-js-data-sync/src/schema/types/class-type-string.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_String implements Parser { public function parse( $value, $_context ) { if ( ! is_scalar( $value ) || null === $value ) { ...
projects/packages/wp-js-data-sync/src/schema/types/class-type-boolean.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Boolean implements Parser { public function parse( $value, $_context ) { if ( is_bool( $value ) ) { return $value; } ...
projects/packages/wp-js-data-sync/src/schema/types/class-type-enum.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Enum implements Parser { /** * @var $valid_values array The list of valid values for the enum. */ protected $valid_value...
projects/packages/wp-js-data-sync/src/schema/types/class-type-any-json.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Any_JSON implements Parser { public function parse( $value, $_context ) { if ( ! is_array( $value ) ) { $message = 'JSON...
projects/packages/wp-js-data-sync/src/schema/types/class-type-number.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Number implements Parser { public function parse( $value, $_context ) { if ( ! is_numeric( $value ) ) { throw new Schema...
projects/packages/wp-js-data-sync/src/schema/types/class-type-assoc-array.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Assoc_Array implements Parser { private $parser; /** * Assoc Array type t...
projects/packages/wp-js-data-sync/src/schema/types/class-type-any.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; /** * ! USE WITH CAUTION ! * This schema will not parse values. Use only when you're sure that the data can be trusted. * For example - this can be used to deliver readonly data to the client. *...
projects/packages/wp-js-data-sync/src/schema/types/class-type-void.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\DS_Utils; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; /** * This schema represents no data whatsoever. It will always return null. */ class T...
projects/packages/wp-js-data-sync/src/schema/types/class-type-float.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Float implements Parser { public function parse( $value, $_context ) { if ( ! is_numeric( $value ) ) { throw new Schema_E...
projects/packages/wp-js-data-sync/src/schema/types/class-type-array.php
<?php namespace Automattic\Jetpack\WP_JS_Data_Sync\Schema\Types; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Parser; use Automattic\Jetpack\WP_JS_Data_Sync\Schema\Schema_Error; class Type_Array implements Parser { private $parser; /** * Array type takes in a parser in the constructor and * will parse each v...
projects/packages/waf/cli.php
<?php /** * Registers the CLI functionality. * * @package automattic/jetpack-waf */ namespace Automattic\Jetpack\Waf; if ( defined( 'WP_CLI' ) && \WP_CLI ) { \WP_CLI::add_command( 'jetpack-waf', CLI::class ); }