pojo-accessibility
Last commit date
assets
10 years ago
includes
10 years ago
languages
10 years ago
pojo-accessibility.php
10 years ago
readme.txt
10 years ago
screenshot-1.png
10 years ago
screenshot-2.png
10 years ago
screenshot-3.png
10 years ago
wpml-config.xml
10 years ago
pojo-accessibility.php
118 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Pojo Accessibility |
| 4 | Plugin URI: http://pojo.me/ |
| 5 | Description: This plugin implements the accessibility tools for themes by Pojo Framework |
| 6 | Author: Pojo Team |
| 7 | Author URI: http://pojo.me/ |
| 8 | Version: 1.0.3 |
| 9 | Text Domain: pojo-accessibility |
| 10 | Domain Path: /languages/ |
| 11 | */ |
| 12 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 13 | |
| 14 | define( 'POJO_A11Y__FILE__', __FILE__ ); |
| 15 | define( 'POJO_A11Y_BASE', plugin_basename( POJO_A11Y__FILE__ ) ); |
| 16 | define( 'POJO_A11Y_URL', plugins_url( '/', POJO_A11Y__FILE__ ) ); |
| 17 | define( 'POJO_A11Y_ASSETS_PATH', plugin_dir_path( POJO_A11Y__FILE__ ) . 'assets/' ); |
| 18 | define( 'POJO_A11Y_ASSETS_URL', POJO_A11Y_URL . 'assets/' ); |
| 19 | |
| 20 | final class Pojo_Accessibility { |
| 21 | |
| 22 | /** |
| 23 | * @var Pojo_Accessibility The one true Pojo_Accessibility |
| 24 | * @since 1.0.0 |
| 25 | */ |
| 26 | private static $_instance = null; |
| 27 | |
| 28 | /** |
| 29 | * @var Pojo_A11y_Frontend |
| 30 | */ |
| 31 | public $frontend; |
| 32 | |
| 33 | /** |
| 34 | * @var Pojo_A11y_Customizer |
| 35 | */ |
| 36 | public $customizer; |
| 37 | |
| 38 | public function load_textdomain() { |
| 39 | load_plugin_textdomain( 'pojo-accessibility', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Throw error on object clone |
| 44 | * |
| 45 | * The whole idea of the singleton design pattern is that there is a single |
| 46 | * object therefore, we don't want the object to be cloned. |
| 47 | * |
| 48 | * @since 1.0.0 |
| 49 | * @return void |
| 50 | */ |
| 51 | public function __clone() { |
| 52 | // Cloning instances of the class is forbidden |
| 53 | _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'pojo-accessibility' ), '1.0.0' ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Disable unserializing of the class |
| 58 | * |
| 59 | * @since 1.0.0 |
| 60 | * @return void |
| 61 | */ |
| 62 | public function __wakeup() { |
| 63 | // Unserializing instances of the class is forbidden |
| 64 | _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'pojo-accessibility' ), '1.0.0' ); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @return Pojo_Accessibility |
| 69 | */ |
| 70 | public static function instance() { |
| 71 | if ( is_null( self::$_instance ) ) { |
| 72 | self::$_instance = new self(); |
| 73 | } |
| 74 | return self::$_instance; |
| 75 | } |
| 76 | |
| 77 | public function include_settings() { |
| 78 | include( 'includes/pojo-a11y-settings.php' ); |
| 79 | new Pojo_A11y_Settings( 110 ); |
| 80 | } |
| 81 | |
| 82 | public function admin_notices() { |
| 83 | echo '<div class="error"><p>' . sprintf( __( '<a href="%s" target="_blank">Pojo Theme</a> is not active. Please activate any theme by Pojo.me before you are using "Pojo Accessibility" plugin.', 'pojo-accessibility' ), 'http://pojo.me/' ) . '</p></div>'; |
| 84 | } |
| 85 | |
| 86 | public function print_update_error() { |
| 87 | echo '<div class="error"><p>' . sprintf( __( 'The Pojo Accessibility is not supported by this version of %s. Please <a href="%s">upgrade the theme to its latest version</a>.', 'pojo-accessibility' ), Pojo_Core::instance()->licenses->updater->theme_name, admin_url( 'update-core.php' ) ) . '</p></div>'; |
| 88 | } |
| 89 | |
| 90 | public function bootstrap() { |
| 91 | // This plugin for Pojo Themes.. |
| 92 | if ( ! class_exists( 'Pojo_Core' ) ) { |
| 93 | add_action( 'admin_notices', array( &$this, 'admin_notices' ) ); |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | if ( version_compare( '1.5.4', Pojo_Core::instance()->get_version(), '>' ) ) { |
| 98 | add_action( 'admin_notices', array( &$this, 'print_update_error' ) ); |
| 99 | return; |
| 100 | } |
| 101 | |
| 102 | include( 'includes/pojo-a11y-frontend.php' ); |
| 103 | include( 'includes/pojo-a11y-customizer.php' ); |
| 104 | |
| 105 | $this->frontend = new Pojo_A11y_Frontend(); |
| 106 | $this->customizer = new Pojo_A11y_Customizer(); |
| 107 | |
| 108 | add_action( 'pojo_framework_base_settings_included', array( &$this, 'include_settings' ) ); |
| 109 | } |
| 110 | |
| 111 | private function __construct() { |
| 112 | add_action( 'init', array( &$this, 'bootstrap' ) ); |
| 113 | add_action( 'plugins_loaded', array( &$this, 'load_textdomain' ) ); |
| 114 | } |
| 115 | |
| 116 | } |
| 117 | |
| 118 | Pojo_Accessibility::instance(); |