| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: ShareMyPost |
| 4 |
Plugin URI: https://sharemypost.net |
| 5 |
Description: A lightweight WordPress social sharing plugin with inline share bars and advanced customization. |
| 6 |
Version: 1.0.6 |
| 7 |
Author: Softaculous Team |
| 8 |
Author URI: https://softaculous.com/ |
| 9 |
Text Domain: sharemypost |
| 10 |
License: GPLv2 |
| 11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 12 |
*/ |
| 13 |
|
| 14 |
if(!defined('ABSPATH')){ |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
if(!function_exists('add_action')){ |
| 19 |
echo 'You are not allowed to access this page directly.'; |
| 20 |
exit; |
| 21 |
} |
| 22 |
|
| 23 |
// SHAREMYPOST |
| 24 |
define('SHAREMYPOST_VERSION', '1.0.6'); |
| 25 |
define('SHAREMYPOST_FILE', __FILE__); |
| 26 |
define('SHAREMYPOST_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 27 |
define('SHAREMYPOST_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 28 |
define('SHAREMYPOST_ASSETS_URL', SHAREMYPOST_PLUGIN_URL . 'assets'); |
| 29 |
|
| 30 |
function sharemypost_autoloader($class){ |
| 31 |
if(!preg_match('/^ShareMyPost\\\(.*)/is', $class, $m)){ |
| 32 |
return; |
| 33 |
} |
| 34 |
|
| 35 |
$m[1] = str_replace('\\', '/', $m[1]); |
| 36 |
|
| 37 |
if(file_exists(SHAREMYPOST_PLUGIN_DIR . 'main/'.strtolower($m[1]).'.php')){ |
| 38 |
include_once(SHAREMYPOST_PLUGIN_DIR.'main/'.strtolower($m[1]).'.php'); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
spl_autoload_register('sharemypost_autoloader'); |
| 43 |
register_activation_hook(SHAREMYPOST_FILE, '\ShareMyPost\Install::activate'); |
| 44 |
register_deactivation_hook(SHAREMYPOST_FILE, '\ShareMyPost\Install::deactivate'); |
| 45 |
register_uninstall_hook(SHAREMYPOST_FILE, '\ShareMyPost\Install::uninstall'); |
| 46 |
add_action('plugins_loaded', 'sharemypost_load_plugin'); |
| 47 |
|
| 48 |
/** |
| 49 |
* Initialize plugin on plugins_loaded hook |
| 50 |
*/ |
| 51 |
function sharemypost_load_plugin() { |
| 52 |
global $sharemypost; |
| 53 |
|
| 54 |
if(empty($sharemypost)){ |
| 55 |
$sharemypost = new stdClass(); |
| 56 |
} |
| 57 |
|
| 58 |
if(is_admin()){ |
| 59 |
\ShareMyPost\Admin::init(); |
| 60 |
return; |
| 61 |
} |
| 62 |
|
| 63 |
add_action('wp_enqueue_scripts', 'ShareMyPost\Helpers::enqueue_frontend_assets'); |
| 64 |
add_filter('the_content', '\ShareMyPost\Helpers::append_sharebar'); |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|