inc2734/wp-oembed-blog-card

WordPress oEmbed Blog Card 的库。


README

CI Latest Stable Version License

安装

$ composer require inc2734/wp-oembed-blog-card

如何使用

<?php
new \Inc2734\WP_OEmbed_Blog_Card\Bootstrap();

然后只需将URL复制并粘贴到文章中即可!

  • 用于博客卡的将数据缓存。
  • 在打开帖子编辑屏幕时更新缓存。
  • 在显示屏幕上,URL将通过ajax转换为博客卡。

过滤钩子

inc2734_wp_oembed_blog_card_block_editor_template

/**
 * Customize template for block editor
 *
 * @param string $template
 * @param string $url
 * @return string
 */
add_filter(
	'inc2734_wp_oembed_blog_card_block_editor_template',
	function( $template, $url ) {
		return $template;
	},
	10,
	2
);

inc2734_wp_oembed_blog_card_loading_template

/**
 * Customize template for loading
 *
 * @param string $template
 * @param string $url
 * @return string
 */
add_filter(
	'inc2734_wp_oembed_blog_card_loading_template',
	function( $template, $url ) {
		return $template;
	},
	10,
	2
);

inc2734_wp_oembed_blog_card_url_template

/**
 * Customize url template
 *
 * @param string $template
 * @param string $url
 * @return string
 */
add_filter(
	'inc2734_wp_oembed_blog_card_url_template',
	function( $template, $url ) {
		return $template;
	},
	10,
	2
);

inc2734_wp_oembed_blog_card_blog_card_template

/**
 * Customize blog card template
 *
 * @param string $template
 * @param array $cache
 * @return string
 */
add_filter(
	'inc2734_wp_oembed_blog_card_blog_card_template',
	function( $template, $cache ) {
		return $template;
	},
	10,
	2
);

inc2734_wp_oembed_blog_card_cache_directory

/**
 * Customize cache directory
 *
 * @param string $directory
 * @return string
 */
add_filter(
	'inc2734_wp_oembed_blog_card_cache_directory',
	function( $directory ) {
		return $directory;
	}
);

inc2734_wp_oembed_blog_card_cache_object

/**
 * Change cache system.
 *
 * @param string $cache_object_class_name
 * @return string
 */
add_filter(
	'inc2734_wp_oembed_blog_card_cache_object',
	function( $cache_object_class_name ) {
		return $cache_object_class_name;
	}
);