403Webshell
Server IP : 43.130.17.34  /  Your IP : 216.73.217.6
Web Server : nginx/1.28.0
System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64
User : www ( 1000)
PHP Version : 8.0.26
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
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/yespkg.com/wp-content/plugins/admin-columns-pro.5.1.3/classes/Editing/Model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/yespkg.com/wp-content/plugins/admin-columns-pro.5.1.3/classes/Editing/Model/Menu.php
<?php

namespace ACP\Editing\Model;

use AC;
use AC\Storage\Transaction;
use ACP\Editing\Model;
use WP_Post;

/**
 * @property AC\Column\Menu $column
 */
abstract class Menu extends Model {

	/**
	 * @param int $id
	 *
	 * @return string
	 */
	abstract protected function get_title( $id );

	public function get_view_settings() {
		$options = [];

		$menus = wp_get_nav_menus();

		if ( $menus && ! is_wp_error( $menus ) ) {
			foreach ( $menus as $menu ) {
				$options[ $menu->term_id ] = $menu->name;
			}
		}

		return [
			'type'         => 'select2_dropdown',
			'multiple'     => true,
			'clear_button' => true,
			'options'      => $options,
		];
	}

	public function get_edit_value( $id ) {
		$menus = [];

		foreach ( $this->column->get_menus( $id ) as $menu ) {
			$menus[ $menu->term_id ] = $menu->name;
		}

		return $menus;
	}

	/**
	 * Return list of menu items if the object ID is present
	 *
	 * @param int $menu_id
	 * @param int $object_id
	 *
	 * @return array|false
	 */
	private function item_exists( $menu_id, $object_id ) {
		$items = wp_get_nav_menu_items( $menu_id, [ 'post_status' => 'publish' ] );

		if ( ! $items ) {
			return false;
		}

		$items = wp_filter_object_list( $items, [ 'object' => $this->column->get_object_type() ] );

		return in_array( $object_id, wp_list_pluck( $items, 'object_id' ) );
	}

	public function save( $id, $menu_ids ) {
		$transaction = new Transaction();

		$results = [];

		// Delete item from menu
		foreach ( $this->column->get_menu_item_ids( $id ) as $menu_item_id ) {
			if ( ! in_array( $menu_item_id, $menu_ids, true ) ) {
				$result = wp_delete_post( $menu_item_id, true );

				$results[] = $result instanceof WP_Post;
			}
		}

		// Add item to menu
		foreach ( $menu_ids as $menu_id ) {
			if ( $this->item_exists( $menu_id, $id ) ) {
				continue;
			}

			$item = [
				'menu-item-object-id' => $id,
				'menu-item-db-id'     => 0,
				'menu-item-object'    => $this->column->get_object_type(),
				'menu-item-type'      => $this->column->get_item_type(),
				'menu-item-title'     => $this->get_title( $id ),
				'menu-item-status'    => 'publish',
			];

			$result = wp_update_nav_menu_item( $menu_id, 0, $item );

			if ( is_wp_error( $result ) ) {
				$this->set_error( $result );

				$transaction->rollback();

				return false;
			}
		}

		return ! in_array( false, $results, true );
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit