HEX
Server: nginx/1.24.0
System: Linux VM-8-5-opencloudos 6.6.47-12.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 24 16:15:42 CST 2024 x86_64
User: www (1000)
PHP: 8.0.26
Disabled: 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
Upload Files
File: /www/wwwroot/aiwellbore.com/wp-content/plugins/wp-githuber-md/src/Modules/Emojify.php
<?php
/**
 * Module Name: Emoji
 * Module Description: Emoji are ideograms and smileys used in electronic messages and web pages.
 *
 * @author Terry Lin
 * @link https://terryl.in/
 *
 * @package Githuber
 * @since 1.0.0
 * @version 1.14.0
 */

namespace Githuber\Module;

/**
 * Emogify
 */
class Emojify extends ModuleAbstract {

	/**
	 * The version of Emojify we are using.
	 *
	 * @var string
	 */
	public $emojify_version = '1.1.0';

	/**
	 * The priority order to load CSS file, the value should be higher than theme's.
	 *
	 * @var integer
	 */
	public $css_priority = 1000;

	/**
	 * Constructer.
	 */
	public function __construct() {
		parent::__construct();
	}

	/**
	 * Initialize.
	 *
	 * @return void
	 */
	public function init() {
		add_action( 'wp_enqueue_scripts', array( $this, 'front_enqueue_styles' ), $this->css_priority );
		add_action( 'wp_enqueue_scripts', array( $this, 'front_enqueue_scripts' ) );
		add_action( 'wp_print_footer_scripts', array( $this, 'front_print_footer_scripts' ) );
	}

	/**
	 * Register CSS style files for frontend use.
	 *
	 * @return void
	 */
	public function front_enqueue_styles() {

		$option = githuber_get_option( 'emojify_src', 'githuber_modules' );

		switch ( $option ) {
			case 'cloudflare':
				$style_url = 'https://cdnjs.cloudflare.com/ajax/libs/emojify.js/' . $this->emojify_version . '/css/basic/emojify.min.css';
				break;

			case 'jsdelivr':
				$style_url = 'https://cdn.jsdelivr.net/npm/emojify.js@' . $this->emojify_version . '/dist/css/basic/emojify.min.css';
				break;

			default:
				$style_url = $this->githuber_plugin_url . 'assets/vendor/emojify/css/emojify.min.css';
				break;
		}
		wp_enqueue_style( 'emojify', $style_url, array(), $this->emojify_version, 'all' );
	}

	/**
	 * Register JS files for frontend use.
	 *
	 * @return void
	 */
	public function front_enqueue_scripts() {

		$option = githuber_get_option( 'emojify_src', 'githuber_modules' );

		switch ( $option ) {
			case 'cloudflare':
				$script_url = 'https://cdnjs.cloudflare.com/ajax/libs//emojify.js/' . $this->emojify_version . '/js/emojify.min.js';
				break;

			case 'jsdelivr':
				$script_url = 'https://cdn.jsdelivr.net/npm/emojify.js@' . $this->emojify_version . '/dist/js/emojify.min.js';
				break;

			default:
				$script_url = $this->githuber_plugin_url . 'assets/vendor/emojify/js/emojify.min.js';
				break;
		}
		wp_enqueue_script( 'emojify', $script_url, array(), $this->emojify_version, true );
	}

	/**
	 * Print Javascript plaintext in page footer.
	 */
	public function front_print_footer_scripts() {

		$option = githuber_get_option( 'emojify_src', 'githuber_modules' );

		switch ( $option ) {
			case 'cloudflare':
				// https://cdnjs.cloudflare.com/ajax/libs/emojify.js/1.1.0/images/basic/+1.png
				$img_dir = 'https://cdnjs.cloudflare.com/ajax/libs//emojify.js/' . $this->emojify_version . '/images/basic';
				break;

			case 'jsdelivr':
				// https://cdn.jsdelivr.net/npm/emojify.js@1.1.0/dist/images/basic/+1.png
				$img_dir = 'https://cdn.jsdelivr.net/npm/emojify.js@' . $this->emojify_version . '/dist/images/basic';
				break;

			default:
				$img_dir = $this->githuber_plugin_url . 'assets/vendor/emojify/images';
				break;
		}

		$script = '
			<script id="module-emojify">
				(function($) {
					$(function() {
						if (typeof emojify !== "undefined") {
							emojify.setConfig({
								img_dir: "' . $img_dir . '",
								blacklist: {
									"classes": ["no-emojify"],
									"elements": ["script", "textarea", "pre", "code"]
								}
							});
							emojify.run();
						} else {
							console.log("[wp-githuber-md] emogify is undefined.");
						}
					});
				})(jQuery);
			</script>
		';
		echo $script;
	}
}