| 1 |
<?php |
| 2 |
/** |
| 3 |
* Free Assets Library Plugin. |
| 4 |
* |
| 5 |
* @package FAL |
| 6 |
* @copyright Copyright (C) 2014-2022, Surror - admin@surror.com |
| 7 |
* @link https://surror.com |
| 8 |
* @since 2.0.0 |
| 9 |
* |
| 10 |
* @wordpress-plugin |
| 11 |
* Plugin Name: Free Assets Library |
| 12 |
* Version: 2.2.0 |
| 13 |
* Plugin URI: https://surror.com/free-asset-library/ |
| 14 |
* Description: Stunning free images from Openverse, Pixabay for your own blog. Find suitable image as per your need from the millions royalty free images library. |
| 15 |
* Author: Surror |
| 16 |
* Author URI: https://surror.com/ |
| 17 |
* License: GPL v3 |
| 18 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 19 |
* Text Domain: fal |
| 20 |
* Domain Path: /languages |
| 21 |
*/ |
| 22 |
|
| 23 |
defined( 'ABSPATH' ) || exit; |
| 24 |
|
| 25 |
/** |
| 26 |
* FAL class. |
| 27 |
* |
| 28 |
* @class Main class of the plugin. |
| 29 |
*/ |
| 30 |
final class FAL { |
| 31 |
|
| 32 |
/** |
| 33 |
* Plugin version. |
| 34 |
* |
| 35 |
* @var string |
| 36 |
*/ |
| 37 |
public $version = '2.2.0'; |
| 38 |
|
| 39 |
/** |
| 40 |
* Hold install error messages. |
| 41 |
* |
| 42 |
* @var bool |
| 43 |
*/ |
| 44 |
private $messages = []; |
| 45 |
|
| 46 |
/** |
| 47 |
* The single instance of the class. |
| 48 |
* |
| 49 |
* @var FAL |
| 50 |
*/ |
| 51 |
protected static $instance = null; |
| 52 |
|
| 53 |
/** |
| 54 |
* Retrieve main FAL instance. |
| 55 |
* |
| 56 |
* Ensure only one instance is loaded or can be loaded. |
| 57 |
* |
| 58 |
* @see fal() |
| 59 |
* @return FAL |
| 60 |
*/ |
| 61 |
public static function get() { |
| 62 |
if ( is_null( self::$instance ) && ! ( self::$instance instanceof FAL ) ) { |
| 63 |
self::$instance = new FAL(); |
| 64 |
self::$instance->setup(); |
| 65 |
} |
| 66 |
|
| 67 |
return self::$instance; |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Instantiate the plugin. |
| 72 |
*/ |
| 73 |
private function setup() { |
| 74 |
// Define plugin constants. |
| 75 |
$this->define_constants(); |
| 76 |
|
| 77 |
// Include required files. |
| 78 |
$this->includes(); |
| 79 |
|
| 80 |
// Instantiate classes. |
| 81 |
$this->instantiate(); |
| 82 |
|
| 83 |
// Loaded action. |
| 84 |
do_action( 'fal/loaded' ); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Define the plugin constants. |
| 89 |
*/ |
| 90 |
private function define_constants() { |
| 91 |
define( 'FAL_VERSION', $this->version ); |
| 92 |
define( 'FAL_FILE', __FILE__ ); |
| 93 |
define( 'FAL_BASE', plugin_basename( FAL_FILE ) ); |
| 94 |
define( 'FAL_DIR', plugin_dir_path( FAL_FILE ) ); |
| 95 |
define( 'FAL_URI', plugins_url( '/', FAL_FILE ) ); |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Include the required files. |
| 100 |
*/ |
| 101 |
private function includes() { |
| 102 |
include dirname( __FILE__ ) . '/vendor/autoload.php'; |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Instantiate classes. |
| 107 |
*/ |
| 108 |
private function instantiate() { |
| 109 |
new \FAL\Page(); |
| 110 |
new \FAL\RestAPI(); |
| 111 |
new \FAL\Track(); |
| 112 |
new \FAL\Media_Popup(); |
| 113 |
|
| 114 |
new \FAL\Surror\Dashboard(); |
| 115 |
} |
| 116 |
|
| 117 |
} |
| 118 |
|
| 119 |
/** |
| 120 |
* Returns the main instance of FAL to prevent the need to use globals. |
| 121 |
* |
| 122 |
* @return FAL |
| 123 |
*/ |
| 124 |
function fal() { |
| 125 |
return FAL::get(); |
| 126 |
} |
| 127 |
|
| 128 |
// Start it. |
| 129 |
fal(); |
| 130 |
|