Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- /**
- * 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 Architect_Ink
- * @subpackage Architect_Ink/admin
- * @author architect.ink <contact@architect.ink>
- */
- class Architect_Ink_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;
- /**
- * The locale
- *
- * @since 1.0.0
- * @access private
- * @var string $version The locale of this plugin.
- */
- private $locale;
- /**
- * The plugin version is outdated
- *
- * @since 1.0.0
- * @access private
- * @var string $version The locale of this plugin.
- */
- private $is_outdated;
- /**
- * 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;
- $this->locale = $this->getDefaultLocale();
- $this->generateRequestsJob = new Architect\Jobs\GenerateRequests();
- }
- /**
- * Register the stylesheets for the admin area.
- *
- * @since 1.0.0
- */
- public function enqueue_styles()
- {
- wp_enqueue_style($this->plugin_name . '-toastify', plugin_dir_url(__FILE__) . 'css/libs/toastify.css', [], $this->version, 'all');
- wp_enqueue_style($this->plugin_name . '-datatable', plugin_dir_url(__FILE__) . 'css/libs/jquery.dataTables.css', [], $this->version, 'all');
- wp_enqueue_style($this->plugin_name . '-daterangepicker', plugin_dir_url(__FILE__) . 'css/libs/daterangepicker.css', [], $this->version, 'all');
- wp_enqueue_style($this->plugin_name . '-normalize', plugin_dir_url(__FILE__) . 'css/normalize.css', [], $this->version, 'all');
- wp_enqueue_style($this->plugin_name . '-tailwind', plugin_dir_url(__FILE__) . 'css/tailwind.css', [], $this->version, 'all');
- wp_enqueue_style($this->plugin_name . '-core', plugin_dir_url(__FILE__) . 'css/architect-ink-admin.css', [], $this->version, 'all');
- }
- /**
- * Register the JavaScript for the admin area.
- *
- * @since 1.0.0
- */
- public function enqueue_scripts()
- {
- $plugin = $this->plugin_name;
- $this->load_script('toastify', 'libs/toastify.js');
- $this->load_script('datatable', 'libs/jquery.dataTables.js', ['jquery']);
- $this->load_script('daterangepicker', 'libs/daterangepicker.js', ['jquery', 'moment']);
- $this->load_script('textarea-tabulation', 'libs/textarea-tabulation.js', ['jquery']);
- wp_enqueue_script('jquery-ui-sortable');
- $this->load_script('nested-sortable', 'libs/jquery.nestedSortable.js', ['jquery-ui-sortable']);
- $this->load_script('api', 'utils/api.js', ['jquery']);
- $this->load_script('help', 'utils/help.js', ['jquery']);
- $this->load_script('toast', 'components/toast.js', [], ['toastify']);
- $this->load_script('button', 'components/button.js', ['jquery']);
- $this->load_script('range-slider', 'components/range-slider.js', ['jquery']);
- $this->load_script('dropdown', 'components/dropdown.js', ['jquery']);
- $this->load_script('languages-dropdown', 'components/languages-dropdown.js', ['jquery', 'lodash'], ['dropdown']);
- $this->load_script('modal', 'components/modal.js', ['jquery']);
- $this->load_script('toggle', 'components/toggle.js', ['jquery']);
- $this->load_script('publishing', 'publishing.js', ['jquery'], ['daterangepicker']);
- $this->load_script('input-single', 'content-generator-modules/input-types/single.js', ['jquery'], ['button', 'toast', 'dropdown', 'languages-dropdown', 'nested-sortable']);
- $this->load_script('input-multi', 'content-generator-modules/input-types/multi.js', ['jquery'], ['button', 'toast', 'dropdown', 'languages-dropdown']);
- $this->load_script('input-rss', 'content-generator-modules/input-types/rss.js', ['jquery'], ['button', 'toast', 'dropdown', 'languages-dropdown']);
- $this->load_script('input-edit', 'content-generator-modules/input-types/edit.js', ['jquery'], ['button', 'toast', 'dropdown', 'languages-dropdown']);
- $this->load_script('input-gapfill', 'content-generator-modules/input-types/gapfill.js', ['jquery'], ['button', 'toast', 'dropdown', 'languages-dropdown', 'modal']);
- $this->load_script('input', 'content-generator-modules/input.js', ['jquery', 'lodash'], ['input-single', 'input-multi', 'input-rss', 'input-edit']);
- $this->load_script('text', 'content-generator-modules/text.js', ['jquery', 'lodash']);
- $this->load_script('custom', 'content-generator-modules/custom.js', ['jquery', 'lodash']);
- $this->load_script('images', 'content-generator-modules/images.js', ['jquery', 'lodash'], ['dropdown']);
- $this->load_script('video', 'content-generator-modules/video.js', ['jquery', 'lodash'], ['dropdown']);
- $this->load_script('local', 'content-generator-modules/local.js', ['jquery', 'lodash']);
- $this->load_script('seo', 'content-generator-modules/seo.js', ['jquery', 'lodash']);
- $this->load_script('spin', 'content-generator-modules/spin.js', ['jquery', 'lodash'], ['dropdown']);
- $this->load_script('translate', 'content-generator-modules/translate.js', ['jquery', 'lodash'], ['dropdown', 'languages-dropdown']);
- $this->load_script('output', 'content-generator-modules/output.js', ['jquery', 'lodash']);
- $this->load_script('content-generator', 'pages/content-generator.js', ['jquery'], ['input', 'languages-dropdown', 'dropdown', 'toast', 'toggle', 'text', 'custom', 'images', 'video', 'local', 'seo', 'spin', 'translate', 'output']);
- $this->load_script('manage-task', 'pages/manage-task.js', ['jquery'], ['button', 'toast', 'api', 'dropdown', 'toggle', 'text', 'custom', 'images', 'video', 'local', 'seo', 'spin', 'translate', 'output']);
- $this->load_script('settings', 'pages/settings.js', ['jquery'], ['button', 'toast', 'translate', 'api']);
- $this->load_script('linking', 'pages/linking.js', ['jquery'], ['button', 'toast', 'api']);
- $this->load_script('login', 'pages/login.js', ['jquery'], ['button', 'api']);
- $this->load_script('tasks', 'pages/tasks.js', ['jquery', 'moment'], ['button', 'toast', 'api', 'modal']);
- $this->load_script('pages', 'pages/pages.js', ['jquery', 'moment'], ['button', 'toast', 'api', 'modal']);
- $this->load_script('templates', 'pages/templates.js', ['jquery', 'moment'], ['modal', 'toast', 'api']);
- if (defined('ARCHITECT_INK_LOG') && ARCHITECT_INK_LOG) {
- $this->load_script('logs', 'pages/logs.js', ['jquery'], ['button', 'toast', 'api']);
- }
- $this->load_script('architect-admin', 'architect-admin.js', ['jquery'], ['api', 'toast']);
- wp_add_inline_script($plugin . '-api', 'var architect_ink_ajaxurl = "' . admin_url('admin-ajax.php') . '";');
- wp_add_inline_script($plugin . '-api', 'var architect_ink_nonce = "' . wp_create_nonce('architect-ink-nonce') . '";');
- wp_add_inline_script($plugin . '-tasks', 'var architect_task_manage = "' . admin_url('admin.php?page=architect-ink-tasks&sub=manage&task=') . '";');
- wp_add_inline_script($plugin . '-tasks', 'var architect_pages_list_url = "' . admin_url('admin.php?page=architect-ink-tasks&sub=pages&task=') . '";');
- wp_add_inline_script($plugin . '-content-generator', 'var architect_pages_list_url = "' . admin_url('admin.php?page=architect-ink-tasks&sub=pages&task=') . '";');
- wp_add_inline_script($plugin . '-architect-admin', 'var architect_images_path = "' . plugin_dir_url(__FILE__) . 'images' . '";');
- wp_add_inline_script($plugin . '-architect-admin', 'var architect_default_locale = "' . $this->locale . '";');
- }
- private function load_script($name, $path, $wordpressDependencies = [], $pluginDependencies = [])
- {
- $name = $this->plugin_name . '-' . $name;
- $url = plugin_dir_url(__FILE__) . 'js/' . $path;
- $dependencies = $wordpressDependencies;
- foreach ($pluginDependencies as $dep) {
- $dependencies[] = $this->plugin_name . '-' . $dep;
- }
- wp_enqueue_script($name, $url, $dependencies, $this->version, false);
- }
- /**
- * Create the Kiwys Lite menu page with add_menu_page()
- *
- * @since 1.0.0
- */
- public function menu()
- {
- add_menu_page('architect.ink', 'architect.ink', 'manage_options', $this->plugin_name, [$this, 'load_admin_page_content_generator'], plugin_dir_url(__FILE__) . 'images/logo-sidebar.png', 5);
- add_submenu_page($this->plugin_name, 'architect.ink', __('Content generator', 'architect-ink'), 'manage_options', $this->plugin_name, [$this, 'load_admin_page_content_generator']);
- add_submenu_page($this->plugin_name, 'architect.ink', __('Tasks', 'architect-ink'), 'manage_options', $this->plugin_name . '-tasks', [$this, 'load_admin_page_tasks']);
- add_submenu_page($this->plugin_name, 'architect.ink', __('Templates', 'architect-ink'), 'manage_options', $this->plugin_name . '-templates', [$this, 'load_admin_page_templates']);
- add_submenu_page($this->plugin_name, 'architect.ink', 'Maillage', 'manage_options', $this->plugin_name . '-linking', [$this, 'load_admin_page_linking']);
- add_submenu_page($this->plugin_name, 'architect.ink', __('Settings', 'architect-ink'), 'manage_options', $this->plugin_name . '-settings', [$this, 'load_admin_page_settings']);
- if (defined('ARCHITECT_INK_LOG') && ARCHITECT_INK_LOG) {
- add_submenu_page($this->plugin_name, 'architect.ink', 'Logs', 'manage_options', $this->plugin_name . '-logs', [$this, 'load_admin_page_logs']);
- }
- if (defined('ARCHITECT_INK_TEST') && ARCHITECT_INK_TEST) {
- add_submenu_page($this->plugin_name, 'architect.ink', 'Test', 'manage_options', $this->plugin_name . '-test', [$this, 'load_admin_page_test']);
- }
- $updates = get_plugin_updates();
- $this->is_outdated = isset($updates[$this->plugin_name . '/' . $this->plugin_name . '.php']);
- }
- /**
- * Load the plugin admin content generator page.
- *
- * @since 1.0.0
- */
- public function load_admin_page_content_generator()
- {
- if (!Architect_Ink_Licence::isAuth()) {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-login.php';
- return NULL;
- }
- require_once plugin_dir_path(__FILE__) . 'views/content-generator/architect-ink-admin-content-generator.php';
- }
- /**
- * Load the plugin admin tasks page.
- *
- * @since 1.0.0
- */
- public function load_admin_page_tasks()
- {
- if (!Architect_Ink_Licence::isAuth()) {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-login.php';
- return NULL;
- }
- $subPage = 'index';
- if (isset($_GET['sub'])) {
- switch ($_GET['sub']) {
- case 'manage':
- $subPage = 'manage';
- $task = Architect\Models\Job::find($_GET['task']);
- break;
- case 'pages':
- $subPage = 'pages';
- $task = Architect\Models\Job::find($_GET['task']);
- break;
- default:
- $subPage = 'index';
- }
- }
- require_once plugin_dir_path(__FILE__) . 'views/tasks/architect-ink-admin-tasks.php';
- }
- public function load_admin_page_templates()
- {
- if (!Architect_Ink_Licence::isAuth()) {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-login.php';
- return NULL;
- }
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-templates.php';
- }
- /**
- * Load the plugin admin settings page.
- *
- * @since 1.0.0
- */
- public function load_admin_page_settings()
- {
- if (!Architect_Ink_Licence::isAuth()) {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-login.php';
- return NULL;
- }
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-settings.php';
- }
- /**
- * Load the plugin admin linking page.
- *
- * @since 1.0.0
- */
- public function load_admin_page_linking()
- {
- if (!Architect_Ink_Licence::isAuth()) {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-login.php';
- return NULL;
- }
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-linking.php';
- }
- /**
- * Load the plugin admin test page.
- * To be deleted
- *
- * @since 1.0.0
- */
- public function load_admin_page_logs()
- {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-logs.php';
- }
- /**
- * Load the plugin admin test page.
- * To be deleted
- *
- * @since 1.0.0
- */
- public function load_admin_page_test()
- {
- require_once plugin_dir_path(__FILE__) . 'views/architect-ink-admin-test.php';
- }
- public function login()
- {
- status_header(200);
- if ($this->verifyNonce('_ajax_nonce')) {
- if (isset($_POST['data'])) {
- $data = json_decode(stripcslashes($_POST['data']), true);
- $errors = [];
- if (!isset($data['email'])) {
- $errors['email'] = 'The email field is required.';
- }
- if (!isset($data['password'])) {
- $errors['password'] = 'The password field is required.';
- }
- if (0 < count($errors)) {
- $this->response(['success' => false, 'errors' => $errors]);
- }
- $email = $data['email'];
- $password = $data['password'];
- return $this->response(Architect_Ink_Licence::login($email, $password));
- ............................................................................
- ....................................................
- .....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement