| 1 |
<?php |
| 2 |
ob_start(); |
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link https://www.if-so.com/ |
| 12 |
* @since 1.0.0 |
| 13 |
* @package IfSo |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: If-So |
| 17 |
* Plugin URI: https://www.if-so.com/?utm_source=Plugin&utm_medium=PluginsPage&utm_campaign=pluginURI |
| 18 |
* Description: Display different content to different visitors. Simple to use, just select a condition and set content accordingly. |
| 19 |
* Version: 1.10 |
| 20 |
* Author: If So Plugin |
| 21 |
* Author URI: https://www.if-so.com/?utm_source=Plugin&utm_medium=PluginsPage&utm_campaign=authorURI |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: if-so |
| 25 |
* Domain Path: /languages |
| 26 |
*/ |
| 27 |
// If this file is called directly, abort. |
| 28 |
if ( ! defined( 'WPINC' ) ) { |
| 29 |
die; |
| 30 |
} |
| 31 |
/** |
| 32 |
* The code that runs during plugin activation. |
| 33 |
* This action is documented in includes/class-if-so-activator.php |
| 34 |
*/ |
| 35 |
function activate_if_so() { |
| 36 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-if-so-activator.php'; |
| 37 |
If_So_Activator::activate(); |
| 38 |
create_ifso_tables(); |
| 39 |
} |
| 40 |
/** |
| 41 |
* The code that runs during plugin deactivation. |
| 42 |
* This action is documented in includes/class-if-so-deactivator.php |
| 43 |
*/ |
| 44 |
function deactivate_if_so() { |
| 45 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-if-so-deactivator.php'; |
| 46 |
If_So_Deactivator::deactivate(); |
| 47 |
} |
| 48 |
function uninstall_if_so() { |
| 49 |
//Actual uninstall routine is located in uninstall.php |
| 50 |
//require_once plugin_dir_path( __FILE__ ) . 'includes/class-if-so-uninstall.php'; |
| 51 |
//If_So_Uninstall::uninstall(); |
| 52 |
} |
| 53 |
function create_ifso_tables() { |
| 54 |
require_once plugin_dir_path( __FILE__ ) . 'extensions/ifso-tables/ifso-table-creator.php'; |
| 55 |
} |
| 56 |
register_activation_hook( __FILE__, 'activate_if_so' ); |
| 57 |
register_deactivation_hook( __FILE__, 'deactivate_if_so' ); |
| 58 |
register_uninstall_hook(__FILE__, 'uninstall_if_so'); |
| 59 |
/** |
| 60 |
* The core plugin class that is used to define internationalization, |
| 61 |
* admin-specific hooks, and public-facing site hooks. |
| 62 |
*/ |
| 63 |
require plugin_dir_path( __FILE__ ) . 'includes/class-if-so.php'; |
| 64 |
/** |
| 65 |
* Begins execution of the plugin. |
| 66 |
* |
| 67 |
* Since everything within the plugin is registered via hooks, |
| 68 |
* then kicking off the plugin from this point in the file does |
| 69 |
* not affect the page life cycle. |
| 70 |
* |
| 71 |
* @since 1.0.0 |
| 72 |
*/ |
| 73 |
function run_if_so_plugin() { |
| 74 |
$plugin = new If_So(); |
| 75 |
$plugin->run(); |
| 76 |
} |
| 77 |
run_if_so_plugin(); |
| 78 |
// wrap function for do_shortcode |
| 79 |
function ifso($id,$atts=null,$return=false) { |
| 80 |
$atts_str = ''; |
| 81 |
if(!empty($atts) && is_array($atts)){ |
| 82 |
foreach ($atts as $key=>$val){ |
| 83 |
$atts_str.= "{$key}='{$val}' "; |
| 84 |
} |
| 85 |
} |
| 86 |
$shortcode = sprintf( '[ifso id="%1$d" %2$s]', $id,$atts_str); |
| 87 |
|
| 88 |
if($return) |
| 89 |
return $shortcode; |
| 90 |
else |
| 91 |
echo do_shortcode($shortcode); |
| 92 |
} |
| 93 |
//Create If-So tables |
| 94 |
register_activation_hook( __FILE__, 'ifso_jal_install' ); |
| 95 |
|
| 96 |
|