本文整理汇总了PHP中jetpack_require_lib函数的典型用法代码示例。如果您正苦于以下问题:PHP jetpack_require_lib函数的具体用法?PHP jetpack_require_lib怎么用?PHP jetpack_require_lib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jetpack_require_lib函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
private function __construct()
{
$this->jetpack = Jetpack::init();
jetpack_require_lib('admin-pages/class.jetpack-react-page');
$this->jetpack_react = new Jetpack_React_Page();
// TODO: reactify
require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-dashboard.php';
$this->sync_dashboard = new Jetpack_Sync_Dashboard();
$this->sync_dashboard->init();
// jetpack_require_lib( 'admin-pages/class.jetpack-landing-page' );
// $this->landing_page = new Jetpack_Landing_Page;
//
// jetpack_require_lib( 'admin-pages/class.jetpack-settings-page' );
// $this->settings_page = new Jetpack_Settings_Page;
//
// jetpack_require_lib( 'admin-pages/class.jetpack-my-jetpack-page' );
// $this->my_jetpack_page = new Jetpack_My_Jetpack_Page;
// if ( isset( $_POST['jetpack-set-master-user'] ) ) {
// add_action( 'init', array( $this->my_jetpack_page, 'jetpack_my_jetpack_change_user' ) );
// }
// Add hooks for admin menus
// add_action( 'jetpack_admin_menu', array( $this->jetpack_react, 'add_actions' ) );
add_action('admin_menu', array($this->jetpack_react, 'add_actions'), 998);
add_action('jetpack_admin_menu', array($this, 'admin_menu_debugger'));
add_action('jetpack_admin_menu', array($this->sync_dashboard, 'add_actions'));
// Add redirect to current page for activation/deactivation of modules
add_action('jetpack_pre_activate_module', array($this, 'fix_redirect'), 10, 2);
add_action('jetpack_pre_deactivate_module', array($this, 'fix_redirect'));
// Add module bulk actions handler
add_action('jetpack_unrecognized_action', array($this, 'handle_unrecognized_action'));
}
示例2: jetpack_load_theme_tools
function jetpack_load_theme_tools()
{
if (current_theme_supports('social-links')) {
require_once JETPACK__PLUGIN_DIR . 'modules/theme-tools/social-links.php';
}
if (current_theme_supports('tonesque')) {
jetpack_require_lib('tonesque');
}
require_once JETPACK__PLUGIN_DIR . 'modules/theme-tools/random-redirect.php';
}
示例3: __construct
function __construct($image_url)
{
if (!class_exists('Jetpack_Color')) {
jetpack_require_lib('class.color');
}
$this->image_url = esc_url_raw($image_url);
$this->image_url = trim($this->image_url);
$this->image_url = apply_filters('tonesque_image_url', $this->image_url);
$this->image_obj = self::imagecreatefromurl($this->image_url);
}
示例4: shortcode
public static function shortcode($atts = array())
{
jetpack_require_lib('icalendar-reader');
$atts = shortcode_atts(array('url' => '', 'number' => 0), $atts, 'upcomingevents');
$args = array('context' => 'shortcode', 'number' => absint($atts['number']));
$events = icalendar_render_events($atts['url'], $args);
if (!$events) {
$events = sprintf('<p>%s</p>', __('No upcoming events', 'jetpack'));
}
return $events;
}
示例5: load_jetpack_color_lib
/**
* Loads the JetPack Color class.
* If Jetpack is not installed then use our copy of that file.
*/
public function load_jetpack_color_lib()
{
if (function_exists('jetpack_require_lib')) {
if (!class_exists('Jetpack_Color')) {
jetpack_require_lib('class.color');
}
}
if (!class_exists('Jetpack_Color')) {
include_once dirname(__FILE__) . '/class.color.php';
}
}
示例6: __construct
/**
* Constructor for Jetpack_RelatedPosts.
*
* @param int $blog_id_local
* @param int $blog_id_wpcom
* @uses get_option, add_action, apply_filters
* @return null
*/
public function __construct($blog_id_local, $blog_id_wpcom)
{
$this->_blog_id_local = $blog_id_local;
$this->_blog_id_wpcom = $blog_id_wpcom;
$this->_blog_charset = get_option('blog_charset');
$this->_convert_charset = function_exists('iconv') && !preg_match('/^utf\\-?8$/i', $this->_blog_charset);
add_action('admin_init', array($this, 'action_admin_init'));
add_action('wp', array($this, 'action_frontend_init'));
if (!class_exists('Jetpack_Media_Summary')) {
jetpack_require_lib('class.media-summary');
}
}
示例7: require_libs_init
function require_libs_init()
{
/**
* Load the color library from jetpack
*/
if (function_exists('jetpack_require_lib')) {
jetpack_require_lib('class.color');
}
/**
* Load the Tonesque library from jetpack
*/
if (function_exists('jetpack_require_lib')) {
jetpack_require_lib('tonesque');
}
}
示例8: __construct
/**
* Constructor for Jetpack_RelatedPosts.
*
* @param int $blog_id_local
* @param int $blog_id_wpcom
* @uses get_option, add_action, apply_filters
* @return null
*/
public function __construct($blog_id_local, $blog_id_wpcom)
{
$this->_blog_id_local = $blog_id_local;
$this->_blog_id_wpcom = $blog_id_wpcom;
$this->_blog_charset = get_option('blog_charset');
$this->_convert_charset = function_exists('iconv') && !preg_match('/^utf\\-?8$/i', $this->_blog_charset);
add_action('admin_init', array($this, 'action_admin_init'));
add_action('wp', array($this, 'action_frontend_init'));
if (!class_exists('Jetpack_Media_Summary')) {
jetpack_require_lib('class.media-summary');
}
// Add Related Posts to the REST API Post response.
if (function_exists('register_rest_field')) {
add_action('rest_api_init', array($this, 'rest_register_related_posts'));
}
}
示例9: __construct
private function __construct()
{
$this->jetpack = Jetpack::init();
jetpack_require_lib('admin-pages/class.jetpack-landing-page');
$this->landing_page = new Jetpack_Landing_Page();
jetpack_require_lib('admin-pages/class.jetpack-settings-page');
$this->settings_page = new Jetpack_Settings_Page();
// Add hooks for admin menus
add_action('admin_menu', array($this->landing_page, 'add_actions'), 998);
add_action('jetpack_admin_menu', array($this, 'admin_menu_debugger'));
add_action('jetpack_admin_menu', array($this->settings_page, 'add_actions'));
// Add redirect to current page for activation/deactivation of modules
add_action('jetpack_pre_activate_module', array($this, 'fix_redirect'), 10, 2);
add_action('jetpack_pre_deactivate_module', array($this, 'fix_redirect'));
// Add module bulk actions handler
add_action('jetpack_unrecognized_action', array($this, 'handle_unrecognized_action'));
}
示例10: __construct
function __construct($image_url)
{
if (!class_exists('Jetpack_Color')) {
jetpack_require_lib('class.color');
}
$this->image_url = esc_url_raw($image_url);
$this->image_url = trim($this->image_url);
/**
* Allows any image URL to be passed in for $this->image_url.
*
* @since 2.5.0
*
* @param string $image_url The URL to any image
*/
$this->image_url = apply_filters('tonesque_image_url', $this->image_url);
$this->image_obj = self::imagecreatefromurl($this->image_url);
}
示例11: __construct
private function __construct()
{
$this->jetpack = Jetpack::init();
jetpack_require_lib('admin-pages/class.jetpack-react-page');
$this->jetpack_react = new Jetpack_React_Page();
jetpack_require_lib('admin-pages/class.jetpack-settings-page');
$this->fallback_page = new Jetpack_Settings_Page();
add_action('admin_menu', array($this->jetpack_react, 'add_actions'), 998);
add_action('jetpack_admin_menu', array($this->jetpack_react, 'jetpack_add_dashboard_sub_nav_item'));
add_action('jetpack_admin_menu', array($this->jetpack_react, 'jetpack_add_settings_sub_nav_item'));
add_action('jetpack_admin_menu', array($this, 'admin_menu_debugger'));
add_action('jetpack_admin_menu', array($this->fallback_page, 'add_actions'));
// Add redirect to current page for activation/deactivation of modules
add_action('jetpack_pre_activate_module', array($this, 'fix_redirect'), 10, 2);
add_action('jetpack_pre_deactivate_module', array($this, 'fix_redirect'));
// Add module bulk actions handler
add_action('jetpack_unrecognized_action', array($this, 'handle_unrecognized_action'));
}
示例12: jetpack_require_lib
<?php
if (!class_exists('MarkdownExtra_Parser')) {
jetpack_require_lib('markdown/extra');
}
jetpack_require_lib('markdown/gfm');
示例13: jetpack_load_tonesque
/**
* Themes must declare that they support this module by adding
* add_theme_support( 'tonesque' ); on 'after_setup_theme'.
*/
function jetpack_load_tonesque() {
if ( current_theme_supports( 'tonesque' ) )
jetpack_require_lib( 'tonesque' );
}
示例14: twitter_cards_tags
static function twitter_cards_tags($og_tags)
{
global $post;
if (post_password_required()) {
return $og_tags;
}
/** This action is documented in class.jetpack.php */
if (apply_filters('jetpack_disable_twitter_cards', false)) {
return $og_tags;
}
/*
* These tags apply to any page (home, archives, etc)
*/
$site_tag = self::site_tag();
/** This action is documented in modules/sharedaddy/sharing-sources.php */
$site_tag = apply_filters('jetpack_sharing_twitter_via', $site_tag, is_singular() ? $post->ID : null);
/** This action is documented in modules/sharedaddy/sharing-sources.php */
$site_tag = apply_filters('jetpack_twitter_cards_site_tag', $site_tag, $og_tags);
if (!empty($site_tag)) {
$og_tags['twitter:site'] = self::sanitize_twitter_user($site_tag);
}
if (!is_singular() || !empty($og_tags['twitter:card'])) {
return $og_tags;
}
/*
* The following tags only apply to single pages.
*/
$card_type = 'summary';
// Try to give priority to featured images
if (class_exists('Jetpack_PostImages')) {
$featured = Jetpack_PostImages::from_thumbnail($post->ID, 240, 240);
if (!empty($featured) && count($featured) > 0) {
if ((int) $featured[0]['src_width'] >= 280 && (int) $featured[0]['src_height'] >= 150) {
$card_type = 'summary_large_image';
$og_tags['twitter:image'] = esc_url(add_query_arg('w', 640, $featured[0]['src']));
} else {
$og_tags['twitter:image'] = esc_url(add_query_arg('w', 240, $featured[0]['src']));
}
}
}
// Only proceed with media analysis if a featured image has not superseded it already.
if (empty($og_tags['twitter:image']) && empty($og_tags['twitter:image:src'])) {
if (!class_exists('Jetpack_Media_Summary') && defined('IS_WPCOM') && IS_WPCOM) {
include WP_CONTENT_DIR . '/lib/class.wpcom-media-summary.php';
}
if (!class_exists('Jetpack_Media_Summary')) {
jetpack_require_lib('class.media-summary');
}
// Test again, class should already be auto-loaded in Jetpack.
// If not, skip extra media analysis and stick with a summary card
if (class_exists('Jetpack_Media_Summary')) {
$extract = Jetpack_Media_Summary::get($post->ID);
if ('gallery' == $extract['type']) {
list($og_tags, $card_type) = self::twitter_cards_define_type_based_on_image_count($og_tags, $extract);
} elseif ('video' == $extract['type']) {
// Leave as summary, but with large pict of poster frame (we know those comply to Twitter's size requirements)
$card_type = 'summary_large_image';
$og_tags['twitter:image'] = esc_url(add_query_arg('w', 640, $extract['image']));
} else {
list($og_tags, $card_type) = self::twitter_cards_define_type_based_on_image_count($og_tags, $extract);
}
}
}
$og_tags['twitter:card'] = $card_type;
// If we have information on the author/creator, then include that as well
if (!empty($post) && !empty($post->post_author)) {
/** This action is documented in modules/sharedaddy/sharing-sources.php */
$handle = apply_filters('jetpack_sharing_twitter_via', '', $post->ID);
if (!empty($handle) && 'wordpressdotcom' != $handle && 'jetpack' != $handle) {
$og_tags['twitter:creator'] = self::sanitize_twitter_user($handle);
}
}
// Make sure we have a description for Twitter, their validator isn't happy without some content (single space not valid).
if (!isset($og_tags['og:description']) || '' == trim($og_tags['og:description']) || __('Visit the post for more.', 'jetpack') == $og_tags['og:description']) {
// empty( trim( $og_tags['og:description'] ) ) isn't valid php
$has_creator = !empty($og_tags['twitter:creator']) && '@wordpressdotcom' != $og_tags['twitter:creator'] ? true : false;
if (!empty($extract) && 'video' == $extract['type']) {
// use $extract['type'] since $card_type is 'summary' for video posts
$og_tags['twitter:description'] = $has_creator ? sprintf(__('Video post by %s.', 'jetpack'), $og_tags['twitter:creator']) : __('Video post.', 'jetpack');
} else {
$og_tags['twitter:description'] = $has_creator ? sprintf(__('Post by %s.', 'jetpack'), $og_tags['twitter:creator']) : __('Visit the post for more.', 'jetpack');
}
}
return $og_tags;
}
示例15: jetpack_require_lib
<?php
if (!class_exists('Jetpack_Media_Meta_Extractor')) {
jetpack_require_lib('class.media-extractor');
}
class WP_Test_Jetpack_MediaExtractor extends WP_UnitTestCase
{
/**
* @author scotchfield
* @covers Jetpack_Media_Meta_Extractor::extract
* @since 3.2
*/
public function test_mediaextractor_extract_empty_array()
{
$post_id = $this->factory->post->create(array('post_content' => ''));
$extract = Jetpack_Media_Meta_Extractor::extract(Jetpack_Options::get_option('id'), $post_id);
$this->assertInternalType('array', $extract);
$this->assertEmpty($extract);
}
/**
* @author scotchfield
* @covers Jetpack_Media_Meta_Extractor::extract
* @since 3.2
*/
public function test_mediaextractor_extract_image()
{
$img_title = 'title.jpg';
$post_id = $this->factory->post->create(array('post_content' => "<img src='{$img_title}'>"));
$extract = Jetpack_Media_Meta_Extractor::extract(Jetpack_Options::get_option('id'), $post_id);
$this->assertInternalType('array', $extract);
$this->assertArrayHasKey('image', $extract);