version = '1.0.0'; $this->plugin_slug = 'oc-accesibility'; $this->define_constants(); $this->setup_actions(); $this->load_dependencies(); add_action('admin_menu', array($this, 'accessibility_create_menu')); } /** * Hook WC Brands into WordPress */ private function setup_actions() { add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_adminscripts')); add_action('wp_footer', array($this, 'magixite_script')); } public function magixite_script() { if (get_option('oc-accessibility-status', 0) < 1) { echo ''; } else { echo ''; } $language_setting = ""; if (get_option('oc-accessibility-language', "en_us") !== 'oc_system') { $language_setting = "'language': '" . get_option('oc-accessibility-language', "en_us") . "'"; } echo ""; } // Styles Handling public function enqueue_styles() { } public function enqueue_adminscripts() { wp_enqueue_style('admin-style', OCACCESSIBILITY_ASSETS_URL . '/css/admin-style.css', array(), OCACCESSIBILITY_VERSION); } /** * Define Accessibilty constants */ private function define_constants() { define('OCACCESSIBILITY_VERSION', $this->version); define('OCACCESSIBILITY_BASE_URL', trailingslashit(plugins_url('accessibility'))); define('OCACCESSIBILITY_ASSETS_URL', trailingslashit(OCACCESSIBILITY_BASE_URL . 'assets')); define('OCACCESSIBILITY_PATH', plugin_dir_path(__FILE__)); define('OCACCESSIBILITY_PLUGINURL', '//acc.magixite.com'); } public function accessibility_create_menu() { //create new top-level menu add_menu_page('Accesibility Settings', 'Accesibility', 'manage_options', 'oc-accessibility-admin', array($this, 'accesibility_settings_page'), 'dashicons-universal-access-alt'); } public function accesibility_settings_page() { ?>

Accessibility Options

_admin_update_accessibility_settings(); ?> _get_license_data($magixiteLicense); ?>

General Options

get_language_options(); ?>

_get_license_message($license_data); ?>

* Auto Detect - Automatically choose language by user browser language setting.

Brought To You By

loader = new OcAcceibility_Loader(); } public function run() { $this->loader->run(); } public function get_version() { return $this->version; } public function get_language_options() { $languages = array(); $languages['auto_detect'] = (object) array('name' => 'Auto Detect'); $languages['he_il'] = (object) array('name' => 'Hebrew'); $languages['en_us'] = (object) array('name' => 'English'); $languages['ru_ru'] = (object) array('name' => 'Russian'); // $languages['custom'] = (object) array('name' => 'Custom'); return $languages; } private function _get_license_data($lkey) { if ($lkey == "") { return new stdClass(); } $jsonRsp = file_get_contents("http:" . OCACCESSIBILITY_PLUGINURL . "/license/v?litk=" . $lkey); $licenseData = json_decode($jsonRsp); return $licenseData; } /** * Post form action for the update prices for brand. */ function _admin_update_accessibility_settings() { $lkey = sanitize_text_field($_POST["magixite_license"]); update_option('oc-accessibility', $lkey); update_option('oc-accessibility-language', $_POST["ac_language"]); if ($lkey == '') { $status = 0; } else { $licenseData = $this->_get_license_data($lkey); if ($licenseData->status == 'Success') { $status = 1; } else { $status = -1; } } update_option('oc-accessibility-status', $status); $class = "update-nag"; // Validate the license. $message = "Saved Settings"; $message_two = ""; echo "

$message

$message_two

"; } function _get_license_message($license_data) { if (!$license_data) { return "Get your free license here to unlock more design options."; } if ($license_data->status == 'Failure') { return "License Did not validate"; } if (isset($license_data->data->expiry)) { $daysLeft = (intval($license_data->data->expiry) - time()) / (3600 * 24); if ($daysLeft > 0) { return "Success! " . round($daysLeft) . " days for license renewal."; } else { return "Oh Oh! Your license has expired " . round($daysLeft * (-1)) . " days ago.
Please go ahead and renew."; } } return "Nothing to tell ya.."; } } endif; function run_accessibility_plugin() { $plugin = new OcAccessibilityPlugin(); $plugin->run(); } run_accessibility_plugin();