kollapsminoriteten/wp-content/plugins/wp-lightbox-2/admin/admin_menu.php

98 lines
2.6 KiB
PHP
Raw Permalink Normal View History

2026-03-31 11:30:59 +02:00
<?php
2020-12-17 14:35:39 +01:00
2026-03-31 11:30:59 +02:00
require_once $this->plugin_path . 'admin/general_settings.php';
class wp_lightbox_admin_menu {
private $menu_name;
2020-12-17 14:35:39 +01:00
private $databese_parametrs;
private $plugin_url;
private $plugin_path;
2026-03-31 11:30:59 +02:00
public $wp_lightbox_2_general_settings_page;
public function __construct( $param = array() ) {
$this->menu_name = 'WP Lightbox 2';
$this->databese_parametrs = $param[ 'databese_parametrs' ]->get_general_settings;
$this->wp_lightbox_2_general_settings_page = new wp_lightbox_2_general_settings_page( array(
'plugin_url' => $this->plugin_url,
'plugin_path' => $this->plugin_path,
'databese_settings' => $this->databese_parametrs
) );
// set plugin url
if ( isset( $param[ 'plugin_url' ] ) ) {
$this->plugin_url = $param[ 'plugin_url' ];
} else {
$this->plugin_url = trailingslashit( dirname( plugins_url( '', __FILE__ ) ) );
}
2020-12-17 14:35:39 +01:00
2026-03-31 11:30:59 +02:00
// set plugin path
if ( isset( $param[ 'plugin_path' ] ) ) {
$this->plugin_path = $param[ 'plugin_path' ];
} else {
$this->plugin_path = trailingslashit( dirname( plugin_dir_path( __FILE__ ) ) );
}
2020-12-17 14:35:39 +01:00
}
2026-03-31 11:30:59 +02:00
public function poll_button_register( $plugin_array = array() ) {
$url = $this->plugin_url . 'admin/scripts/editor_plugin.js';
$plugin_array[ "poll_mce" ] = $url;
2020-12-17 14:35:39 +01:00
return $plugin_array;
}
2026-03-31 11:30:59 +02:00
public function create_menu() {
$manage_page_main = add_menu_page(
$this->menu_name,
$this->menu_name,
'manage_options',
str_replace( ' ', '-', $this->menu_name ),
array(
$this->wp_lightbox_2_general_settings_page,
'controller_page'
),
$this->plugin_url . 'admin/images/icon_lightboxx2.png'
);
add_submenu_page(
str_replace( ' ', '-', $this->menu_name ),
'General settings',
'General settings',
'manage_options',
str_replace( ' ', '-', $this->menu_name ),
array(
$this->wp_lightbox_2_general_settings_page,
'controller_page'
)
);
2020-12-17 14:35:39 +01:00
2026-03-31 11:30:59 +02:00
add_action(
'admin_print_styles-' . $manage_page_main,
array(
$this,
'menu_requeried_scripts'
)
);
2020-12-17 14:35:39 +01:00
}
2026-03-31 11:30:59 +02:00
public function menu_requeried_scripts() {
wp_enqueue_script( 'jquery-ui-style' );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-widget' );
wp_enqueue_script( 'jquery-ui-mouse' );
wp_enqueue_script( 'jquery-ui-slider' );
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_style( 'jquery-ui-style' );
wp_enqueue_style( 'admin_style_wp_lightbox' );
2020-12-17 14:35:39 +01:00
wp_enqueue_style( 'wp-color-picker' );
2026-03-31 11:30:59 +02:00
2020-12-17 14:35:39 +01:00
add_thickbox();
}
2026-03-31 11:30:59 +02:00
}