403Webshell
Server IP : 103.88.176.108  /  Your IP : 216.73.216.211
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux webserver 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.18
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/themes/neve/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/themes/neve//functions.php
<?php
/**
 * Neve functions.php file
 *
 * Author:          Andrei Baicus <andrei@themeisle.com>
 * Created on:      17/08/2018
 *
 * @package Neve
 */

define( 'NEVE_VERSION', '4.1.2' );
define( 'NEVE_INC_DIR', trailingslashit( get_template_directory() ) . 'inc/' );
define( 'NEVE_ASSETS_URL', trailingslashit( get_template_directory_uri() ) . 'assets/' );
define( 'NEVE_MAIN_DIR', get_template_directory() . '/' );
define( 'NEVE_BASENAME', basename( NEVE_MAIN_DIR ) );
define( 'NEVE_PLUGINS_DIR', plugin_dir_path( dirname( __DIR__ ) ) . 'plugins/' );

add_filter('jpeg_quality', function($arg){ return 100; }); // JPG质量100%
add_filter('wp_editor_set_quality', function($arg){ return 100; }); // 编辑器压缩100%

function enqueue_swiper_scripts() {
    wp_enqueue_style('swiper-css', 'https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css');
    wp_enqueue_script('swiper-js', 'https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js', array(), '10', true);
}
add_action('wp_enqueue_scripts', 'enqueue_swiper_scripts');



function inline_news_cards() {
    ob_start();
    $args = array(
        'post_type'      => 'post',  
        'posts_per_page' => 2,
    );
    $query = new WP_Query($args);
    
    if ($query->have_posts()) : ?>
    <div style="display:grid;grid-template-columns:1fr 1fr;gap:60px;max-width:1200px;margin:80px auto;padding:0 20px;">
      <?php while ($query->have_posts()) : $query->the_post(); 
        $post_date = get_post_time('Y.m.d', false, get_the_ID()); // 提前计算日期 ?>
        <div style="background:#fff;border-radius:12px;box-shadow:0 12px 36px rgba(0,0,0,0.08);padding:40px;text-align:center;transition:all 0.3s;position:relative;overflow:hidden;">
          <div style="position:absolute;top:0;left:50%;width:120px;height:6px;background:linear-gradient(90deg,#0066cc,#00a2ff);transform:translateX(-50%);border-radius:0 0 12px 12px;"></div>
          <h3 style="font-size:18px;font-weight:700;color:#0066cc;margin:20px 0 12px;line-height:1.4;">
            <a href="<?php the_permalink(); ?>" style="text-decoration:none;"><?php the_title(); ?></a>
          </h3>
          <p style="font-size:14px;color:#666;margin-bottom:24px;">
            最新公告 • <?php echo esc_html($post_date); // 确保安全输出 ?>
          </p>
          <a href="<?php the_permalink(); ?>" style="display:inline-block;padding:12px 30px;background:linear-gradient(90deg,#0066cc,#00a2ff);color:#fff;border-radius:25px;text-decoration:none;transition:transform 0.3s,box-shadow 0.3s;">
            閱讀更多
          </a>
        </div>
      <?php endwhile; ?>
      <?php wp_reset_postdata(); ?>
    </div>
    <?php else : ?>
    <div style="text-align:center;padding:40px;color:#999;">暂无公告</div>
    <?php endif;
    
    return ob_get_clean();
}
add_shortcode('inline_news', 'inline_news_cards');


function news_pagination_shortcode() {
    ob_start();
    
    // 文章类型用标准分页参数 `paged`(WordPress原生支持)
    $paged = absint(get_query_var('paged')); 
    $paged = $paged ? $paged : 1;

    $args = array(
        'post_type'      => 'post',         // 新闻是文章类型(必改!)
        'posts_per_page' => 3,              // 每页3条
        'category_name'  => 'news-center',  // 筛选“新闻中心”分类
        'paged'          => $paged,         // 传递分页参数
    );
    $query = new WP_Query($args);

    if ($query->have_posts()) : ?>
        <div class="news-list">
            <?php while ($query->have_posts()) : $query->the_post(); ?>
                <div class="news-item">
                    <?php if (has_post_thumbnail()) : ?>
                        <div class="news-image">
                            <?php the_post_thumbnail('medium', array('class' => 'rounded-md')); ?>
                        </div>
                    <?php endif; ?>
                    <div class="news-content">
                        <h3 class="news-title">
                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        </h3>
                        <div class="news-excerpt">
                            <?php the_excerpt(); ?>
                        </div>
                        <a href="<?php the_permalink(); ?>" class="news-readmore">閱讀更多</a>
                    </div>
                </div>
            <?php endwhile; ?>
        </div>
        
        <!-- 文章类型标准分页链接(自动适配固定链接) -->
        <nav class="news-pagination">
            <?php 
            echo paginate_links(array(
                'base'      => get_pagenum_link(1) . '%_%', // 标准格式:/page/2/
                'format'    => 'page/%#%',
                'current'   => $paged,
                'total'     => $query->max_num_pages,
                'prev_text' => '上一頁',
                'next_text' => '下一頁',
                'type'      => 'list',
            )); 
            ?>
        </nav>
    <?php else : ?>
        <p>沒有找到相關新聞。</p>
    <?php endif; 
    wp_reset_postdata();
    return ob_get_clean();
}
add_shortcode('news_pagination', 'news_pagination_shortcode');

