jetpack
Last commit date
3rd-party
4 years ago
_inc
3 years ago
css
3 years ago
extensions
3 years ago
images
3 years ago
jetpack_vendor
3 years ago
json-endpoints
3 years ago
modules
3 years ago
sal
4 years ago
src
4 years ago
vendor
3 years ago
views
4 years ago
CHANGELOG.md
3 years ago
LICENSE.txt
5 years ago
SECURITY.md
5 years ago
class-jetpack-connection-status.php
5 years ago
class-jetpack-gallery-settings.php
4 years ago
class-jetpack-pre-connection-jitms.php
4 years ago
class-jetpack-recommendations-banner.php
3 years ago
class-jetpack-stats-dashboard-widget.php
4 years ago
class-jetpack-wizard-banner.php
5 years ago
class-jetpack-xmlrpc-methods.php
4 years ago
class.frame-nonce-preview.php
4 years ago
class.jetpack-admin.php
3 years ago
class.jetpack-affiliate.php
4 years ago
class.jetpack-autoupdate.php
4 years ago
class.jetpack-bbpress-json-api.compat.php
5 years ago
class.jetpack-cli.php
3 years ago
class.jetpack-client-server.php
4 years ago
class.jetpack-connection-banner.php
3 years ago
class.jetpack-data.php
5 years ago
class.jetpack-gutenberg.php
3 years ago
class.jetpack-heartbeat.php
4 years ago
class.jetpack-idc.php
4 years ago
class.jetpack-modules-list-table.php
4 years ago
class.jetpack-network-sites-list-table.php
4 years ago
class.jetpack-network.php
4 years ago
class.jetpack-plan.php
3 years ago
class.jetpack-post-images.php
3 years ago
class.jetpack-twitter-cards.php
4 years ago
class.jetpack-user-agent.php
4 years ago
class.jetpack.php
3 years ago
class.json-api-endpoints.php
4 years ago
class.json-api.php
3 years ago
class.photon.php
3 years ago
composer.json
3 years ago
enhanced-open-graph.php
4 years ago
functions.compat.php
4 years ago
functions.cookies.php
5 years ago
functions.global.php
4 years ago
functions.opengraph.php
4 years ago
functions.photon.php
4 years ago
jetpack.php
3 years ago
json-api-config.php
5 years ago
json-endpoints.php
4 years ago
load-jetpack.php
4 years ago
locales.php
4 years ago
readme.txt
3 years ago
require-lib.php
4 years ago
uninstall.php
5 years ago
wpml-config.xml
3 years ago
require-lib.php
57 lines
| 1 | <?php |
| 2 | /** |
| 3 | * File with a single function for loading library files. |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * Function for loading library files. |
| 10 | * |
| 11 | * @param string $slug Library slug. |
| 12 | * @return void |
| 13 | */ |
| 14 | function jetpack_require_lib( $slug ) { |
| 15 | static $loaded = array(); |
| 16 | |
| 17 | if ( defined( 'ABSPATH' ) && ! defined( 'WP_CONTENT_DIR' ) ) { |
| 18 | define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down |
| 19 | } |
| 20 | |
| 21 | $lib_dir = WP_CONTENT_DIR . '/lib'; |
| 22 | |
| 23 | /** |
| 24 | * Filter the location of the library directory. |
| 25 | * |
| 26 | * @since 2.5.0 |
| 27 | * |
| 28 | * @param string $lib_dir Path to the library directory. |
| 29 | */ |
| 30 | $lib_dir = apply_filters( 'jetpack_require_lib_dir', $lib_dir ); |
| 31 | |
| 32 | $loaded_key = "{$lib_dir}{$slug}"; |
| 33 | if ( ! empty( $loaded[ $loaded_key ] ) ) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | $loaded[ $loaded_key ] = true; |
| 38 | |
| 39 | $file_name = "$lib_dir/$slug.php"; |
| 40 | if ( is_readable( $file_name ) ) { |
| 41 | require_once $file_name; |
| 42 | |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | $file_name = "$lib_dir/$slug/0-load.php"; |
| 47 | if ( is_readable( $file_name ) ) { |
| 48 | require_once $file_name; |
| 49 | |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | $basename = basename( $slug ); |
| 54 | $file_name = "$lib_dir/$slug/$basename.php"; |
| 55 | require_once $file_name; |
| 56 | } |
| 57 |