| 1 |
<?php |
| 2 |
|
| 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://ays-pro.com/wordpress/survey-maker |
| 12 |
* @since 1.0.0 |
| 13 |
* @package Survey_Maker |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: Survey Maker |
| 17 |
* Plugin URI: https://ays-pro.com/wordpress/survey-maker |
| 18 |
* Description: Survey Maker plugin allows you to create unlimited surveys with unlimited sections and unlimited questions. |
| 19 |
* Version: 1.0.0 |
| 20 |
* Author: Survey Maker team |
| 21 |
* Author URI: https://ays-pro.com/ |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: survey-maker |
| 25 |
* Domain Path: /languages |
| 26 |
*/ |
| 27 |
|
| 28 |
// If this file is called directly, abort. |
| 29 |
if ( ! defined( 'WPINC' ) ) { |
| 30 |
die; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Currently plugin version. |
| 35 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 36 |
* Rename this for your plugin and update it as you release new versions. |
| 37 |
*/ |
| 38 |
define( 'SURVEY_MAKER_VERSION', '1.0.0' ); |
| 39 |
define( 'SURVEY_MAKER_NAME_VERSION', '1.0.0' ); |
| 40 |
define( 'SURVEY_MAKER_NAME', 'survey-maker' ); |
| 41 |
define( 'SURVEY_MAKER_DB_PREFIX', 'ayssurvey_' ); |
| 42 |
|
| 43 |
if( ! defined( 'SURVEY_MAKER_BASENAME' ) ) |
| 44 |
define( 'SURVEY_MAKER_BASENAME', plugin_basename( __FILE__ ) ); |
| 45 |
|
| 46 |
if( ! defined( 'SURVEY_MAKER_DIR' ) ) |
| 47 |
define( 'SURVEY_MAKER_DIR', plugin_dir_path( __FILE__ ) ); |
| 48 |
|
| 49 |
if( ! defined( 'SURVEY_MAKER_BASE_URL' ) ) |
| 50 |
define( 'SURVEY_MAKER_BASE_URL', plugin_dir_url(__FILE__ ) ); |
| 51 |
|
| 52 |
if( ! defined( 'SURVEY_MAKER_ADMIN_PATH' ) ) |
| 53 |
define( 'SURVEY_MAKER_ADMIN_PATH', plugin_dir_path( __FILE__ ) . 'admin' ); |
| 54 |
|
| 55 |
if( ! defined( 'SURVEY_MAKER_ADMIN_URL' ) ) |
| 56 |
define( 'SURVEY_MAKER_ADMIN_URL', plugin_dir_url( __FILE__ ) . 'admin' ); |
| 57 |
|
| 58 |
if( ! defined( 'SURVEY_MAKER_PUBLIC_PATH' ) ) |
| 59 |
define( 'SURVEY_MAKER_PUBLIC_PATH', plugin_dir_path( __FILE__ ) . 'public' ); |
| 60 |
|
| 61 |
if( ! defined( 'SURVEY_MAKER_PUBLIC_URL' ) ) |
| 62 |
define( 'SURVEY_MAKER_PUBLIC_URL', plugin_dir_url( __FILE__ ) . 'public' ); |
| 63 |
|
| 64 |
/** |
| 65 |
* The code that runs during plugin activation. |
| 66 |
* This action is documented in includes/class-survey-maker-activator.php |
| 67 |
*/ |
| 68 |
function activate_survey_maker() { |
| 69 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-survey-maker-activator.php'; |
| 70 |
Survey_Maker_Activator::ays_survey_update_db_check(); |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* The code that runs during plugin deactivation. |
| 75 |
* This action is documented in includes/class-survey-maker-deactivator.php |
| 76 |
*/ |
| 77 |
function deactivate_survey_maker() { |
| 78 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-survey-maker-deactivator.php'; |
| 79 |
Survey_Maker_Deactivator::deactivate(); |
| 80 |
} |
| 81 |
|
| 82 |
register_activation_hook( __FILE__, 'activate_survey_maker' ); |
| 83 |
register_deactivation_hook( __FILE__, 'deactivate_survey_maker' ); |
| 84 |
|
| 85 |
add_action( 'plugins_loaded', 'activate_survey_maker' ); |
| 86 |
|
| 87 |
/** |
| 88 |
* The core plugin class that is used to define internationalization, |
| 89 |
* admin-specific hooks, and public-facing site hooks. |
| 90 |
*/ |
| 91 |
require plugin_dir_path( __FILE__ ) . 'includes/class-survey-maker.php'; |
| 92 |
|
| 93 |
/** |
| 94 |
* Begins execution of the plugin. |
| 95 |
* |
| 96 |
* Since everything within the plugin is registered via hooks, |
| 97 |
* then kicking off the plugin from this point in the file does |
| 98 |
* not affect the page life cycle. |
| 99 |
* |
| 100 |
* @since 1.0.0 |
| 101 |
*/ |
| 102 |
function run_survey_maker() { |
| 103 |
|
| 104 |
// add_action( 'activated_plugin', 'survey_maker_activation_redirect_method' ); |
| 105 |
add_action( 'admin_notices', 'survey_maker_general_admin_notice' ); |
| 106 |
$plugin = new Survey_Maker(); |
| 107 |
$plugin->run(); |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
function survey_maker_activation_redirect_method( $plugin ) { |
| 112 |
if( $plugin == plugin_basename( __FILE__ ) ) { |
| 113 |
exit( wp_redirect( admin_url( 'admin.php?page=' . SURVEY_MAKER_NAME ) ) ); |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
function survey_maker_general_admin_notice(){ |
| 118 |
global $wpdb; |
| 119 |
if ( isset($_GET['page']) && strpos( sanitize_text_field( $_GET['page'] ), SURVEY_MAKER_NAME) !== false ) { |
| 120 |
?> |
| 121 |
<div class="ays-notice-banner"> |
| 122 |
<div class="navigation-bar"> |
| 123 |
<div id="navigation-container"> |
| 124 |
<a class="logo-container" href="https://ays-pro.com/" target="_blank"> |
| 125 |
<img class="logo" src="<?php echo SURVEY_MAKER_ADMIN_URL . '/images/ays_pro.png'; ?>" alt="AYS Pro logo" title="AYS Pro logo"/> |
| 126 |
</a> |
| 127 |
<ul id="menu"> |
| 128 |
<li class="modile-ddmenu-lg"><a class="ays-btn" href="https://ays-pro.com/wordpress-survey-maker-user-manual" target="_blank">Documentation</a></li> |
| 129 |
<li class="modile-ddmenu-xs"><a class="ays-btn" href="https://wordpress.org/support/plugin/survey-maker/reviews/" target="_blank">Rate Us</a></li> |
| 130 |
<li class="modile-ddmenu-lg"><a class="ays-btn" href="https://freedemo.ays-pro.com/survey-maker-demo-free/" target="_blank">Demo</a></li> |
| 131 |
<li class="modile-ddmenu-lg"><a class="ays-btn" href="https://ays-pro.com/contact" target="_blank">Contact us</a></li> |
| 132 |
<li class="modile-ddmenu-md"> |
| 133 |
<a class="toggle_ddmenu" href="javascript:void(0);"><i class="ays_fa ays_fa_ellipsis_h"></i></a> |
| 134 |
<ul class="ddmenu" data-expanded="false"> |
| 135 |
<li><a class="ays-btn" href="https://ays-pro.com/wordpress-survey-maker-user-manual" target="_blank">Documentation</a></li> |
| 136 |
<li><a class="ays-btn" href="https://wordpress.org/support/plugin/survey-maker/reviews/" target="_blank">Rate Us</a></li> |
| 137 |
<li><a class="ays-btn" href="https://freedemo.ays-pro.com/survey-maker-demo-free/" target="_blank">Demo</a></li> |
| 138 |
<li><a class="ays-btn" href="https://ays-pro.com/contact" target="_blank">Contact us</a></li> |
| 139 |
</ul> |
| 140 |
</li> |
| 141 |
<li class="modile-ddmenu-sm"> |
| 142 |
<a class="toggle_ddmenu" href="javascript:void(0);"><i class="ays_fa ays_fa_ellipsis_h"></i></a> |
| 143 |
<ul class="ddmenu" data-expanded="false"> |
| 144 |
<li><a class="ays-btn" href="https://ays-pro.com/wordpress-survey-maker-user-manual" target="_blank">Documentation</a></li> |
| 145 |
<li><a class="ays-btn" href="https://wordpress.org/support/plugin/survey-maker/reviews/" target="_blank">Rate Us</a></li> |
| 146 |
<li><a class="ays-btn" href="https://freedemo.ays-pro.com/survey-maker-demo-free/" target="_blank">Demo</a></li> |
| 147 |
<li><a class="ays-btn" href="https://ays-pro.com/contact" target="_blank">Contact us</a></li> |
| 148 |
</ul> |
| 149 |
</li> |
| 150 |
</ul> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
</div> |
| 154 |
<?php |
| 155 |
} |
| 156 |
} |
| 157 |
|
| 158 |
run_survey_maker(); |
| 159 |
|