1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
| <?php
function zh_cn_l10n_legacy_option_cleanup() { delete_site_option( 'zh_cn_l10n_preference_patches' );
delete_site_option( 'zh_cn_language_pack_enable_chinese_fake_oembed' );
delete_site_option( 'zh_cn_language_pack_options_version' ); delete_site_option( 'zh_cn_language_pack_enable_backend_style_modifications' );
delete_site_option( 'zh_cn_language_pack_enable_icpip_num_show' ); delete_site_option( 'zh_cn_language_pack_icpip_num' ); delete_site_option( 'zh_cn_language_pack_is_configured' );
} add_action( 'admin_init', 'zh_cn_l10n_legacy_option_cleanup' );
function wp_embed_handler_tudou( $matches, $attr, $url, $rawattr ) { $embed = sprintf( '<embed src="http://www.tudou.com/v/%1$s/&resourceId=0_05_05_99&bid=05/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed>', esc_attr( $matches['video_id'] ) );
return apply_filters( 'embed_tudou', $embed, $matches, $attr, $url, $rawattr ); } wp_embed_register_handler( 'tudou', '#https?://(?:www\.)?tudou\.com/(?:programs/view|listplay/(?<list_id>[a-z0-9_=\-]+))/(?<video_id>[a-z0-9_=\-]+)#i', 'wp_embed_handler_tudou' );
function wp_embed_handler_56com( $matches, $attr, $url, $rawattr ) { $matches['video_id'] = $matches['video_id1'] == '' ? $matches['video_id2'] : $matches['video_id1'];
$embed = sprintf( "<embed src='http://player.56.com/v_%1\$s.swf' type='application/x-shockwave-flash' width='480' height='405' allowFullScreen='true' allowNetworking='all' allowScriptAccess='always'></embed>", esc_attr( $matches['video_id'] ) );
return apply_filters( 'embed_56com', $embed, $matches, $attr, $url, $rawattr ); } wp_embed_register_handler( '56com', '#https?://(?:www\.)?56\.com/[a-z0-9]+/(?:play_album\-aid\-[0-9]+_vid\-(?<video_id1>[a-z0-9_=\-]+)|v_(?<video_id2>[a-z0-9_=\-]+))#i', 'wp_embed_handler_56com' );
function wp_embed_handler_youku( $matches, $attr, $url, $rawattr ) { $embed = sprintf( '<embed src="http://player.youku.com/player.php/sid/%1$s/v.swf" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>', esc_attr( $matches['video_id'] ) );
return apply_filters( 'embed_youku', $embed, $matches, $attr, $url, $rawattr ); } wp_embed_register_handler( 'youku', '#https?://v\.youku\.com/v_show/id_(?<video_id>[a-z0-9_=\-]+)#i', 'wp_embed_handler_youku' );
function zh_cn_l10n_settings_init() { if ( defined( 'WP_ZH_CN_ICP_NUM' ) && WP_ZH_CN_ICP_NUM ) { add_settings_field( 'zh_cn_l10n_icp_num', 'ICP备案号', 'zh_cn_l10n_icp_num_callback', 'general' ); register_setting( 'general', 'zh_cn_l10n_icp_num' ); } }
add_action( 'admin_init', 'zh_cn_l10n_settings_init' );
function zh_cn_l10n_icp_num_callback() { echo '<input name="zh_cn_l10n_icp_num" type="text" ' . 'id="zh_cn_l10n_icp_num" value="' . esc_attr( get_option( 'zh_cn_l10n_icp_num' ) ) . '" class="regluar-text ltr" />' . '<p class="description">仅对WordPress自带主题有效。</p>'; }
function zh_cn_l10n_icp_num( $content ) { if ( defined( 'WP_ZH_CN_ICP_NUM' ) && WP_ZH_CN_ICP_NUM && get_option( 'zh_cn_l10n_icp_num' ) ) { echo '<a href="http://beian.miit.gov.cn/" rel="nofollow" ' . 'title="工业和信息化部ICP/IP地址/域名信息备案管理系统">' . esc_attr( get_option( 'zh_cn_l10n_icp_num' ) ) . "</a>\n"; } }
add_action( 'twentyten_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentyeleven_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentytwelve_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentythirteen_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentyfourteen_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentyfifteen_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentysixteen_credits', 'zh_cn_l10n_icp_num' ); add_action( 'twentyseventeen_credits', 'zh_cn_l10n_icp_num' ); ?> define( 'WP_ZH_CN_ICP_NUM', true);
|