Files
PartnerExpo-Core/admin/class-partnerexpo-core-admin.php

102 lines
2.5 KiB
PHP

<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://github.com/Duskell
* @since 1.0.0
*
* @package Partnerexpo_Core
* @subpackage Partnerexpo_Core/admin
*/
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Partnerexpo_Core
* @subpackage Partnerexpo_Core/admin
* @author Juhász Levente <juhasz.levente@rendszerepito.hu>
*/
class Partnerexpo_Core_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/partnerexpo-core-business-page.css', [], $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
wp_enqueue_script( $this->plugin_name . '-business-page', plugin_dir_url( __FILE__ ) . 'js/partnerexpo-core-business-page.js', [ 'jquery' ], $this->version, true );
wp_localize_script(
$this->plugin_name . '-business-page',
'businessData',
[
'post_id' => get_user_meta( get_current_user_id(), 'company_logo_attachment_id', true ),
'title' => esc_html__( 'Céges logó kiválasztása', 'partnerexpo-core' ),
'button' => esc_html__( 'Kép használata', 'partnerexpo-core' ),
]
);
}
public function display_business_data_page() {
include_once plugin_dir_path( __FILE__ ) . 'partials/partnerexpo-core-admin-business.php';
}
public function add_menu() {
add_menu_page(
esc_html__( 'Üzleti adatok', 'partnerexpo-core' ),
esc_html__( 'Üzleti adatok', 'partnerexpo-core' ),
'manage_options',
'pexpo-core-business-data',
[ $this, 'display_business_data_page' ],
'dashicons-businessman',
6
);
}
}