HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/somonline.org/wp-content/plugins/zeen-engine/admin/class-zeen-engine-admin.php
<?php
/**
 *
 * Zeen Engine Admin
 *
 * @since      1.0.0
 *
 * @package    Zeen Engine
 * @subpackage zeen-engine/admin
 */

class Zeen_Engine_Admin {

	/**
	 * Constructor
	 *
	 * @since 1.0.0
	 *
	*/
	public function __construct( $slug, $version, $url ) {
		$this->slug = $slug;
		$this->version = $version;
		$this->url = $url;
		add_action( 'after_setup_theme', array( $this, 'zeen_engine_thumbnails' ) );
		add_action( 'edit_form_before_permalink', array( $this, 'zeen_engine_after_title' ) );
		add_action( 'wp_ajax_zeen_engine_sb_remove', array( $this, 'zeen_engine_sb_remove' ) );
		add_action( 'wp_ajax_zeen_engine_migration', array( $this, 'zeen_engine_migration' ) );
	}

	/**
	 * Scripts
	 *
	 * @since    1.0.0
	 */
	public function scripts( $pagenow ) {

		if ( 'post.php' == $pagenow || 'post-new.php' == $pagenow || 'widgets.php' == $pagenow || 'term.php' == $pagenow || 'edit-tags.php' == $pagenow || 'nav-menus.php' == $pagenow || strpos( $pagenow, 'zeen' ) !== false ) {
			wp_enqueue_style( 'wp-color-picker' );
			wp_enqueue_script( 'jquery-ui-core' );
			wp_enqueue_script( 'jquery-ui-slider' );
			wp_enqueue_script( 'suggest' );
			wp_enqueue_script( 'jquery-ui-datepicker' );
			wp_enqueue_media();
			wp_enqueue_style( 'zeen-engine', esc_url( $this->url  . 'admin/css/admin-style.min.css' ), array(), $this->version, 'all' );
			wp_enqueue_style( 'zeen-engine-i', esc_url( $this->url  . 'admin/css/style.css' ), array(), $this->version, 'all' );

			wp_enqueue_script( 'zeen-engine-admin-vendors-js', esc_url( $this->url  . 'admin/js/zeen-engine-admin-vendors.js' ), array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-core', 'jquery-ui-slider', 'wp-color-picker' ), $this->version, true );
			wp_enqueue_script( 'zeen-engine-js', esc_url( $this->url  . 'admin/js/zeen-engine-admin.js' ), array( 'jquery', 'zeen-engine-admin-vendors-js' ), $this->version, true );
			wp_localize_script( 'zeen-engine-js', 'zeenEngineJS', array(
				'i18n' => self::i18n(),
				'nonce' => wp_create_nonce( 'zeen_engine_nonce' ),
				'ajax' => admin_url( 'admin-ajax.php' ),
			) );
		}

	}

	public function zeen_engine_migration() {
		if ( ! wp_verify_nonce( $_POST['nonce'], 'zeen_engine_nonce' ) || ! current_user_can( 'edit_posts' ) ) {
			wp_die();
		}
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/migration-do.php';
		$type = $_POST['type'];
		$migration = zeen_engine_migration_do( $type );
		wp_send_json_success( $migration );
		wp_die();
	}

	public function zeen_engine_sb_remove() {

		if ( ! wp_verify_nonce( $_POST['nonce'], 'zeen_engine_nonce' ) || ! current_user_can( 'edit_posts' ) ) {
			wp_die();
		}
		$id = $_POST['id'];
		$type = $_POST['type'];
		$name = 'zeen_sidebar_' . $type;
		if ( isset( Zeen_Engine_Options::$zeen_engine_options[ $name ] ) ) {
			foreach ( Zeen_Engine_Options::$zeen_engine_options[ $name ] as $key => $val ) {
				if ( ! empty( $val['uid'] ) && $id == $val['uid'] ) {
					$search = $key;
				}
			}
			if ( ! isset( $search ) ) {
				$search = array_search( $id, Zeen_Engine_Options::$zeen_engine_options[ $name ] );
			}
			if ( false !== $search ) {
				unset( Zeen_Engine_Options::$zeen_engine_options[ $name ][ $search ] );
				Zeen_Engine_Options::zeen_engine_update_option();
				if ( 'tids' == $type ) {
					update_term_meta( $id, $name, '' );
				} elseif ( 'pids' == $type ) {
					update_post_meta( $id, $name, '' );
				}
			}
		}
		wp_send_json_success();
		wp_die();
	}

	/**
	 * Thumbnail Sizes
	 *
	 * @since    1.0.0
	 */
	public function zeen_engine_thumbnails() {
		add_image_size( 'zeen-engine-293-293', 293, 293, true );
	}

	/**
	 * i18n
	 *
	 * @since    1.0.0
	 */
	public static function i18n() {

		$output = array();

		$output['titleButton']       = esc_html__( 'Insert', 'zeen-engine' );
		$output['titleModal']        = esc_html__( 'Select Image', 'zeen-engine' );
		$output['titleGalleryModal'] = esc_html__( 'Select or Upload Images', 'zeen-engine' );
		$output['titleSbRemoveConfirm'] = esc_html__( 'Are you sure you want to delete this custom sidebar? If deleted it will no longer appear in your Widgets page either.', 'zeen-engine' );

		return $output;
	}

	/**
	 * After Title1
	 *
	 * @since    1.0.0
	 */
	public function zeen_engine_after_title( $post ) {
		if ( 'post' != $post->post_type ) {
			return;
		}
		$pid = $post->ID;

		$value = get_post_meta( $pid, 'zeen_subtitle', true );
		$value = ! isset( $value ) ? get_post_meta( $pid, 'wps_subtitle', true ) : $value;
		$value = ! isset( $value ) ? get_post_meta( $pid, '_subtitle', true ) : $value;
		?>
		<input type="text" id="zeen-engine-subtitle" tabindex="1" class="zeen-engine-subtitle" name="zeen_subtitle" value="<?php echo esc_attr( $value ); ?>" autocomplete="off" spellcheck="true" placeholder="<?php esc_html_e( 'Enter subtitle here', 'zeen-engine' ); ?>">
		<?php
	}


}