403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
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,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/admin/class-the7-admin-mega-menu.php
<?php
/**
 * The7 mega menu admin class.
 *
 * @since   3.0.0
 *
 * @package The7\Admin
 */

use Elementor\Plugin;

defined( 'ABSPATH' ) || exit;

/**
 * Class The7_Admin_Mega_Menu
 */
class The7_Admin_Mega_Menu {

	const MENU_ITEM_SETTINGS_NAME = '_menu_item_the7_mega_menu_settings';

	/**
	 * Return array of mega menu options.
	 *
	 * @return array
	 */
	protected function mega_menu_settings_definition() {
		$menu_opt = require __DIR__ . '/mega-menu-options.php';
		return apply_filters( 'the7_mega_menu_options', $menu_opt );
	}

	/**
	 * Setup custom menu item fields before output.
	 *
	 * @param object $menu_item The menu item object.
	 *
	 * @return object
	 */
	public function wp_setup_nav_menu_item( $menu_item ) {
		$menu_item->the7_mega_menu = get_post_meta( $menu_item->ID, self::MENU_ITEM_SETTINGS_NAME, true );

		return $menu_item;
	}

	/**
	 * Update custom menu item fields.
	 *
	 * @param int $menu_id         ID of the updated menu.
	 * @param int $menu_item_db_id ID of the updated menu item.
	 */
	public function wp_update_nav_menu_item( $menu_id, $menu_item_db_id ) {
		if ( ! empty( $_POST[ self::MENU_ITEM_SETTINGS_NAME ][ $menu_item_db_id ] ) ) {
			$mega_menu_settings = optionsframework_sanitize_options_values(
				$this->mega_menu_settings_definition(),
				json_decode(
					wp_unslash(
						$_POST[ self::MENU_ITEM_SETTINGS_NAME ][ $menu_item_db_id ]
					),
					$assoc = true
				)
			);

			update_post_meta( $menu_item_db_id, self::MENU_ITEM_SETTINGS_NAME, $mega_menu_settings );
		}
	}

	/**
	 * Render modal window content placeholder. Later on, theme options HTML would be placed inside
	 * .presscore-modal-content with ajax callback.
	 */
	public function output_popup_template() {
		?>

		<div id="the7-mega-menu-settings" class="popupContainer" style="display: none"></div>

		<?php
	}

	/**
	 * Ajax callback that renders theme options HTML.
	 */
	public function ajax_render_mega_menu_settings() {
		check_ajax_referer( 'the7_mega_menu_settings', 'nonce' );

		if ( ! current_user_can( 'edit_theme_options' ) ) {
			wp_send_json_error( array( 'message' => esc_html__( 'Insufficient permissions.', 'the7mk2' ) ) );
		}

		$item_depth    = isset( $_POST['item_depth'] ) ? (int) $_POST['item_depth'] : 0;
		$item_id       = isset( $_POST['item_id'] ) ? (int) $_POST['item_id'] : 0;
		$item_settings = isset( $_POST['item_settings'] ) ? (array) json_decode(
			wp_unslash( $_POST['item_settings'] ),
			true
		) : array();
		if ( ! $item_settings && $item_id ) {
			$item_settings = (array) get_post_meta( $item_id, self::MENU_ITEM_SETTINGS_NAME, $single = true );
		}
		$parent_mega_menu = isset( $_POST['parent_mega_menu'] ) ? $_POST['parent_mega_menu'] : 'off';
		$parent_mega_menu_elementor = isset( $_POST['parent_mega_menu_elementor'] ) ? $_POST['parent_mega_menu_elementor'] : 'off';
		$parent_id        = isset( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0;
		$parent_settings = null;
		if ( $parent_id ) {
			$parent_settings = get_post_meta( $parent_id, self::MENU_ITEM_SETTINGS_NAME, $single = true );
		}
		if ( ! $parent_mega_menu && $parent_id ) {
			$parent_mega_menu = isset( $parent_settings['mega-menu'] ) ? $parent_settings['mega-menu'] : 'off';
		}
		if ( !The7_Admin_Dashboard_Settings::get( 'deprecated_mega_menu_settings' ) ) {
			$parent_mega_menu = 'off';
        }

		if ( !$parent_mega_menu_elementor && $parent_id ) {
			$parent_mega_menu_elementor = isset( $parent_settings['mega-menu-elementor'] ) ? $parent_settings['mega-menu-elementor'] : 'off';
		}
		if ($parent_mega_menu_elementor == 'on'){
			$parent_mega_menu = 'off';
		}

		$of_interface  = new The7_Options( $this->mega_menu_settings_definition() );
		$item_settings = optionsframework_sanitize_options_values(
			$this->mega_menu_settings_definition(),
			$item_settings
		);
		?>

		<div id="optionsframework" class="optionsframework">
			<input type="hidden" id="section-item-depth" class="section" value="" data-value="<?php echo esc_attr( $item_depth ); ?>"></input>
			<input type="hidden" id="section-parent-mega-menu" class="section" value="" data-value="<?php echo esc_attr( $parent_mega_menu ); ?>"></input>
			<?php $of_interface->render_options_html( 'the7-mega-menu', $item_settings ); ?>
		</div>

		<?php

		wp_die();
	}

	/**
	 * Enqueue theme options and mega menu related scripts and styles.
	 */
	public function admin_enqueue_scripts() {
		// Collect dependencies.
		foreach ( $this->mega_menu_settings_definition() as $option ) {
			if ( isset( $option['id'], $option['dependency'] ) ) {
				optionsframework_fields_dependency()->set( $option['id'], $option['dependency'] );
			}
		}

		optionsframework_load_styles();
		optionsframework_load_scripts();
		of_localize_scripts();

		the7_register_style( 'the7-mega-menu', PRESSCORE_ADMIN_URI . '/assets/css/the7-mega-menu' );
		the7_register_script( 'the7-mega-menu', PRESSCORE_ADMIN_URI . '/assets/js/the7-mega-menu', array(), false, true );
		wp_enqueue_script( 'the7-mega-menu' );
		wp_enqueue_style( 'the7-mega-menu' );

		wp_localize_script(
			'the7-mega-menu',
			'the7MegaMenuTemplates',
			array(
				'megaMenuButton'             => '<button type="button" class="button button-primary the7-options-tb-popup" data-popup-id="the7-mega-menu-settings">' . esc_html_x( 'The7 Menu Icon & Mega Menu', 'admin', 'the7mk2' ) . '</button>',
				'itemSettingsStorageElement' => '<input type="hidden" class="the7-mega-menu-settings" name="' . self::MENU_ITEM_SETTINGS_NAME . '[%itemID%]" value="">',
				'popupBottomBar'             => '<div class="optionsframework-submit"><a href="#closeTB" class="button-primary">' . esc_html_x( 'Change and close', 'admin', 'the7mk2' ) . '</a></div>',
				'popupTitle'                 => esc_html_x( 'The7 Mega Menu', 'admin', 'the7mk2' ),
				'nonce'                      => wp_create_nonce( 'the7_mega_menu_settings' ),
			)
		);
	}

	public function add_svg_support_in_megamenu(){
		if ( ! function_exists( 'get_current_screen' ) ) {
			return false;
		}
		$screen = get_current_screen();
		if($screen->base != 'nav-menus'){
			return;
		}
		if (the7_elementor_is_active()) {
			Plugin::$instance->uploads_manager->set_elementor_upload_state( true );
			add_filter( 'plupload_default_params', [ $this,'plupload_add_svg_upload_type_caller' ]);
		}
	}

    public function plupload_add_svg_upload_type_caller( $plupload_settings ) {
		$plupload_settings['uploadTypeCaller'] = 'elementor-wp-media-upload' ;
		return $plupload_settings;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit