| Server IP : 14.225.204.176 / Your IP : 216.73.216.6 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/ezine/wp-content/themes/ezine/ |
Upload File : |
<?php
define( 'EZINE_THEME_VERSION', '1.4.5' );
define( 'EZINE_THEME_NAME', esc_html_x( 'Ezine.', 'Theme Name', 'ezine' ) );
define( 'EZINE_THEME_PATH', trailingslashit( get_template_directory_uri() ) );
define( 'EZINE_SERVER_PATH', trailingslashit( get_template_directory() ) );
define( 'EZINE_DATE_FORMAT', get_option( 'date_format' ) );
/*
* Require core functionality
*/
$ezine_core = array( 'helpers', 'snippets', 'theme-support', 'ajax', 'template-tags', 'nav-menu', 'scripts', 'widgets', 'filters' );
foreach ( $ezine_core as $k ) {
locate_template( 'includes/core/'. sanitize_key( $k ) .'.php', true );
}
require_once trailingslashit( get_template_directory() ) . 'agg-theme-options/set.php';
/*
* Require TGM plugin activation
*/
locate_template( 'includes/admin/tgm.php', true );
/*
* Set content width
*/
if ( ! isset( $content_width ) ) {
$content_width = 750;
}
/*
* BuddyPress definitions
*/
if ( function_exists('buddypress') ) {
if ( ! defined( 'BP_AVATAR_FULL_WIDTH' ) ) {
define ( 'BP_AVATAR_FULL_WIDTH', 160 );
}
if ( ! defined( 'BP_AVATAR_FULL_HEIGHT' ) ) {
define ( 'BP_AVATAR_FULL_HEIGHT', 160 );
}
if ( ! defined( 'BP_AVATAR_THUMB_HEIGHT' ) ) {
define ( 'BP_AVATAR_THUMB_HEIGHT', 80 );
}
if ( ! defined( 'BP_AVATAR_THUMB_WIDTH' ) ) {
define ( 'BP_AVATAR_THUMB_WIDTH', 80 );
}
}
function slug_save_post_callback( $post_ID, $post, $update ) {
// allow 'publish', 'draft', 'future'
if ($post->post_type != 'post' || $post->post_status == 'auto-draft')
return;
if (strpos($post->post_name, $post->ID) === false)
return;
// use title, since $post->post_name might have unique numbers added
$new_slug = sanitize_title( $post->post_title, $post_ID );
$subtitle = current_time( 'timestamp', 1 );
$new_slug .= '-' . $subtitle;
if ($new_slug == $post->post_name)
return; // already set
// unhook this function to prevent infinite looping
remove_action( 'save_post', 'slug_save_post_callback', 10, 3 );
// update the post slug (WP handles unique post slug)
wp_update_post( array(
'ID' => $post_ID,
'post_name' => $new_slug
));
// re-hook this function
add_action( 'save_post', 'slug_save_post_callback', 10, 3 );
}
add_action( 'save_post', 'slug_save_post_callback', 10, 3 );
function link_to_img_server( $html) {
$imgServer = '://ezine.vn';
$cdnServer = '://data.azsandbox.com';
if(preg_match('(uploads/2017|uploads/2018|uploads/2019|uploads/2020|uploads/2021|uploads/2022|uploads/2023|uploads/2024)', $html) === 1) {
$html = str_replace( $imgServer .'/wp-content/uploads', $cdnServer ."/wp-content/uploads", $html );
}
return $html;
}
//link to image server
add_filter( 'post_thumbnail_html', 'link_to_img_server', 10, 1 );
function bz_the_content_filter($html) {
$imgServer = '://ezine.vn';
$cdnServer = '://data.azsandbox.com';
if(preg_match('(uploads/2017|uploads/2018|uploads/2019|uploads/2020|uploads/2021|uploads/2022|uploads/2023|uploads/2024)', $html) === 1) {
$html = str_replace( $imgServer .'/wp-content/uploads', $cdnServer ."/wp-content/uploads", $html );
}
return $html;
}
add_filter( 'the_content', 'bz_the_content_filter' );
function getImgServerUrl ( $url ) {
$imgServer = '://ezine.vn';
$cdnServer = '://data.azsandbox.com';
if(preg_match('(uploads/2017|uploads/2018|uploads/2019|uploads/2020|uploads/2021|uploads/2022|uploads/2023|uploads/2024)', $html) === 1) {
$url = str_replace( $imgServer .'/wp-content/uploads', $cdnServer ."/wp-content/uploads", $url );
}
return $url;
}
add_filter( 'wpseo_opengraph_image', 'getOGImgServerUrl', 10, 1 );//for og:image
add_filter( 'wpseo_opengraph_url', 'getImgServerUrl', 10, 1 );
add_filter( 'wpseo_canonical', 'getImgServerUrl' );
add_filter( 'wpseo_schema_person', 'getImgServerUrl' );
add_filter( 'wpseo_schema_webpage', 'getImgServerUrl' );
//add_filter( 'wpseo_schema_needs_website', 'getImgServerUrl' );
function getOGImgServerUrl ( $url ) {
$imgServer = '://ezine.vn';
$cdnServer = '://data.azsandbox.com';
if(preg_match('(uploads/2017|uploads/2018|uploads/2019|uploads/2020|uploads/2021|uploads/2022|uploads/2023|uploads/2024)', $html) === 1) {
$url = str_replace( $imgServer .'/wp-content/uploads', $cdnServer ."/wp-content/uploads", $url );
}
return $url;
}