| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: SocialFeeds |
| 4 |
Plugin URI: https://socialfeeds.org |
| 5 |
Description: YouTube feeds for WordPress with simple Setup and Settings options. |
| 6 |
Version: 1.0.6 |
| 7 |
Author: Softaculous Team |
| 8 |
Author URI: https://softaculous.com/ |
| 9 |
Text Domain: socialfeeds |
| 10 |
License: GPLv2 |
| 11 |
*/ |
| 12 |
|
| 13 |
if(!defined('ABSPATH')){ |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
if(!function_exists('add_action')){ |
| 18 |
echo 'You are not allowed to access this page directly.'; |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
//SOCIALFEEDS |
| 23 |
define('SOCIALFEEDS_VERSION', '1.0.6'); |
| 24 |
define('SOCIALFEEDS_FILE', __FILE__); |
| 25 |
define('SOCIALFEEDS_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 26 |
define('SOCIALFEEDS_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 27 |
define('SOCIALFEEDS_ASSETS_URL', SOCIALFEEDS_PLUGIN_URL . 'assets'); |
| 28 |
|
| 29 |
function socialfeeds_autoloader($class){ |
| 30 |
if(!preg_match('/^SocialFeeds\\\(.*)/is', $class, $m)){ |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
$m[1] = str_replace('\\', '/', $m[1]); |
| 35 |
|
| 36 |
// Include file |
| 37 |
if(file_exists(SOCIALFEEDS_PLUGIN_DIR . 'main/'.strtolower($m[1]).'.php')){ |
| 38 |
include_once(SOCIALFEEDS_PLUGIN_DIR.'main/'.strtolower($m[1]).'.php'); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
spl_autoload_register('socialfeeds_autoloader'); |
| 43 |
register_activation_hook(SOCIALFEEDS_FILE, '\SocialFeeds\Install::activate'); |
| 44 |
register_deactivation_hook(SOCIALFEEDS_FILE, '\SocialFeeds\Install::deactivate'); |
| 45 |
register_uninstall_hook(SOCIALFEEDS_FILE, '\SocialFeeds\Install::uninstall'); |
| 46 |
add_action('plugins_loaded', 'socialfeeds_load_plugin'); |
| 47 |
|
| 48 |
/** |
| 49 |
* Initialize plugin on plugins_loaded hook |
| 50 |
*/ |
| 51 |
function socialfeeds_load_plugin(){ |
| 52 |
global $socialfeeds; |
| 53 |
|
| 54 |
if(empty($socialfeeds)){ |
| 55 |
$socialfeeds = new stdClass(); |
| 56 |
} |
| 57 |
|
| 58 |
//load all the options |
| 59 |
$socialfeeds->youtube_settings = get_option('socialfeeds_youtube_option', []); |
| 60 |
|
| 61 |
if(wp_doing_ajax()){ |
| 62 |
\SocialFeeds\Ajax::hooks(); |
| 63 |
} |
| 64 |
|
| 65 |
\SocialFeeds\Shortcodes::init(); |
| 66 |
|
| 67 |
if(is_admin()){ |
| 68 |
\SocialFeeds\Admin::init(); |
| 69 |
return; |
| 70 |
} |
| 71 |
|
| 72 |
if(!is_admin()){ |
| 73 |
add_action('wp_enqueue_scripts', '\SocialFeeds\Loader::enqueue_frontend_assets'); |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|