registerActions(); $this->wordpressTranslates = new WordpressTranslates(); $this->wordpressStats = new WordpressStats(); add_action('admin_init', [$this, 'ebdnActivateRedirect']); } else { register_activation_hook(__FILE__, [$this, 'ebdnActivateInstall']); } } public function ebdnActivateRedirect() { if (get_option('ebdn_activate_redirect', false)) { delete_option('ebdn_activate_redirect'); wp_redirect("admin.php?page=ebdn-settings#ebay"); //wp_redirect() does not exit automatically and should almost always be followed by exit. exit; } } public function ebdnActivateInstall() { add_option('ebdn_activate_redirect', true); } public function registerActions() { // $frontEnd = new Frontend(); // $frontEnd->init(); } /** * */ public function woocomerceCheckError() { $class = 'notice notice-error'; $message = __( 'AffiliateImporterEb notice! Please install the Woocommerce plugin first.', 'sample-text-domain' ); printf('

%2$s

', $class, $message); } /** * */ public function registerAssets() { require_once ABSPATH . 'wp-admin/includes/plugin.php'; $plugin_data = get_plugin_data(__FILE__); wp_enqueue_style('ebdn-style', plugins_url('assets/css/dnolbon.css', __FILE__), array(), $plugin_data['Version']); wp_enqueue_style('ebdn-style', plugins_url('assets/css/style.css', __FILE__), array(), $plugin_data['Version']); wp_enqueue_style('ebdn-font-style', plugins_url('assets/css/font-awesome.min.css', __FILE__), array(), $plugin_data['Version']); wp_enqueue_style('ebdn-dtp-style', plugins_url('assets/js/datetimepicker/jquery.datetimepicker.css', __FILE__), array(), $plugin_data['Version']); wp_enqueue_style('ebdn-lighttabs-style', plugins_url('assets/js/lighttabs/lighttabs.css', __FILE__), array(), $plugin_data['Version']); wp_enqueue_script('ebdn-script', plugins_url('assets/js/script.js', __FILE__), array(), $plugin_data['Version']); wp_enqueue_script('ebdn-dtp-script', plugins_url('assets/js/datetimepicker/jquery.datetimepicker.js', __FILE__), array('jquery'), $plugin_data['Version']); wp_enqueue_script('ebdn-lighttabs-script', plugins_url('assets/js/lighttabs/lighttabs.js', __FILE__), array('jquery'), $plugin_data['Version']); wp_enqueue_script( 'ebdn-columns-script', plugins_url('assets/js/DnolbonColumns.js', __FILE__), [], $plugin_data['Version'] ); wp_localize_script('ebdn-script', 'WPURLS', array('siteurl' => site_url())); } /** * */ public function registerMenu() { new EBDN_Goods(); $api_list = ebdn_get_api_list(); $menu = WordpressMenuFactory::addMenu( EBDN_NAME, 'manage_options', 'ebdn', [ 'icon' => 'small_logo.png', 'function' => [new Dashboard(), 'render'] ] ); /** * @var EBDN_AbstractConfigurator $api */ foreach ($api_list as $api) { if ($api->isInstaled()) { if ($api->getConfigValues('menu_title')) { $title = $api->getConfigValues('menu_title'); } else { $title = $api->getType(); } $menu->addChild( WordpressMenuFactory::addMenu( $title, 'manage_options', 'add', ['function' => [new EBDN_DashboardPage($api->getType()), 'render']] ) ); } } $menu->addChild( WordpressMenuFactory::addMenu( 'Shedule', 'manage_options', 'schedule', ['function' => [new Shedule(), 'render']] ) ); $menu->addChild( WordpressMenuFactory::addMenu( 'Statistics', 'manage_options', 'stats', ['function' => [new Stats(), 'render']] ) ); $menu->addChild( WordpressMenuFactory::addMenu( 'Settings', 'manage_options', 'settings', ['function' => [new EBDN_SettingsPage(), 'render']] ) ); $menu->addChild( WordpressMenuFactory::addMenu( 'Backup / Restore', 'manage_options', 'backup', ['function' => [new BackupRestore(), 'render']] ) ); $menu->addChild( WordpressMenuFactory::addMenu( 'Status', 'manage_options', 'status', ['function' => [new Status(), 'render']] ) ); $menu->addChild( WordpressMenuFactory::addMenu( 'Support', 'manage_options', 'support', ['function' => [new Support(), 'render']] ) ); $menu->show(); do_action('ebdn_admin_menu'); } /** * @param $links * @return array */ public function registerActionLinks($links) { return array_merge(array('' . 'Settings' . ''), $links); } /** * */ public function install() { ebdn_install(); } /** * */ public function uninstall() { ebdn_uninstall(); } } } new AffiliateImporterEb();