本文整理汇总了PHP中jetpack_require_lib函数的典型用法代码示例。如果您正苦于以下问题:PHP jetpack_require_lib函数的具体用法?PHP jetpack_require_lib怎么用?PHP jetpack_require_lib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jetpack_require_lib函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
}
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:31,代码来源:class.jetpack-admin.php
示例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';
}
开发者ID:frankzinner,项目名称:slimjp,代码行数:10,代码来源:theme-tools.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);
}
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:10,代码来源:tonesque.php
示例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;
}
开发者ID:bisko,项目名称:jetpack,代码行数:11,代码来源:upcoming-events.php
示例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';
}
}
开发者ID:quintenm,项目名称:maresthema-2016,代码行数:15,代码来源:class-kirki-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');
}
}
开发者ID:pacificano,项目名称:pacificano,代码行数:20,代码来源:jetpack-related-posts.php
示例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');
}
}
开发者ID:wpmu,项目名称:maera,代码行数:15,代码来源:class-maera-init.php
示例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'));
}
}
开发者ID:iamtakashi,项目名称:jetpack,代码行数:24,代码来源:jetpack-related-posts.php
示例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'));
}
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:17,代码来源:class.jetpack-admin.php
示例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);
}
开发者ID:annbransom,项目名称:techishowl_prod_backup,代码行数:17,代码来源:tonesque.php
示例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'));
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:18,代码来源:class.jetpack-admin.php
示例12: jetpack_require_lib
<?php
if (!class_exists('MarkdownExtra_Parser')) {
jetpack_require_lib('markdown/extra');
}
jetpack_require_lib('markdown/gfm');
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:6,代码来源:0-load.php
示例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' );
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:8,代码来源:TONESQUE.PHP
示例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;
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:85,代码来源:class.jetpack-twitter-cards.php
示例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);
开发者ID:iamtakashi,项目名称:jetpack,代码行数:31,代码来源:test_class.jetpack-media-extractor.php
示例16: jetpack_require_lib
<?php
if (!class_exists('Jetpack_Media_Summary')) {
jetpack_require_lib('class.media-summary');
}
class WP_Test_Jetpack_MediaSummary extends WP_UnitTestCase
{
/**
* @author scotchfield
* @covers Jetpack_Media_Summary::get
* @since 3.2
* @todo find a better way to test this large function
*/
public function test_mediasummary_get()
{
$post_id = $this->factory->post->create(array());
$get_obj = Jetpack_Media_Summary::get($post_id);
$this->assertInternalType('array', $get_obj);
}
/**
* @author scotchfield
* @covers Jetpack_Media_Summary::https
* @since 3.2
*/
public function test_mediasummary_https()
{
$content = 'http://' . WP_TESTS_DOMAIN . '/';
$expected = 'https://' . WP_TESTS_DOMAIN . '/';
$this->assertEquals(Jetpack_Media_Summary::https($content), $expected);
}
/**
开发者ID:iamtakashi,项目名称:jetpack,代码行数:31,代码来源:test_class.jetpack-media-summary.php
示例17: widget
function widget($args, $instance)
{
jetpack_require_lib('icalendar-reader');
$events = icalendar_render_events($instance['feed-url'], array('context' => 'widget', 'number' => $instance['count']));
// nothing to display?
if (!$events) {
$events = sprintf('<p>%s</p>', __('No upcoming events', 'jetpack'));
}
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'];
echo esc_html($instance['title']);
echo $args['after_title'];
}
echo $events;
echo $args['after_widget'];
/** This action is documented in modules/widgets/gravatar-profile.php */
do_action('jetpack_stats_extra', 'widget_view', 'grofile');
}
开发者ID:automattic,项目名称:jetpack,代码行数:19,代码来源:upcoming-events.php
示例18: get
static function get($post_id, $blog_id = 0, $args = array())
{
$defaults = array('max_words' => 16, 'max_chars' => 256);
$args = wp_parse_args($args, $defaults);
$switched = false;
if (!empty($blog_id) && $blog_id != get_current_blog_id() && function_exists('switch_to_blog')) {
switch_to_blog($blog_id);
$switched = true;
} else {
$blog_id = get_current_blog_id();
}
if (!class_exists('Jetpack_Media_Meta_Extractor')) {
jetpack_require_lib('class.media-extractor');
}
$post = get_post($post_id);
$permalink = get_permalink($post_id);
$return = array('type' => 'standard', 'permalink' => $permalink, 'image' => '', 'excerpt' => '', 'word_count' => 0, 'secure' => array('image' => ''), 'count' => array('image' => 0, 'video' => 0, 'word' => 0, 'link' => 0));
if (empty($post->post_password)) {
$return['excerpt'] = self::get_excerpt($post->post_content, $post->post_excerpt, $args['max_words'], $args['max_chars']);
$return['count']['word'] = self::get_word_count($post->post_content);
$return['count']['word_remaining'] = self::get_word_remaining_count($post->post_content, $return['excerpt']);
$return['count']['link'] = self::get_link_count($post->post_content);
}
$extract = Jetpack_Media_Meta_Extractor::extract($blog_id, $post_id, Jetpack_Media_Meta_Extractor::ALL);
if (empty($extract['has'])) {
return $return;
}
// Prioritize [some] video embeds
if (!empty($extract['has']['shortcode'])) {
foreach ($extract['shortcode'] as $type => $data) {
switch ($type) {
case 'videopress':
case 'wpvideo':
if (0 == $return['count']['video']) {
// If there is no id on the video, then let's just skip this
if (!isset($data['id'][0])) {
continue;
}
$guid = $data['id'][0];
$video_info = videopress_get_video_details($guid);
// Only add the video tags if the guid returns a valid videopress object.
if ($video_info instanceof stdClass) {
// Continue early if we can't find a Video slug.
if (empty($video_info->files->std->mp4)) {
continue;
}
$url = sprintf('https://videos.files.wordpress.com/%1$s/%2$s', $guid, $video_info->files->std->mp4);
$thumbnail = $video_info->poster;
if (!empty($thumbnail)) {
$return['image'] = $thumbnail;
$return['secure']['image'] = $thumbnail;
}
$return['type'] = 'video';
$return['video'] = esc_url_raw($url);
$return['video_type'] = 'video/mp4';
$return['secure']['video'] = $return['video'];
}
}
$return['count']['video']++;
break;
case 'youtube':
if (0 == $return['count']['video']) {
$return['type'] = 'video';
$return['video'] = esc_url_raw('http://www.youtube.com/watch?feature=player_embedded&v=' . $extract['shortcode']['youtube']['id'][0]);
$return['image'] = self::get_video_poster('youtube', $extract['shortcode']['youtube']['id'][0]);
$return['secure']['video'] = self::https($return['video']);
$return['secure']['image'] = self::https($return['image']);
}
$return['count']['video']++;
break;
case 'vimeo':
if (0 == $return['count']['video']) {
$return['type'] = 'video';
$return['video'] = esc_url_raw('http://vimeo.com/' . $extract['shortcode']['vimeo']['id'][0]);
$return['secure']['video'] = self::https($return['video']);
$poster_image = get_post_meta($post_id, 'vimeo_poster_image', true);
if (!empty($poster_image)) {
$return['image'] = $poster_image;
$poster_url_parts = parse_url($poster_image);
$return['secure']['image'] = 'https://secure-a.vimeocdn.com' . $poster_url_parts['path'];
}
}
$return['count']['video']++;
break;
}
}
}
if (!empty($extract['has']['embed'])) {
foreach ($extract['embed']['url'] as $embed) {
if (preg_match('/((youtube|vimeo|dailymotion)\\.com|youtu.be)/', $embed)) {
if (0 == $return['count']['video']) {
$return['type'] = 'video';
$return['video'] = 'http://' . $embed;
$return['secure']['video'] = self::https($return['video']);
if (false !== strpos($embed, 'youtube')) {
$return['image'] = self::get_video_poster('youtube', jetpack_get_youtube_id($return['video']));
$return['secure']['image'] = self::https($return['image']);
} else {
if (false !== strpos($embed, 'youtu.be')) {
$youtube_id = jetpack_get_youtube_id($return['video']);
//.........这里部分代码省略.........
开发者ID:automattic,项目名称:jetpack,代码行数:101,代码来源:class.media-summary.php
示例19: widget
function widget($args, $instance)
{
jetpack_require_lib('icalendar-reader');
$events = icalendar_render_events($instance['feed-url'], array('context' => 'widget', 'number' => $instance['count']));
// nothing to display?
if (!$events) {
$events = sprintf('<p>%s</p>', __('No upcoming events', 'jetpack'));
}
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'];
echo esc_html($instance['title']);
echo $args['after_title'];
}
echo $events;
echo $args['after_widget'];
}
开发者ID:iamtakashi,项目名称:jetpack,代码行数:17,代码来源:upcoming-events.php
示例20: get_parser
/**
* Get our Markdown parser object, optionally requiring all of our needed classes and
* instantiating our parser.
* @return object WPCom_GHF_Markdown_Parser instance.
*/
protected function get_parser()
{
if (!self::$parser) {
jetpack_require_lib('markdown');
self::$parser = new WPCom_GHF_Markdown_Parser();
}
return self::$parser;
}
开发者ID:valiror,项目名称:sharingdais_demo1,代码行数:13,代码来源:easy-markdown.php
注:本文中的jetpack_require_lib函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论