| @@ -1,0 +1,161 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Plugin Name: GamiPress - Vimeo integration | |
| 4 | + * Plugin URI: https://wordpress.org/plugins/gamipress-vimeo-integration | |
| 5 | + * Description: Connect GamiPress with Vimeo. | |
| 6 | + * Version: 1.0.9 | |
| 7 | + * Author: GamiPress | |
| 8 | + * Author URI: https://gamipress.com/ | |
| 9 | + * Text Domain: gamipress-vimeo-integration | |
| 10 | + * Domain Path: /languages/ | |
| 11 | + * Requires at least: 4.4 | |
| 12 | + * Tested up to: 6.1 | |
| 13 | + * License: GNU AGPL v3.0 (http://www.gnu.org/licenses/agpl.txt) | |
| 14 | + * | |
| 15 | + * @package GamiPress\Vimeo | |
| 16 | + * @author GamiPress | |
| 17 | + * @copyright Copyright (c) GamiPress | |
| 18 | + */ | |
| 19 | + | |
| 20 | +final class GamiPress_Integration_Vimeo { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * @var GamiPress_Integration_Vimeo $instance The one true GamiPress_Integration_Vimeo | |
| 24 | + * @since 1.0.0 | |
| 25 | + */ | |
| 26 | + private static $instance; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * Get active instance | |
| 30 | + * | |
| 31 | + * @access public | |
| 32 | + * @since 1.0.0 | |
| 33 | + * @return object self::$instance The one true GamiPress_Integration_Vimeo | |
| 34 | + */ | |
| 35 | + public static function instance() { | |
| 36 | + | |
| 37 | + if( !self::$instance ) { | |
| 38 | + | |
| 39 | + self::$instance = new GamiPress_Integration_Vimeo(); | |
| 40 | + self::$instance->constants(); | |
| 41 | + self::$instance->includes(); | |
| 42 | + self::$instance->hooks(); | |
| 43 | + | |
| 44 | + | |
| 45 | + } | |
| 46 | + | |
| 47 | + return self::$instance; | |
| 48 | + } | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * Setup plugin constants | |
| 52 | + * | |
| 53 | + * @access private | |
| 54 | + * @since 1.0.0 | |
| 55 | + * @return void | |
| 56 | + */ | |
| 57 | + private function constants() { | |
| 58 | + | |
| 59 | + // Plugin version | |
| 60 | + define( 'GAMIPRESS_VIMEO_VER', '1.0.9' ); | |
| 61 | + | |
| 62 | + // Plugin file | |
| 63 | + define( 'GAMIPRESS_VIMEO_FILE', __FILE__ ); | |
| 64 | + | |
| 65 | + // Plugin path | |
| 66 | + define( 'GAMIPRESS_VIMEO_DIR', plugin_dir_path( __FILE__ ) ); | |
| 67 | + | |
| 68 | + // Plugin URL | |
| 69 | + define( 'GAMIPRESS_VIMEO_URL', plugin_dir_url( __FILE__ ) ); | |
| 70 | + } | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * Include plugin files | |
| 74 | + * | |
| 75 | + * @access private | |
| 76 | + * @since 1.0.0 | |
| 77 | + * @return void | |
| 78 | + */ | |
| 79 | + private function includes() { | |
| 80 | + | |
| 81 | + if( $this->meets_requirements() ) { | |
| 82 | + | |
| 83 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/admin.php'; | |
| 84 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/functions.php'; | |
| 85 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/listeners.php'; | |
| 86 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/requirements.php'; | |
| 87 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/rules-engine.php'; | |
| 88 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/scripts.php'; | |
| 89 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/shortcodes.php'; | |
| 90 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/triggers.php'; | |
| 91 | + require_once GAMIPRESS_VIMEO_DIR . 'includes/widgets.php'; | |
| 92 | + | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Setup plugin hooks | |
| 98 | + * | |
| 99 | + * @access private | |
| 100 | + * @since 1.0.0 | |
| 101 | + * @return void | |
| 102 | + */ | |
| 103 | + private function hooks() { | |
| 104 | + // Setup our activation and deactivation hooks | |
| 105 | + register_activation_hook( __FILE__, array( $this, 'activate' ) ); | |
| 106 | + register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); | |
| 107 | + | |
| 108 | + | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * Activation hook for the plugin. | |
| 113 | + * | |
| 114 | + * @since 1.0.0 | |
| 115 | + */ | |
| 116 | + function activate() { | |
| 117 | + | |
| 118 | + if( $this->meets_requirements() ) { | |
| 119 | + | |
| 120 | + } | |
| 121 | + | |
| 122 | + } | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * Deactivation hook for the plugin. | |
| 126 | + * | |
| 127 | + * @since 1.0.0 | |
| 128 | + */ | |
| 129 | + function deactivate() { | |
| 130 | + | |
| 131 | + } | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * Check if there are all plugin requirements | |
| 135 | + * | |
| 136 | + * @since 1.0.0 | |
| 137 | + * | |
| 138 | + * @return bool True if installation meets all requirements | |
| 139 | + */ | |
| 140 | + private function meets_requirements() { | |
| 141 | + | |
| 142 | + if ( ! class_exists( 'GamiPress' ) ) { | |
| 143 | + return false; | |
| 144 | + } | |
| 145 | + | |
| 146 | + return true; | |
| 147 | + | |
| 148 | + } | |
| 149 | + | |
| 150 | +} | |
| 151 | + | |
| 152 | +/** | |
| 153 | + * The main function responsible for returning the one true GamiPress_Integration_Vimeo instance to functions everywhere | |
| 154 | + * | |
| 155 | + * @since 1.0.0 | |
| 156 | + * @return \GamiPress_Integration_Vimeo The one true GamiPress_Integration_Vimeo | |
| 157 | + */ | |
| 158 | +function GamiPress_Integration_Vimeo() { | |
| 159 | + return GamiPress_Integration_Vimeo::instance(); | |
| 160 | +} | |
| 161 | +add_action( 'gamipress_pre_init', 'GamiPress_Integration_Vimeo' ); | |