filename
stringlengths
11
137
content
stringlengths
6
292k
projects/plugins/jetpack/class.jetpack-network-sites-list-table.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Jetpack network sites list table. * * @package automattic/jetpack */ if ( ! class_exists( 'WP_List_Table' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; } /** * Jetpack network sites list table. */ class Jetpac...
projects/plugins/jetpack/load-jetpack.php
<?php /** * Load all Jetpack files that do not get loaded via the autoloader. * * @package automattic/jetpack */ /** * Checks if the code debug mode turned on, and returns false if it is. When Jetpack is in * code debug mode, it shouldn't use minified assets. Note that this filter is not being used * in every p...
projects/plugins/jetpack/class-jetpack-wizard-banner.php
<?php /** * Deprecated since 9.5.0 * * @deprecated * @package automattic/jetpack */ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped _deprecated_file( basename( __FILE__ ), 'jetpack-9.5.0' );
projects/plugins/jetpack/uninstall.php
<?php /** * Functionality that is executed when Jetpack is uninstalled via built-in WordPress commands. * * @package automattic/jetpack */ use Automattic\Jetpack\Backup\V0003\Helper_Script_Manager; use Automattic\Jetpack\Connection\Manager as Connection_Manager; use Automattic\Jetpack\Sync\Sender; /** * Uninstal...
projects/plugins/jetpack/class.jetpack-autoupdate.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Handles items that have been selected for automatic updates. * Hooks into WP_Automatic_Updater * * @package automattic/jetpack */ /** * Handles items that have been selected for automatic updates. * Hooks into WP_Automatic_Updater */ cla...
projects/plugins/jetpack/class.jetpack-affiliate.php
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase /** * Deprecated since 8.1.0. * Functionality moved to the automattic/jetpack-partner package. * * @package automattic/jetpack */
projects/plugins/jetpack/class.jetpack-client-server.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Client = Plugin * Client Server = API Methods the Plugin must respond to * * @package automattic/jetpack */ use Automattic\Jetpack\Connection\Webhooks; /** * Client = Plugin * Client Server = API Methods the Plugin must respond to */ cl...
projects/plugins/jetpack/json-api-config.php
<?php /** * Config for the WP.com REST API * * @package automattic/jetpack */ define( 'WPCOM_JSON_API__CURRENT_VERSION', '1.1' ); global $wpcom_json_api_production_versions, $wpcom_json_api_dev_versions; $wpcom_json_api_production_versions = array( '1', '1.1', ); $wpcom_json_api_dev_versions = array( '1.2', ...
projects/plugins/jetpack/class.jetpack-plan.php
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Handles fetching of the site's plan and products from WordPress.com and caching values locally. * * @deprecated 12.3 use Automattic\Jetpack\Current_Plan instead. * * Not to be confused with the `Jetpack_Plans` class (in `_inc/lib/plans.php`),...
projects/plugins/jetpack/class.json-api-endpoints.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Jetpack API endpoint base class. * * @package automattic/jetpack */ use Automattic\Jetpack\Connection\Client; use Automattic\Jetpack\Status; require_once __DIR__ . '/json-api-config.php'; require_once __DIR__ . '/sal/class.json-api-links.ph...
projects/plugins/jetpack/jetpack.php
<?php /** * Plugin Name: Jetpack * Plugin URI: https://jetpack.com * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. * Author: Automattic * Version: 13.3-a.0 * Author URI: https://jetpack.com * License...
projects/plugins/jetpack/class.jetpack-user-agent.php
<?php /** * Deprecated. Use Automattic\Jetpack\Device_Detection\User_Agent_Info instead. * * @package automattic/jetpack * * @deprecated 8.7.0 Use Automattic\Jetpack\Device_Detection\User_Agent_Info * * Note: we cannot get rid of the class and its methods yet as multiple plugins * still use it. See https://gith...
projects/plugins/jetpack/functions.photon.php
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase /** * Generic functions using the Photon service. * * Some are used outside of the Photon module being active, so intentionally not within the module. * As photon has been moved to the image-cdn package, the functions are now also replaced by the...
projects/plugins/jetpack/class.json-api.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Jetpack JSON API. * * @package automattic/jetpack */ use Automattic\Jetpack\Status; if ( ! defined( 'WPCOM_JSON_API__DEBUG' ) ) { define( 'WPCOM_JSON_API__DEBUG', false ); } require_once __DIR__ . '/sal/class.json-api-platform.php'; /** ...
projects/plugins/jetpack/class.jetpack-admin.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Build the Jetpack admin menu as a whole. * * @package automattic/jetpack */ use Automattic\Jetpack\Admin_UI\Admin_Menu; use Automattic\Jetpack\Current_Plan as Jetpack_Plan; use Automattic\Jetpack\Partner_Coupon as Jetpack_Partner_Coupon; use...
projects/plugins/jetpack/class.frame-nonce-preview.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Allows viewing posts on the frontend when the user is not logged in. * * @package automattic/jetpack */ // phpcs:disable WordPress.Security.NonceVerification.Recommended -- This is _implementing_ cross-site nonce handling, no need for WordPr...
projects/plugins/jetpack/class.jetpack-heartbeat.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Jetpack Heartbeat. * * @package automattic/jetpack */ use Automattic\Jetpack\Connection\Manager; use Automattic\Jetpack\Heartbeat; /** * Jetpack Heartbeat. */ class Jetpack_Heartbeat { /** * Holds the singleton instance of this class ...
projects/plugins/jetpack/functions.global.php
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase /** * This file is meant to be the home for any generic & reusable functions * that can be accessed anywhere within Jetpack. * * This file is loaded whether Jetpack is active. * * Please namespace with jetpack_ * * @package automattic/jetpack...
projects/plugins/jetpack/class.jetpack-idc.php
<?php // phpcs:disable Squiz.Commenting.FileComment.SpacingAfterComment /** * Identity Crisis handler. * * @deprecated 9.8.0. Functionality moved to the automattic/identity-crisis package. * @package automattic/jetpack */ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped _deprecated_file( basename...
projects/plugins/jetpack/class.jetpack-post-images.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Useful for finding an image to display alongside/in representation of a specific post. * * @package automattic/jetpack */ use Automattic\Jetpack\Image_CDN\Image_CDN_Core; /** * Useful for finding an image to display alongside/in representa...
projects/plugins/jetpack/class.jetpack-twitter-cards.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Jetpack Twitter Card handling. * * @package automattic/jetpack */ /** * Twitter Cards * * Hooks onto the Open Graph protocol and extends it by adding only the tags * we need for twitter cards. * * @see /wp-content/blog-plugins/open-gra...
projects/plugins/jetpack/functions.opengraph.php
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase /** * Open Graph Tags * * Add Open Graph tags so that Facebook (and any other service that supports them) * can crawl the site better and we provide a better sharing experience. * * @link https://ogp.me/ * @link https://developers.facebook.com...
projects/plugins/jetpack/class.jetpack-data.php
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase /** * Deprecated since 9.5. * * @deprecated * @package automattic/jetpack */ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped _deprecated_file( basename( __FILE__ ), 'jetpack-9.5' );
projects/plugins/jetpack/tools/check-block-assets.php
#!/usr/bin/env php <?php /** * Script to check blocks' view.asset.php for unexpected dependencies. * * @package automattic/jetpack */ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- This is not WordPress code. /** * Non-WP dependencies to check for. * * @var string[] */ $bad_deps = array(...
projects/plugins/jetpack/tools/build-asset-cdn-json.php
<?php /** * Script to build modules/photon-cdn/jetpack-manifest.php * * @package automattic/jetpack */ // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.system_calls_proc_open, WordPress.WP.AlternativeFunctions // The repo root path. $jetpack_path = dirname( __DIR__ ) . '/'; // Build an iterator over all fi...
projects/plugins/jetpack/tools/build-module-headings-translations.php
<?php /** * Creates the module-headings.php file. * * @package jetpack */ // phpcs:disable WordPress.WP.AlternativeFunctions, WordPress.PHP.DevelopmentFunctions.error_log_var_export $all_module_headers = array( 'name' => 'Module Name', 'description' => 'Module Description', '...
projects/plugins/jetpack/sal/class.json-api-date.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * WPCOM_JSON_API_Date class. * * @package automattic/jetpack */ /** * Base class for WPCOM_JSON_API_Date. */ class WPCOM_JSON_API_Date { /** * Returns ISO 8601 formatted datetime: 2011-12-08T01:15:36-08:00 * * @param string $date_gmt G...
projects/plugins/jetpack/sal/class.json-api-links.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * WPCOM_JSON_API_Links class. * * @package automattic/jetpack */ require_once __DIR__ . '/../class.json-api.php'; /** * Base class for WPCOM_JSON_API_Links. */ class WPCOM_JSON_API_Links { /** * An instance of the WPCOM_JSON_API. * ...
projects/plugins/jetpack/sal/class.json-api-site-jetpack-base.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * This class extends the SAL_Site class, providing the implementation for * functions that were declared in that SAL_Site class as well as defining * base functions to be implemented in class Jetpack_Site. * * @see class.json-api-site-jetpack...
projects/plugins/jetpack/sal/class.json-api-site-jetpack.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * This class extends the Abstract_Jetpack_Site class, which includes providing * the implementation for functions that were declared in that class. * * @see class.json-api-site-jetpack-base.php for more context on some of * the functions exte...
projects/plugins/jetpack/sal/class.json-api-site-base.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * This file defines the base class for the Site Abstraction Layer (SAL). * Note that this is the site "as seen by user $user_id with token $token", which * is why we pass the token to the platform; these site instances are value objects * to be...
projects/plugins/jetpack/sal/class.json-api-post-base.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * This class wraps a WP_Post and proxies any undefined attributes * and methods to the wrapped class. We need to do this because at present * the WP_Post class is marked as final (in 4.5 this will change, though it's * not clear if there will b...
projects/plugins/jetpack/sal/class.json-api-metadata.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * WPCOM_JSON_API_Metadata class - Utility classes that don't necessarily have a home yet. * * @package automattic/jetpack */ /** * Base class for WPCOM_JSON_API_Metadata */ class WPCOM_JSON_API_Metadata { /** * Checks to see if a meta key...
projects/plugins/jetpack/sal/class.json-api-token.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * SAL_Token class * * @package automattic/jetpack */ /** * Base class for Jetpack_Site, so that we have a real class instead of just passing around an array. */ class SAL_Token { /** * The Jetpack blog ID for the site. * * @var int ...
projects/plugins/jetpack/sal/class.json-api-platform.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * SAL_Platform class which defines a token to later be associated with a Jetpack site * * @package automattic/jetpack */ require_once __DIR__ . '/class.json-api-token.php'; /** * Base class for SAL_Platform */ abstract class SAL_Platform {...
projects/plugins/jetpack/sal/class.json-api-platform-jetpack.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * WPORG_Platform class that extends SAL_Platform, returning a Jetpack_Site with a $blog_id and $token * * @package automattic/jetpack */ require_once __DIR__ . '/class.json-api-platform.php'; /** * Base class for WPORG_Platform, which extend...
projects/plugins/jetpack/sal/class.json-api-post-jetpack.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * This class extends the SAL_Post class, providing the implementation for * functions that were declared in that SAL_Post class. * * @see WPCOM_JSON_API_Post_v1_1_Endpoint in class.wpcom-json-api-post-v1-1-endpoint.php for more context on * th...
projects/plugins/jetpack/3rd-party/qtranslate-x.php
<?php /** * 3rd party integration for qTranslate. * * @package automattic/jetpack */ /** * Prevent qTranslate X from redirecting REST calls. * * @since 5.3 * * @param string $url_lang Language URL to redirect to. * @param string $url_orig Original URL. * @param array $url_info Pieces of original URL. * ...
projects/plugins/jetpack/3rd-party/debug-bar.php
<?php /** * 3rd Party integration for Debug Bar. * * @package automattic/jetpack */ /** * Checks if the search module is active, and if so, will initialize the singleton instance * of Jetpack_Search_Debug_Bar and add it to the array of debug bar panels. * * @param array $panels The array of debug bar panels. ...
projects/plugins/jetpack/3rd-party/web-stories.php
<?php /** * Compatibility functions for the Web Stories plugin. * https://wordpress.org/plugins/web-stories/ * * @since 9.2.0 * * @package automattic/jetpack */ namespace Automattic\Jetpack\Web_Stories; if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Filter to enable web stories built in open graph data from ...
projects/plugins/jetpack/3rd-party/creative-mail.php
<?php /** * Compatibility functions for the Creative Mail plugin. * https://wordpress.org/plugins/creative-mail-by-constant-contact/ * * @since 8.9.0 * * @package automattic/jetpack */ namespace Automattic\Jetpack\Creative_Mail; use Automattic\Jetpack\Plugins_Installer; if ( ! defined( 'ABSPATH' ) ) { exit; ...
projects/plugins/jetpack/3rd-party/woocommerce.php
<?php /** * This file contains compatibility functions for WooCommerce to improve Jetpack feature support. * * @package automattic/jetpack */ add_action( 'woocommerce_init', 'jetpack_woocommerce_integration' ); /** * Loads JP+WC integration. * * Fires on `woocommerce_init` hook */ function jetpack_woocommerce...
projects/plugins/jetpack/3rd-party/wpml.php
<?php /** * Only load these if WPML plugin is installed and active. * * @package automattic/jetpack */ /** * Load routines only if WPML is loaded. * * @since 4.4.0 */ function wpml_jetpack_init() { add_action( 'jetpack_widget_get_top_posts', 'wpml_jetpack_widget_get_top_posts', 10, 3 ); add_filter( 'grunion_...
projects/plugins/jetpack/3rd-party/class-salesforce-lead-form.php
<?php /** * Salesforce Lead Form using Jetpack Contact Forms. * * @package automattic/jetpack */ namespace Automattic\Jetpack; /** * Class Salesforce_Lead_Form * * Hooks on Jetpack's Contact form to send form data to Salesforce. */ class Salesforce_Lead_Form { /** * Salesforce_Contact_Form constructor. *...
projects/plugins/jetpack/3rd-party/beaverbuilder.php
<?php /** * Beaverbuilder Compatibility. * * @package automattic/jetpack */ namespace Automattic\Jetpack\Third_Party; add_action( 'init', __NAMESPACE__ . '\beaverbuilder_refresh' ); /** * If masterbar module is active force BeaverBuilder to refresh when publishing a layout. */ function beaverbuilder_refresh() ...
projects/plugins/jetpack/3rd-party/woocommerce-services.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName use Automattic\Jetpack\Plugins_Installer; if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Installs and activates the WooCommerce Services plugin. */ class WC_Services_Installer { /** * The instance of the Jetpack class. * * @var Jetpack *...
projects/plugins/jetpack/3rd-party/atomic.php
<?php /** * Helper functions for the Atomic platform. * * @package automattic/jetpack */ namespace Automattic\Jetpack\Third_Party; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Status\Host; /** * Handles suppressing development version notices on Atomic-hosted sites. * * @param bool $development_ve...
projects/plugins/jetpack/3rd-party/vaultpress.php
<?php /** * Handles VaultPress->Rewind transition by deactivating VaultPress when needed. * * @package automattic/jetpack */ use Automattic\Jetpack\Redirect; /** * Notify user that VaultPress has been disabled. Hide VaultPress notice that requested attention. * * @since 5.8 */ function jetpack_vaultpress_rewi...
projects/plugins/jetpack/3rd-party/amp.php
<?php /** * This file contains compatibility features for AMP to improve Jetpack feature support. * * @package automattic/jetpack */ namespace Automattic\Jetpack; /** * Load Jetpack_AMP_Support. */ function load_3rd_party_amp_support() { // Only load the support class when AMP actually initializes. // This av...
projects/plugins/jetpack/3rd-party/bitly.php
<?php /** * Fixes issues with the Official Bitly for WordPress * https://wordpress.org/plugins/bitly/ * * @package automattic/jetpack */ if ( isset( $GLOBALS['bitly'] ) ) { if ( method_exists( $GLOBALS['bitly'], 'og_tags' ) ) { remove_action( 'wp_head', array( $GLOBALS['bitly'], 'og_tags' ) ); } add_action(...
projects/plugins/jetpack/3rd-party/crowdsignal.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Fallback for the Crowdsignal Plugin. * * The PollDaddy/Crowdsignal prior to v. 2.033 called Jetpack_Sync as long as the Jetpack class was present. This stub is provided to prevent any fatals for older versions of the plugin. * This was resolv...
projects/plugins/jetpack/3rd-party/class-domain-mapping.php
<?php /** * Domain Mapping 3rd Party * * @package automattic/jetpack */ namespace Automattic\Jetpack\Third_Party; use Automattic\Jetpack\Constants; /** * Class Automattic\Jetpack\Third_Party\Domain_Mapping. * * This class contains methods that are used to provide compatibility between Jetpack sync and domain ...
projects/plugins/jetpack/3rd-party/3rd-party.php
<?php /** * Compatibility files for third-party plugins. * This is used to improve compatibility of specific Jetpack features with third-party plugins. * * @package automattic/jetpack */ namespace Automattic\Jetpack; use Automattic\Jetpack\Status\Host; add_action( 'plugins_loaded', __NAMESPACE__ . '\load_3rd_pa...
projects/plugins/jetpack/3rd-party/bbpress.php
<?php /** * Compatibility functions for bbpress. * * Only added if bbpress is active via function_exists( 'bbpress' ) in 3rd-party.php. * * @package automattic/jetpack */ use Automattic\Jetpack\Image_CDN\Image_CDN; // Priority 11 needed to ensure sharing_display is loaded. add_action( 'init', 'jetpack_bbpress_c...
projects/plugins/jetpack/3rd-party/jetpack-backup.php
<?php /** * Compatibility functions for the Jetpack Backup plugin. * https://wordpress.org/plugins/jetpack-backup/ * * @since 10.4 * * @package automattic/jetpack */ namespace Automattic\Jetpack\Jetpack_Backup; use Automattic\Jetpack\Plugins_Installer; if ( ! defined( 'ABSPATH' ) ) { exit; } const PLUGIN_SL...
projects/plugins/jetpack/3rd-party/buddypress.php
<?php /** * 3rd Party Integration for BuddyPress. * * @package automattic/jetpack. */ namespace Automattic\Jetpack\Third_Party; add_filter( 'bp_core_pre_avatar_handle_upload', __NAMESPACE__ . '\blobphoto' ); /** * Adds filters for skipping photon during pre_avatar_handle_upload. * * @param bool $bool Passthro...
projects/plugins/jetpack/3rd-party/jetpack-boost.php
<?php /** * Compatibility functions for the Jetpack Boost plugin. * https://wordpress.org/plugins/jetpack-boost/ * * @since 10.4 * * @package automattic/jetpack */ namespace Automattic\Jetpack\Jetpack_Boost; use Automattic\Jetpack\Plugins_Installer; if ( ! defined( 'ABSPATH' ) ) { exit; } const PLUGIN_SLUG ...
projects/plugins/jetpack/3rd-party/class-jetpack-bbpress-rest-api.php
<?php /** * REST API Compatibility: bbPress & Jetpack * Enables bbPress to work with the Jetpack REST API * * @package automattic/jetpack */ /** * REST API Compatibility: bbPress. */ class Jetpack_BbPress_REST_API { /** * Singleton * * @var Jetpack_BbPress_REST_API. */ private static $instance; /**...
projects/plugins/jetpack/3rd-party/class.jetpack-amp-support.php
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName use Automattic\Jetpack\Assets; use Automattic\Jetpack\Stats\Tracking_Pixel as Stats_Tracking_Pixel; use Automattic\Jetpack\Sync\Functions; /** * Manages compatibility with the amp-wp plugin * * @see https://github.com/Automattic/amp-wp */ class Je...
projects/plugins/jetpack/3rd-party/debug-bar/class-jetpack-search-debug-bar.php
<?php /** * Adds a Jetpack Search debug panel to Debug Bar. * * @package automattic/jetpack */ use Automattic\Jetpack\Search as Jetpack_Search; /** * Singleton class instantiated by Jetpack_Searc_Debug_Bar::instance() that handles * rendering the Jetpack Search debug bar menu item and panel. */ class Jetpack_S...
projects/plugins/jetpack/tests/php/test_deprecation.php
<?php class WP_Test_Jetpack_Deprecation extends WP_UnitTestCase { /** * @dataProvider provider_deprecated_file_paths */ public function test_deprecated_file_paths( $file_path, $replacement_path ) { $this->setExpectedDeprecated( $file_path ); $mock = $this->getMockBuilder( stdClass::class ) ->setMethods(...
projects/plugins/jetpack/tests/php/trait-woo-tests.php
<?php /** * Adds WooCommerce phpunit dependencies once, before all tests of the class * using this trait are run. */ trait WooCommerceTestTrait { /** * Is Woo Enabled * * @var bool */ protected static $woo_enabled = false; /** * @beforeClass **/ public static function set_up_woo_before_class() { i...
projects/plugins/jetpack/tests/php/redefine-exit.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Use Patchwork to redefine `exit()` and `die()`. * * This should be loaded as early as possible, as it will only take effect * for files loaded after this one. * * @package automattic/jetpack */ /** * Exception to represent the calling of...
projects/plugins/jetpack/tests/php/bootstrap.php
<?php /** * Bootstrap the plugin unit testing environment. * * @package automattic/jetpack */ // Catch `exit()` and `die()` so they won't make PHPUnit exit. require __DIR__ . '/redefine-exit.php'; /* * For tests that should be skipped in Jetpack but run in WPCOM (or vice versa), test against this constant. * *...
projects/plugins/jetpack/tests/php/attachment_test_case.php
<?php // phpcs:ignore WordPress.Files.FileName /** * Class with methods common to tests involving attachments. * * @since 3.9.2 */ class Jetpack_Attachment_Test_Case extends WP_UnitTestCase { /** * A helper to create an upload object. This method was copied verbatim from WP Core's * WP_UnitTest_Factory_For_At...
projects/plugins/jetpack/tests/php/test-get-modules.php
<?php /** * Test module related methods in Jetpack and Jetpack_Admin class. * * @package jetpack */ use Automattic\Jetpack\Status\Cache as StatusCache; /** * Test module related methods in Jetpack and Jetpack_Admin class. */ class WP_Test_Get_Modules extends WP_UnitTestCase { /** * Store all available modul...
projects/plugins/jetpack/tests/php/test_class.functions.opengraph.php
<?php /** * Class with PHPUnit tests for Open Graph functions. * * @since 3.9.2 */ class WP_Test_Functions_OpenGraph extends Jetpack_Attachment_Test_Case { private $icon_id; /** * Include Open Graph functions before each test. * * @since 3.9.2 */ public function set_up() { parent::set_up(); $this-...
projects/plugins/jetpack/tests/php/test_functions.compat.php
<?php /** * Test the compat file. * * @package Automattic/jetpack */ /** * Testing class. */ class WP_Test_Jetpack_Compat_Functions extends WP_UnitTestCase { /** * @dataProvider provider_wp_startswith */ public function test_wp_startswith( $haystack, $needle, $expected ) { $this->assertEquals( $expected...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-post-jetpack.php
<?php require_once JETPACK__PLUGIN_DIR . 'sal/class.json-api-platform.php'; class SalPostsTest extends WP_UnitTestCase { public static $token; public static $site; /** * Set up before class. */ public static function set_up_before_class() { parent::set_up_before_class(); self::$token = (object) array( ...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-sync-endpoints.php
<?php /** * Jetpack `sites/%s/sync` endpoint unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php'; /** * Jetpack `site/%s/sync` endpoint unit tests. */ class WP_Test_Jetpack_Sync_Json_Api_Endpoints extends WP_UnitTestCase { /** * Inserts globals ne...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-plugins-endpoints.php
<?php use Automattic\Jetpack\Constants; require_once JETPACK__PLUGIN_DIR . 'class.json-api.php'; require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php'; class WP_Test_Jetpack_Json_Api_Plugins_Endpoints extends WP_UnitTestCase { private static $super_admin_user_id; public static function wpSetUpBeforeCl...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-endpoints.php
<?php /** * Tests for /sites/%s/categories/slug:%s * * @package automattic/jetpack */ if ( ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) && defined( 'JETPACK__PLUGIN_DIR' ) && JETPACK__PLUGIN_DIR ) { require_once JETPACK__PLUGIN_DIR . 'modules/module-extras.php'; } require_once JETPACK__PLUGIN_DIR . 'class.json-api-...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-endpoints-accessibility.php
<?php /** * Generic tests for Jetpack_JSON_API_Endpoint accessibility. * * @package automattic/jetpack * @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound */ use Automattic\Jetpack\Status\Cache as StatusCache; if ( defined( 'JETPACK__PLUGIN_DIR' ) && JETPACK__PLUGIN_DIR ) { require_once JETPA...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-site-endpoints.php
<?php /** * Jetpack `site/%s` endpoint unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php'; // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed if ( ! function_exists( 'has_blog_sticker' ) ) { /** * "Mock" WPCOM sticker function with 'get_...
projects/plugins/jetpack/tests/php/json-api/test_class.json-api-platform-jetpack.php
<?php require_once JETPACK__PLUGIN_DIR . 'sal/class.json-api-platform.php'; class SalSiteTest extends WP_UnitTestCase { public static $token; public static $site; /** * Set up before class. */ public static function set_up_before_class() { parent::set_up_before_class(); self::$token = (object) array( ...
projects/plugins/jetpack/tests/php/json-api/test_class.json-api-jetpack-base-endpoint.php
<?php /** * Jetpack_JSON_API_Endpoint class unit tests. * Run this test with command: jetpack docker phpunit -- --filter=WP_Test_Jetpack_Base_Json_Api_Endpoints * * @package automattic/jetpack * @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound */ require_once JETPACK__PLUGIN_DIR . 'class.json...
projects/plugins/jetpack/tests/php/json-api/test-class.wpcom-json-api-site-settings-v1-4-endpoint.php
<?php /** * Jetpack `sites/%s/settings` endpoint unit tests. * Run this test with command: jetpack docker phpunit -- --filter=WP_Test_WPCOM_JSON_API_Site_Settings_V1_4_Endpoint * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php'; /** * Jetpack `sites/%s/settings`...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-update-post-endpoints.php
<?php /** * Jetpack `sites/%s/posts/%d` endpoint unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php'; /** * Jetpack `sites/%s/posts/%d` endpoint unit tests. */ class WP_Test_Json_Api_Update_Post_Endpoints extends WP_UnitTestCase { /** * Inserts gl...
projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-modules-endpoints.php
<?php /** * Tests for the `sites/%s/jetpack/modules` endpoints. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'class.json-api.php'; require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php'; /** * Tests for the `sites/%s/jetpack/modules` endpoints. */ class WP_Test_Jetpack_Module...
projects/plugins/jetpack/tests/php/general/test-class.functions.compat.php
<?php class WP_Test_Functions_Compat extends WP_UnitTestCase { /** * @author enkrates * @covers ::youtube_sanitize_url * @since 3.2 */ public function test_youtube_sanitize_url_with_valid_url() { $valid_url = 'https://www.youtube.com/watch?v=snAvGxz7D04'; $sanitized_url = youtube_sanitize_url( $valid_...
projects/plugins/jetpack/tests/php/general/test-class.jetpack-options.php
<?php use Automattic\Jetpack\Constants; class WP_Test_Jetpack_Options extends WP_UnitTestCase { /** * Cache for the test option. * * @var mixed */ private $option_cache = false; /** * Set up a fake cache for the option 'test_option'. * * Note the hooks added here will be automatically removed by ...
projects/plugins/jetpack/tests/php/general/test-class.jetpack-gutenberg.php
<?php use Automattic\Jetpack\Blocks; class WP_Test_Jetpack_Gutenberg extends WP_UnitTestCase { public $master_user_id = false; /** * Set up. */ public function set_up() { parent::set_up(); if ( ! function_exists( 'register_block_type' ) ) { $this->markTestSkipped( 'register_block_type not available' )...
projects/plugins/jetpack/tests/php/general/test_class.jetpack-heartbeat.php
<?php class WP_Test_Jetpack_Heartbeat extends WP_UnitTestCase { /** * @covers Jetpack_Heartbeat::init * @since 3.9.0 */ public function test_init() { $this->assertInstanceOf( 'Jetpack_Heartbeat', Jetpack_Heartbeat::init() ); } /** * @covers Jetpack_Heartbeat::generate_stats_array * @since 3.9.0 */ ...
projects/plugins/jetpack/tests/php/general/test_class.functions.global.php
<?php /** * Tests for functions in functions.global.php */ class WP_Test_Functions_Global extends WP_UnitTestCase { /** * Test string returned by jetpack_deprecated_function * * @covers ::jetpack_get_future_removed_version * @since 8.8.0 * @dataProvider jetpack_deprecated_function_versions * * @param ...
projects/plugins/jetpack/tests/php/general/test-class.jetpack-network.php
<?php /** * Tests the Jetpack_Network class. * * @package automattic/jetpack */ if ( is_multisite() ) : /** * Test class for the Jetpack_Network class. */ class WP_Test_Jetpack_Network extends WP_UnitTestCase { /** * Confirms the instance is generated from the init. * * @since 2.5 */ public...
projects/plugins/jetpack/tests/php/general/test_class.jetpack-client-server.php
<?php /** * Tests for Jetpack_Client_Server. * * @covers Jetpack_Client_Server */ class WP_Test_Jetpack_Client_Server extends WP_UnitTestCase { /** * Set up before class. */ public static function set_up_before_class() { parent::set_up_before_class(); self::$ignore_files = true; } /** * @author scot...
projects/plugins/jetpack/tests/php/general/test_class.jetpack-user-agent.php
<?php /** * Tests for Jetpack's legacy User Agent class. * * @package automattic/jetpack */ /** * Class WP_Test_Jetpack_User_Agent */ class WP_Test_Jetpack_User_Agent extends WP_UnitTestCase { /** * Confirm an old improper static use of Jetpack_User_Agent_Info still functions. */ public function test_jetpa...
projects/plugins/jetpack/tests/php/general/test_class.jetpack-xmlrpc-server.php
<?php use Automattic\Jetpack\Connection\Tokens; class WP_Test_Jetpack_XMLRPC_Server extends WP_UnitTestCase { public static $xmlrpc_admin = 0; public static function wpSetupBeforeClass( $factory ) { $user_id = $factory->user->create(); $user = get_user_by( 'ID', $user_id ); $user->set_role( 'administrato...
projects/plugins/jetpack/tests/php/general/test_class.jetpack.php
<?php /** * Tests for the main Jetpack class. * * @package automattic/jetpack * * phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound */ use Automattic\Jetpack\Connection\Manager as Connection_Manager; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Partner; use Automattic\Jetpack\Status...
projects/plugins/jetpack/tests/php/3rd-party/test_class.jetpack-amp-support.php
<?php /** * Test class for Jetpack_AMP_Support. * * @package automattic/jetpack */ /** * Include the code to test. */ require_once JETPACK__PLUGIN_DIR . '3rd-party/class.jetpack-amp-support.php'; require_once JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php'; /** * Class WP_Test_Jetpack_AMP_Suppor...
projects/plugins/jetpack/tests/php/3rd-party/test_class-domain-mapping.php
<?php /** * Tests for the 3rd-party domain mapping plugin integration. * * @package automattic/jetpack * @phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound */ namespace Automattic\Jetpack\Third_Party; use Automattic\Jetpack\Constants; require_once JETPACK__PLUGIN_DIR . '3rd-party/class-domain-...
projects/plugins/jetpack/tests/php/3rd-party/test__atomic.php
<?php /** * Tests functionality in the atomic.php file. */ use Automattic\Jetpack\Constants; use Automattic\Jetpack\Modules; require_once JETPACK__PLUGIN_DIR . '3rd-party/atomic.php'; /** * Class WP_Test_Atomic_Override_Support */ class WP_Test_Atomic_Override_Support extends WP_UnitTestCase { /** * Clean up ...
projects/plugins/jetpack/tests/php/extensions/blocks/test-class.pinterest.php
<?php /** * Pinterest Block tests. * * @package automattic/jetpack */ use Automattic\Jetpack\Extensions\Pinterest; require_once JETPACK__PLUGIN_DIR . '/extensions/blocks/pinterest/pinterest.php'; /** * Pinterest block tests. */ class WP_Test_Pinterest extends \WP_UnitTestCase { /** * Test the Pin type detect...
projects/plugins/jetpack/tests/php/extensions/blocks/test-story.php
<?php /** * Story Block tests * * @package automattic/jetpack */ /** * Include the file containing the block's registration and render functions. */ require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/story/story.php'; /** * Story Block tests. * * These tests primarily check that server rendered markup is ...
projects/plugins/jetpack/tests/php/extensions/blocks/class-block-fixture-testcase.php
<?php /** * Jetpack Block Fixture Test Case. * * @package automattic/jetpack */ /** * Jetpack Block Fixture Test Case with method for testing against the block's * serialized HTML test fixtures, generated by the block's `save` method in JavaScript. */ abstract class Jetpack_Block_Fixture_TestCase extends WP_Uni...
projects/plugins/jetpack/tests/php/extensions/blocks/test-repeat-visitor.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Repeat Visitor Block tests * * @package automattic/jetpack */ /** * Include the file containing the block's registration and render functions. */ require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/repeat-visitor/repeat-visitor.php'; /*...
projects/plugins/jetpack/tests/php/extensions/blocks/test-class.opentable.php
<?php /** * OpenTable Block tests. * * @package automattic/jetpack */ use Automattic\Jetpack\Extensions\OpenTable; require_once JETPACK__PLUGIN_DIR . '/extensions/blocks/opentable/opentable.php'; /** * OpenTable block tests */ class WP_Test_OpenTable extends \WP_UnitTestCase { /** * `load_assets` with empty...
projects/plugins/jetpack/tests/php/extensions/blocks/test-business-hours.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Business Hours Block tests * * @package automattic/jetpack */ /** * Include the file containing the block's registration and render functions. */ require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/business-hours/business-hours.php'; /*...
projects/plugins/jetpack/tests/php/extensions/blocks/premium-content/class-test-jetpack-token-subscription-service.php
<?php namespace Tests\Automattic\Jetpack\Extensions\Premium_Content; use Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service\Jetpack_Token_Subscription_Service; // Overrides the way Jetpack_Token_Subscription_Service get its JWT key class Test_Jetpack_Token_Subscription_Service extends Jetpack_Token_S...
projects/plugins/jetpack/tests/php/extensions/blocks/premium-content/test_class.jetpack-premium-content.php
<?php require_once JETPACK__PLUGIN_DIR . 'modules/subscriptions.php'; require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/premium-content/_inc/access-check.php'; require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/premium-content/_inc/subscription-service/include.php'; require_once JETPACK__PLUGIN_DIR . 'modules/m...