jetpack
Last commit date
3rd-party
10 years ago
_inc
10 years ago
css
10 years ago
images
10 years ago
json-endpoints
10 years ago
languages
10 years ago
modules
5 years ago
scss
10 years ago
views
10 years ago
.svnignore
10 years ago
changelog.txt
10 years ago
class.jetpack-admin.php
10 years ago
class.jetpack-autoupdate.php
10 years ago
class.jetpack-bbpress-json-api-compat.php
10 years ago
class.jetpack-cli.php
10 years ago
class.jetpack-client-server.php
10 years ago
class.jetpack-client.php
10 years ago
class.jetpack-data.php
10 years ago
class.jetpack-debugger.php
10 years ago
class.jetpack-error.php
10 years ago
class.jetpack-heartbeat.php
10 years ago
class.jetpack-ixr-client.php
10 years ago
class.jetpack-jitm.php
10 years ago
class.jetpack-modules-list-table.php
10 years ago
class.jetpack-network-sites-list-table.php
10 years ago
class.jetpack-network.php
10 years ago
class.jetpack-options.php
10 years ago
class.jetpack-post-images.php
10 years ago
class.jetpack-signature.php
10 years ago
class.jetpack-sync.php
10 years ago
class.jetpack-twitter-cards.php
10 years ago
class.jetpack-user-agent.php
10 years ago
class.jetpack-xmlrpc-server.php
10 years ago
class.jetpack.php
10 years ago
class.json-api-endpoints.php
3 years ago
class.json-api.php
10 years ago
class.media-extractor.php
10 years ago
class.media-summary.php
10 years ago
class.photon.php
10 years ago
composer.json
10 years ago
functions.compat.php
10 years ago
functions.gallery.php
10 years ago
functions.opengraph.php
10 years ago
functions.photon.php
10 years ago
jetpack.php
3 years ago
json-api-config.php
10 years ago
json-endpoints.php
10 years ago
locales.php
10 years ago
readme.txt
3 years ago
require-lib.php
10 years ago
uninstall.php
10 years ago
wpml-config.xml
10 years ago
require-lib.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | function jetpack_require_lib( $slug ) { |
| 4 | if ( !preg_match( '|^[a-z0-9/_.-]+$|i', $slug ) ) { |
| 5 | trigger_error( "Cannot load a library with invalid slug $slug.", E_USER_ERROR ); |
| 6 | return; |
| 7 | } |
| 8 | $basename = basename( $slug ); |
| 9 | |
| 10 | if ( defined( 'ABSPATH' ) && ! defined( 'WP_CONTENT_DIR' ) ) { |
| 11 | define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down |
| 12 | } |
| 13 | |
| 14 | $lib_dir = WP_CONTENT_DIR . '/lib'; |
| 15 | |
| 16 | /** |
| 17 | * Filter the location of the library directory. |
| 18 | * |
| 19 | * @since 2.5.0 |
| 20 | * |
| 21 | * @param str $lib_dir Path to the library directory. |
| 22 | */ |
| 23 | $lib_dir = apply_filters( 'jetpack_require_lib_dir', $lib_dir ); |
| 24 | $choices = array( |
| 25 | "$lib_dir/$slug.php", |
| 26 | "$lib_dir/$slug/0-load.php", |
| 27 | "$lib_dir/$slug/$basename.php", |
| 28 | ); |
| 29 | foreach( $choices as $file_name ) { |
| 30 | if ( is_readable( $file_name ) ) { |
| 31 | require_once $file_name; |
| 32 | return; |
| 33 | } |
| 34 | } |
| 35 | trigger_error( "Cannot find a library with slug $slug.", E_USER_ERROR ); |
| 36 | } |
| 37 |