// 加載 Boxicons 樣式
function enqueue_boxicons() {
  wp_enqueue_style('boxicons', 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css');
}
add_action('wp_enqueue_scripts', 'enqueue_boxicons');

if ( ! defined( 'NEVE_DEBUG' ) ) {
	define( 'NEVE_DEBUG', false );
}
define( 'NEVE_NEW_DYNAMIC_STYLE', true );
/**
 * Buffer which holds errors during theme inititalization.
 *
 * @var WP_Error $_neve_bootstrap_errors
 */
global $_neve_bootstrap_errors;

$_neve_bootstrap_errors = new WP_Error();

if ( version_compare( PHP_VERSION, '7.0' ) < 0 ) {
	$_neve_bootstrap_errors->add(
		'minimum_php_version',
		sprintf(
		/* translators: %s message to upgrade PHP to the latest version */
			__( "Hey, we've noticed that you're running an outdated version of PHP which is no longer supported. Make sure your site is fast and secure, by %1\$s. Neve's minimal requirement is PHP%2\$s.", 'neve' ),
			sprintf(
			/* translators: %s message to upgrade PHP to the latest version */
				'<a href="https://wordpress.org/support/upgrade-php/">%s</a>',
				__( 'upgrading PHP to the latest version', 'neve' )
			),
			'7.0'
		)
	);
}
/**
 * A list of files to check for existance before bootstraping.
 *
 * @var array Files to check for existance.
 */

$_files_to_check = defined( 'NEVE_IGNORE_SOURCE_CHECK' ) ? [] : [
	NEVE_MAIN_DIR . 'vendor/autoload.php',
	NEVE_MAIN_DIR . 'style-main-new.css',
	NEVE_MAIN_DIR . 'assets/js/build/modern/frontend.js',
	NEVE_MAIN_DIR . 'assets/apps/dashboard/build/dashboard.js',
	NEVE_MAIN_DIR . 'assets/apps/customizer-controls/build/controls.js',
];
foreach ( $_files_to_check as $_file_to_check ) {
	if ( ! is_file( $_file_to_check ) ) {
		$_neve_bootstrap_errors->add(
			'build_missing',
			sprintf(
			/* translators: %s: commands to run the theme */
				__( 'You appear to be running the Neve theme from source code. Please finish installation by running %s.', 'neve' ), // phpcs:ignore WordPress.Security.EscapeOutput
				'<code>composer install --no-dev &amp;&amp; yarn install --frozen-lockfile &amp;&amp; yarn run build</code>'
			)
		);
		break;
	}
}
/**
 * Adds notice bootstraping errors.
 *
 * @internal
 * @global WP_Error $_neve_bootstrap_errors
 */
function _neve_bootstrap_errors() {
	global $_neve_bootstrap_errors;
	printf( '<div class="notice notice-error"><p>%1$s</p></div>', $_neve_bootstrap_errors->get_error_message() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

if ( $_neve_bootstrap_errors->has_errors() ) {
	/**
	 * Add notice for PHP upgrade.
	 */
	add_filter( 'template_include', '__return_null', 99 );
	switch_theme( WP_DEFAULT_THEME );
	unset( $_GET['activated'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
	add_action( 'admin_notices', '_neve_bootstrap_errors' );

	return;
}

/**
 * Themeisle SDK filter.
 *
 * @param array $products products array.
 *
 * @return array
 */
function neve_filter_sdk( $products ) {
	$products[] = get_template_directory() . '/style.css';

	return $products;
}

add_filter( 'themeisle_sdk_products', 'neve_filter_sdk' );
add_filter(
	'themeisle_sdk_compatibilities/' . NEVE_BASENAME,
	function ( $compatibilities ) {

		$compatibilities['NevePro'] = [
			'basefile'  => defined( 'NEVE_PRO_BASEFILE' ) ? NEVE_PRO_BASEFILE : '',
			'required'  => '2.9',
			'tested_up' => '3.1',
		];

		return $compatibilities;
	}
);
require_once 'globals/migrations.php';
require_once 'globals/utilities.php';
require_once 'globals/hooks.php';
require_once 'globals/sanitize-functions.php';
require_once get_template_directory() . '/start.php';

/**
 * If the new widget editor is available,
 * we re-assign the widgets to hfg_footer
 */
if ( neve_is_new_widget_editor() ) {
	/**
	 * Re-assign the widgets to hfg_footer
	 *
	 * @param array  $section_args The section arguments.
	 * @param string $section_id The section ID.
	 * @param string $sidebar_id The sidebar ID.
	 *
	 * @return mixed
	 */
	function neve_customizer_custom_widget_areas( $section_args, $section_id, $sidebar_id ) {
		if ( strpos( $section_id, 'widgets-footer' ) ) {
			$section_args['panel'] = 'hfg_footer';
		}

		return $section_args;
	}

	add_filter( 'customizer_widgets_section_args', 'neve_customizer_custom_widget_areas', 10, 3 );
}

require_once get_template_directory() . '/header-footer-grid/loader.php';

add_filter(
	'neve_welcome_metadata',
	function() {
		return [
			'is_enabled' => ! defined( 'NEVE_PRO_VERSION' ),
			'pro_name'   => 'Neve Pro Addon',
			'logo'       => get_template_directory_uri() . '/assets/img/dashboard/logo.svg',
			'cta_link'   => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/?discount=LOYALUSER582&dvalue=50', 'neve-welcome', 'notice' ), 'query' ),
		];
	}
);

add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' );




Youez - 2016 - github.com/yon3zu
LinuXploit