Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"require": {
"ext-openssl": "*",
"automattic/jetpack-logo": "@dev"
"automattic/jetpack-logo": "@dev",
"automattic/jetpack-api": "@dev"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "0.5.0",
Expand All @@ -26,7 +27,10 @@
"repositories": [
{
"type": "path",
"url": "./packages/*"
"url": "./packages/*",
"options": {
"symlink": true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, could we remove this? Ideally, we should be symlinking by default but mirroring for production.

}
}
]
}
37 changes: 31 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,30 @@ function jetpack_admin_missing_autoloader() { ?>
* We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.
* If the autoloader is not present, let's log the failure, pause Jetpack, and display a nice admin notice.
*/
$jetpack_autoloader = JETPACK__PLUGIN_DIR . 'vendor/autoload.php';
if ( is_readable( $jetpack_autoloader ) ) {
require $jetpack_autoloader;

if ( ! function_exists( 'jetpack_register_plugin_classloader' ) ) {
function jetpack_register_plugin_classloader( $plugin_dir_path, $loader ) {
global $jetpack_autoloaders;
if ( is_array( $jetpack_autoloaders ) ) {
$jetpack_autoloaders = array();
}
$jetpack_autoloaders[ $plugin_dir_path ] = $loader;
}
}

if ( ! function_exists( 'jetpack_get_plugin_classloader' ) ) {
function jetpack_get_plugin_classloader( $plugin_dir_path ) {
global $jetpack_autoloaders;
if ( isset( $jetpack_autoloaders[ $plugin_dir_path ] ) ) {
return $jetpack_autoloaders[ $plugin_dir_path ];
}
return null;
}
}

$autoload_path = JETPACK__PLUGIN_DIR . 'vendor/autoload.php';
if ( is_readable( $autoload_path ) ) {
jetpack_register_plugin_classloader( JETPACK__PLUGIN_DIR, require( $autoload_path ) );
} else {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log(
Expand All @@ -198,7 +219,6 @@ function jetpack_admin_missing_autoloader() { ?>
return;
}


add_filter( 'jetpack_require_lib_dir', 'jetpack_require_lib_dir' );
add_filter( 'jetpack_should_use_minified_assets', 'jetpack_should_use_minified_assets', 9 );

Expand Down
4 changes: 3 additions & 1 deletion json-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

$json_endpoints_dir = dirname( __FILE__ ) . '/json-endpoints/';

$loader = jetpack_get_plugin_classloader( plugin_dir_path( __FILE__ ) );

//abstract endpoints
require_once( $json_endpoints_dir . 'class.wpcom-json-api-post-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-post-v1-1-endpoint.php' ); // v1.1
Expand All @@ -29,7 +31,7 @@
require_once( $json_endpoints_dir . 'class.wpcom-json-api-render-embed-reversal-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-render-embed-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-embeds-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-site-endpoint.php' );
$loader->loadClass( 'WPCOM_JSON_API_GET_Site_Endpoint' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-taxonomies-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-taxonomy-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-term-endpoint.php' );
Expand Down
7 changes: 7 additions & 0 deletions packages/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Jetpack API

Common code to support the Jetpack APIs

### Usage

TODO
15 changes: 15 additions & 0 deletions packages/api/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "automattic/jetpack-api",
"description": "The Jetpack API",
"type": "library",
"license": "GPL-2.0-or-later",
"require": {},
"autoload": {
"classmap": [
"legacy/"
],
"psr-4": {
"Automattic\\Jetpack\\Api\\": "src/"
}
}
}
9 changes: 9 additions & 0 deletions packages/api/src/Xmlrpc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Automattic\Jetpack\Api;

class Xmlrpc {
function __construct() {
error_log( 'constructed XMLRPC endpoint' );
}
}