| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/theme-customization-settings/ |
Upload File : |
<?php
if ( !function_exists( 'customPostTypeLabelArgs' ) ) {
function customPostTypeLabelArgs ( $typeName )
{
return [
'name' => $typeName,
'singular_name' => $typeName,
'add_new' => 'Add New',
'add_new_item' => 'Add New ' . $typeName,
'edit_item' => 'Edit ' . $typeName,
'new_item' => 'New ' . $typeName,
'all_items' => 'All ' . $typeName,
'view_item' => 'View ' . $typeName,
'search_items' => 'Search ' . $typeName,
'not_found' => 'No ' . $typeName . ' found',
'not_found_in_trash' => 'No ' . $typeName . ' found in Trash',
'parent_item_colon' => '',
'menu_name' => $typeName,
];
}
}
if ( !function_exists( 'customPostTypeArgs' ) ) {
function customPostTypeArgs ( $typeName, $postType = "post" )
{
return [
'labels' => customPostTypeLabelArgs( $typeName ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => strtolower( $typeName ) ),
'capability_type' => $postType,
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'thumbnail' ),
'show_in_sitemap' => false,
];
}
}
if ( !function_exists( 'get_home_field' ) ) {
/**
* 获取首页字段
* @param $field_name
* @param $post_id
* @return false|mixed
*/
function get_home_field ( $field_name, $post_id = -1 )
{
if ( $post_id < 0 ) { //not id input
global $eric_g_id;
if ( $eric_g_id ) {
$post_id = $eric_g_id;
} else {
global $wpdb;
$sql = "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' and post_type = 'home' ORDER BY post_date DESC LIMIT 1";
$post_id = $wpdb->get_var( $sql ) ?: 0;
if ( empty( $post_id ) ) {
return false;
}
$eric_g_id = $post_id;
}
}
return get_field( $field_name, $post_id );
}
}
if ( !function_exists( 'admin_login_url' ) ) {
function admin_login_url ( $url )
{
$new_login_slug = AOTUGUAI_ADMIN_ROUTE;
if ( str_contains( $url, 'wp-admin' ) || str_contains( $url, 'wp-login.php' ) ) {
$url = str_replace( array( 'wp-admin', 'wp-login.php' ), $new_login_slug, $url );
}
// 为安全链接添加一次性token
if ( !is_admin() && !wp_doing_ajax() ) {
$token = wp_create_nonce( 'secure_admin_access' );
$url = add_query_arg( 'token', $token, $url );
}
return $url;
}
}
if ( !function_exists( 'assets_path' ) ) {
function assets_path ( $path = '' )
{
echo home_url( '/style/' . $path );
}
}
if ( !function_exists( 'cmp_breadcrumbs' ) ) {
function cmp_breadcrumbs ()
{
$delimiter = '</li><li>'; // 分隔符
$before = '<a href="#">'; // 在当前链接前插入
$after = '</a>'; // 在当前链接后插入
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '' . __( '', 'cmp' );
global $post;
$homeLink = home_url();
echo ' <a itemprop="breadcrumb" href="' . $homeLink . '">' . __( 'Home', 'cmp' ) . '</a>' . $delimiter . ' ';
if ( is_category() ) { // 分类 存档
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category( $thisCat );
$parentCat = get_category( $thisCat->parent );
if ( $thisCat->parent != 0 ) {
$cat_code = get_category_parents( $parentCat, TRUE, ' ' . $delimiter . ' ' );
echo $cat_code = str_replace( '<a', '<a itemprop="breadcrumb"', $cat_code );
}
echo $before . '' . single_cat_title( '', false ) . '' . $after;
} elseif ( is_day() ) { // 天 存档
echo '<a itemprop="breadcrumb" href="' . get_year_link( get_the_time( 'Y' ) ) . '">' . get_the_time( 'Y' ) . '</a> ' . $delimiter . ' ';
echo '<a itemprop="breadcrumb" href="' . get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) . '">' . get_the_time( 'F' ) . '</a> ' . $delimiter . ' ';
echo $before . get_the_time( 'd' ) . $after;
} elseif ( is_month() ) { // 月 存档
echo '<a itemprop="breadcrumb" href="' . get_year_link( get_the_time( 'Y' ) ) . '">' . get_the_time( 'Y' ) . '</a> ' . $delimiter . ' ';
echo $before . get_the_time( 'F' ) . $after;
} elseif ( is_year() ) { // 年 存档
echo $before . get_the_time( 'Y' ) . $after;
} elseif ( is_single() && !is_attachment() ) { // 文章
if ( get_post_type() != 'post' ) { // 自定义文章类型
$post_type = get_post_type_object( get_post_type() );
$slug = $post_type->rewrite;
echo '<a itemprop="breadcrumb" href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} else { // 文章 post
$cat = get_the_category();
$flg = 0;
foreach ( $cat as $kk => $vv ) {
$rrrr = get_category_children( $vv->term_id );
if ( !$rrrr ) {
$cat_t = $cat[$kk];
$flg = 1;
}
}
if ( $flg == 0 ) {
$cat = $cat[0];
} else {
$cat = $cat_t;
}
$cat_code = get_category_parents( $cat, TRUE, ' ' . $delimiter . ' ' );
$cat_code = substr( $cat_code, 0, strlen( $cat_code ) - 5 );
echo $cat_code = str_replace( '<a', '<a itemprop="breadcrumb"', $cat_code );
}
} elseif ( !is_single() && !is_page() && get_post_type() != 'post' ) {
$post_type = get_post_type_object( get_post_type() );
echo $before . $post_type->labels->singular_name . $after;
} elseif ( is_attachment() ) { // 附件
$parent = get_post( $post->post_parent );
$cat = get_the_category( $parent->ID );
$cat = $cat[0];
echo '<a itemprop="breadcrumb" href="' . get_permalink( $parent ) . '">' . $parent->post_title . '</a> ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) { // 页面
echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) { // 父级页面
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ( $parent_id ) {
$page = get_page( $parent_id );
$breadcrumbs[] = '<a itemprop="breadcrumb" href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse( $breadcrumbs );
foreach ( $breadcrumbs as $crumb ) echo $crumb . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_search() ) { // 搜索结果
echo $before;
printf( __( 'Search Results for: %s', 'cmp' ), get_search_query() );
echo $after;
} elseif ( is_tag() ) { //标签 存档
echo $before;
printf( __( 'Tag Archives: %s', 'cmp' ), single_tag_title( '', false ) );
echo $after;
} elseif ( is_author() ) { // 作者存档
global $author;
$userdata = get_userdata( $author );
echo $before;
printf( __( 'Author Archives: %s', 'cmp' ), $userdata->display_name );
echo $after;
} elseif ( is_404() ) { // 404 页面
echo $before;
_e( 'Not Found', 'cmp' );
echo $after;
}
echo '';
}
}
}
if ( !function_exists( 'template_path' ) ) {
function template_path ( $path = '' )
{
return get_stylesheet_directory() . '/' . $path;
}
}
/**
* 获取菜单
* @param $menu_id
* @return string|string[]|null
*/
function get_menu ( $menu_id )
{
$menu = str_replace( "</ul></div>", "", preg_replace( "/<div[^>]*><ul[^>]*>/", "", wp_nav_menu( array( 'menu' => $menu_id, 'echo' => false ) ) ) );
return str_replace( "http://home", home_url( "/" ), $menu );
// return str_replace("/news", "" . home_url("/") . "news", $menu);
}
function izt_pagenavi($range = 5){
global $paged, $wp_query;
if ( !$max_page ) {$max_page = $wp_query->max_num_pages;}
if($max_page > 1){
echo '';
if(!$paged){$paged = 1;}
if($paged != 1){echo "<a href='" . get_pagenum_link(1) . "' class='extend' title='The First Page'><<</a>";}
previous_posts_link(' < Previous ');
if($max_page > $range){
if($paged < $range){for($i = 1; $i <= ($range + 1); $i++){echo "<a href='" . get_pagenum_link($i) ."'";
if($i==$paged)echo " class='current'";echo ">$i</a>";}}
elseif($paged >= ($max_page - ceil(($range/2)))){
for($i = $max_page - $range; $i <= $max_page; $i++){echo "<a href='" . get_pagenum_link($i) ."'";
if($i==$paged)echo " class='current'";echo ">$i</a>";}}
elseif($paged >= $range && $paged < ($max_page - ceil(($range/2)))){
for($i = ($paged - ceil($range/2)); $i <= ($paged + ceil(($range/2))); $i++){echo "<a href='" . get_pagenum_link
($i) ."'";if($i==$paged) echo " class='current'";echo ">$i</a>";}}}
else{for($i = 1; $i <= $max_page; $i++){echo "<a href='" . get_pagenum_link($i) ."'";
if($i==$paged)echo " class='current'";echo ">$i</a>";}}
next_posts_link(' Next > ');
if($paged != $max_page){echo "<a href='" . get_pagenum_link($max_page) . "' class='extend' title='The Last Page'>>></a> <span class='current2'>Page ".$paged." / ".$max_page."</span>";}}
}