Changeset 2717163
- Timestamp:
- 05/02/2022 01:31:18 PM (4 years ago)
- Location:
- jomres/trunk
- Files:
-
- 3 edited
-
includes/jomres-activator.php (modified) (1 diff)
-
jomres.php (modified) (1 diff)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
jomres/trunk/includes/jomres-activator.php
r2311685 r2717163 29 29 */ 30 30 public static function activate() { 31 if ( version_compare( PHP_VERSION, '7. 1', '<' ) )31 if ( version_compare( PHP_VERSION, '7.4', '<' ) ) 32 32 { 33 exit( sprintf( 'Jomres requires PHP 7. 1or higher. You’re still on %s.', PHP_VERSION ) );33 exit( sprintf( 'Jomres requires PHP 7.4 or higher. You’re still on %s.', PHP_VERSION ) ); 34 34 } 35 35 -
jomres/trunk/jomres.php
r2716398 r2717163 1 1 <?php 2 2 3 /**4 * The plugin bootstrap file5 *6 * This file is read by WordPress to generate the plugin information in the plugin7 * admin area. This file also includes all of the dependencies used by the plugin,8 * registers the activation and deactivation functions, and defines a function9 * that starts the plugin.10 *11 * @link https://www.jomres.net12 * @since 9.9.1913 * @package Jomres\Core\CMS_Specific14 *15 * @wordpress-plugin16 * Plugin Name: Jomres17 * Plugin URI: https://www.jomres.net18 * Description: The complete online booking and property management solution for WordPress.19 * Version: 10.3.0 20 * Author: Vince Wooll <support@jomres.net>21 * Author URI: https://www.jomres.net22 * License: GPL-2.0+23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt24 * Text Domain: jomres25 * Domain Path: /languages26 */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.jomres.net 12 * @since 9.9.19 13 * @package Jomres\Core\CMS_Specific 14 * 15 * @wordpress-plugin 16 * Plugin Name: Jomres 17 * Plugin URI: https://www.jomres.net 18 * Description: The complete online booking and property management solution for WordPress. 19 * Version: 10.3.1 20 * Author: Vince Wooll <support@jomres.net> 21 * Author URI: https://www.jomres.net 22 * License: GPL-2.0+ 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 24 * Text Domain: jomres 25 * Domain Path: /languages 26 */ 27 27 28 28 // If this file is called directly, abort. 29 if ( ! defined( 'WPINC' ) ) { 30 die; 31 } 32 33 /** 34 * Jomres plugin version. 35 */ 36 if ( ! defined( 'JOMRES_WP_PLUGIN_VERSION' ) ) { 37 define( 'JOMRES_WP_PLUGIN_VERSION', '10.3.0' ); 38 } 39 40 /** 41 * Jomres plugin base path. 42 */ 43 if ( ! defined( 'JOMRES_WP_PLUGIN_PATH' ) ) { 44 define( 'JOMRES_WP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 45 } 46 47 /** 48 * Jomres init check. 49 */ 50 if ( ! defined( '_JOMRES_INITCHECK' ) ) { 51 define( '_JOMRES_INITCHECK', 1 ); 52 } 53 54 /** 55 * Jomres admin init check. 56 */ 57 if ( is_admin() && ! defined( '_JOMRES_INITCHECK_ADMIN' ) ) { 58 define( '_JOMRES_INITCHECK_ADMIN', 1 ); 59 } 60 61 /** 62 * Set path definitions. 63 * 64 * 65 * @since 9.23.6 66 */ 67 if (!function_exists('define_jomres_sub_dir_in_plugins_dir_as_root')) { 68 function define_jomres_sub_dir_in_plugins_dir_as_root() 69 { 70 $jr_root = str_replace( ABSPATH , '' , JOMRES_WP_PLUGIN_PATH ); 71 define( 'JOMRES_ROOT_DIRECTORY', $jr_root.DIRECTORY_SEPARATOR.'jomres' ); 72 define('JOMRESPATH_BASE', JOMRES_WP_PLUGIN_PATH.'jomres'.DIRECTORY_SEPARATOR); 73 define('JRDS', DIRECTORY_SEPARATOR ); 74 } 75 } 76 77 78 /** 79 * Runs Jomres installation or update routine. 80 * 81 * Donwloads Jomres, unzips and runs the jomres install or update 82 * 83 * @since 9.9.19 84 */ 85 if (!function_exists('run_jomres_installer')) { 86 function run_jomres_installer($method = 'install') 87 { 88 89 @ignore_user_abort(true); 90 @set_time_limit(0); 91 92 require_once(ABSPATH . 'wp-admin/includes/file.php'); 93 94 WP_Filesystem(); 95 96 global $wp_filesystem; 97 98 //get the latest jomres version download url 99 $url = 'http://updates.jomres4.net/getlatest.php?includebeta=true'; 100 $nightly_url = 'http://updates.jomres4.net/nightly/'; 101 102 $nightly = false; 103 104 if (WP_DEBUG) { 105 $nightly = true; 106 } elseif (file_exists(ABSPATH . JOMRES_ROOT_DIRECTORY . '/configuration.php')) { 107 include ABSPATH . JOMRES_ROOT_DIRECTORY . '/configuration.php'; 108 109 if ($jrConfig['development_production'] == 'development') { 29 if ( ! defined( 'WPINC' ) ) { 30 die; 31 } 32 33 /** 34 * Jomres plugin version. 35 */ 36 if ( ! defined( 'JOMRES_WP_PLUGIN_VERSION' ) ) { 37 define( 'JOMRES_WP_PLUGIN_VERSION', '10.3.1' ); 38 } 39 40 /** 41 * Jomres plugin base path. 42 */ 43 if ( ! defined( 'JOMRES_WP_PLUGIN_PATH' ) ) { 44 define( 'JOMRES_WP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 45 } 46 47 /** 48 * Jomres init check. 49 */ 50 if ( ! defined( '_JOMRES_INITCHECK' ) ) { 51 define( '_JOMRES_INITCHECK', 1 ); 52 } 53 54 /** 55 * Jomres admin init check. 56 */ 57 if ( is_admin() && ! defined( '_JOMRES_INITCHECK_ADMIN' ) ) { 58 define( '_JOMRES_INITCHECK_ADMIN', 1 ); 59 } 60 61 /** 62 * Set path definitions. 63 * 64 * 65 * @since 9.23.6 66 */ 67 if (!function_exists('define_jomres_sub_dir_in_plugins_dir_as_root')) { 68 function define_jomres_sub_dir_in_plugins_dir_as_root() 69 { 70 $jr_root = str_replace( ABSPATH , '' , JOMRES_WP_PLUGIN_PATH ); 71 define( 'JOMRES_ROOT_DIRECTORY', $jr_root.DIRECTORY_SEPARATOR.'jomres' ); 72 define('JOMRESPATH_BASE', JOMRES_WP_PLUGIN_PATH.'jomres'.DIRECTORY_SEPARATOR); 73 define('JRDS', DIRECTORY_SEPARATOR ); 74 } 75 } 76 77 /** 78 * Set path definitions. 79 * 80 * 81 * @since 10.3.1 82 */ 83 if (!function_exists('define_jomres_off_root_dir_as_root')) { 84 function define_jomres_off_root_dir_as_root() 85 { 86 define( 'JOMRES_ROOT_DIRECTORY', 'jomres' ); 87 define('JOMRESPATH_BASE', ABSPATH.JOMRES_ROOT_DIRECTORY.DIRECTORY_SEPARATOR); 88 define('JRDS', DIRECTORY_SEPARATOR ); 89 } 90 } 91 92 93 /** 94 * Runs Jomres installation or update routine. 95 * 96 * Donwloads Jomres, unzips and runs the jomres install or update 97 * 98 * @since 9.9.19 99 */ 100 if (!function_exists('run_jomres_installer')) { 101 function run_jomres_installer($method = 'install') 102 { 103 104 @ignore_user_abort(true); 105 @set_time_limit(0); 106 107 require_once(ABSPATH . 'wp-admin/includes/file.php'); 108 109 WP_Filesystem(); 110 111 global $wp_filesystem; 112 113 //get the latest jomres version download url 114 $url = 'http://updates.jomres4.net/getlatest.php?includebeta=true'; 115 $nightly_url = 'http://updates.jomres4.net/nightly/'; 116 117 $nightly = false; 118 119 if (WP_DEBUG) { 110 120 $nightly = true; 111 } 112 } 113 114 //download jomres core 115 $response = wp_remote_get($url); 116 117 if (strlen($response['body']) == 0) { 118 jomres_notice('There was an error getting the latest Jomres version number.'); 119 120 return false; 121 } 122 123 //set source and target 124 $source = get_temp_dir() . 'jomres.zip'; 125 $target = ABSPATH . JOMRES_ROOT_DIRECTORY; 126 127 //check if /jomres dir is writable 128 if (!wp_is_writable($target)) { 129 jomres_notice('Jomres dir ' . $target . ' can`t be created or it`s not writable. Using FTP, create the directory manually then re-run the installer, many times this will solve the problem.'); 130 131 return false; 132 } 133 134 //download Jomres 135 $options = array( 136 'timeout' => 300, 137 'stream' => true, 138 'filename' => $source 139 ); 140 141 if (!$nightly) { 142 $response = wp_remote_get($response['body'], $options); 143 } else { 144 $response = wp_remote_get($nightly_url, $options); 145 } 146 147 if (is_wp_error($response)) { 148 jomres_notice('There was an error downloading jomres.zip.'); 149 150 return false; 151 } 152 153 //unzip jomres files 154 $unzipfile = unzip_file($source, $target); 155 156 if (is_wp_error($unzipfile)) { 157 jomres_notice('There was an error unzipping the Jomres files.'); 158 159 return false; 160 } 161 162 //delete downloaded zip 163 if (file_exists($source)) { 164 unlink($source); 165 } 166 167 //install Jomres 168 try { 169 require_once ABSPATH . JOMRES_ROOT_DIRECTORY . '/libraries/jomres/classes/jomres_install.class.php'; 170 171 $jomres_install = new jomres_install($method); 172 173 $messages = $jomres_install->getMessages(); 174 175 //if there are no installation errors, update jomres_wp_plugin_version in db 176 if (empty($messages)) { 177 update_option('jomres_wp_plugin_version', JOMRES_WP_PLUGIN_VERSION); 178 } 179 } catch (Exception $e) { 180 $messages = $jomres_install->getMessages(); 181 182 foreach ($messages as $m) { 183 jomres_notice($m); 184 } 185 186 jomres_notice($e->getMessage()); 187 188 return false; 189 } 190 191 return true; 192 193 } 194 } 195 196 /** 197 * Jomres root directory. 198 */ 199 if ( ! defined( 'JOMRES_ROOT_DIRECTORY' ) ) { 200 if ( file_exists( ABSPATH . 'jomres_root.php' ) ) { 201 require_once ABSPATH . 'jomres_root.php'; 202 } else { 203 if ( file_exists(JOMRES_WP_PLUGIN_PATH.DIRECTORY_SEPARATOR.'jomres'.DIRECTORY_SEPARATOR.'jomres.php') ) { 204 define_jomres_sub_dir_in_plugins_dir_as_root(); 205 } else { 206 if ( !is_dir(JOMRES_WP_PLUGIN_PATH . DIRECTORY_SEPARATOR . 'jomres' . DIRECTORY_SEPARATOR) ) { // Let's see if we can install Jomres in the jomres subdir of wp-content, instead of it's traditional location off root 207 if (mkdir(JOMRES_WP_PLUGIN_PATH . DIRECTORY_SEPARATOR . 'jomres' . DIRECTORY_SEPARATOR)) { 121 } elseif (file_exists(ABSPATH . JOMRES_ROOT_DIRECTORY . '/configuration.php')) { 122 include ABSPATH . JOMRES_ROOT_DIRECTORY . '/configuration.php'; 123 124 if ($jrConfig['development_production'] == 'development') { 125 $nightly = true; 126 } 127 } 128 129 //download jomres core 130 $response = wp_remote_get($url); 131 132 if (strlen($response['body']) == 0) { 133 jomres_notice('There was an error getting the latest Jomres version number.'); 134 135 return false; 136 } 137 138 //set source and target 139 $source = get_temp_dir() . 'jomres.zip'; 140 $target = ABSPATH . JOMRES_ROOT_DIRECTORY; 141 142 //check if /jomres dir is writable 143 if (!wp_is_writable($target)) { 144 jomres_notice('Jomres dir ' . $target . ' can`t be created or it`s not writable. Using FTP, create the directory manually then re-run the installer, many times this will solve the problem.'); 145 146 return false; 147 } 148 149 //download Jomres 150 $options = array( 151 'timeout' => 300, 152 'stream' => true, 153 'filename' => $source 154 ); 155 156 if (!$nightly) { 157 $response = wp_remote_get($response['body'], $options); 158 } else { 159 $response = wp_remote_get($nightly_url, $options); 160 } 161 162 if (is_wp_error($response)) { 163 jomres_notice('There was an error downloading jomres.zip.'); 164 165 return false; 166 } 167 168 //unzip jomres files 169 $unzipfile = unzip_file($source, $target); 170 171 if (is_wp_error($unzipfile)) { 172 jomres_notice('There was an error unzipping the Jomres files. Tried to unzip from '.$source.' to '.$target.''); 173 174 return false; 175 } 176 177 //delete downloaded zip 178 if (file_exists($source)) { 179 unlink($source); 180 } 181 182 //install Jomres 183 try { 184 require_once ABSPATH . JOMRES_ROOT_DIRECTORY . '/libraries/jomres/classes/jomres_install.class.php'; 185 186 $jomres_install = new jomres_install($method); 187 188 $messages = $jomres_install->getMessages(); 189 190 //if there are no installation errors, update jomres_wp_plugin_version in db 191 if (empty($messages)) { 192 update_option('jomres_wp_plugin_version', JOMRES_WP_PLUGIN_VERSION); 193 } 194 } catch (Exception $e) { 195 $messages = $jomres_install->getMessages(); 196 197 foreach ($messages as $m) { 198 jomres_notice($m); 199 } 200 201 jomres_notice($e->getMessage()); 202 203 return false; 204 } 205 206 return true; 207 208 } 209 } 210 211 /** 212 * Jomres root directory. 213 */ 214 if ( ! defined( 'JOMRES_ROOT_DIRECTORY' ) ) { 215 if ( file_exists( ABSPATH . 'jomres_root.php' ) ) { 216 require_once ABSPATH . 'jomres_root.php'; 217 } elseif ( file_exists(ABSPATH.'jomres'.DIRECTORY_SEPARATOR.'configuration.php') ) { 218 define_jomres_off_root_dir_as_root(); 219 } else { 220 if ( file_exists(JOMRES_WP_PLUGIN_PATH.DIRECTORY_SEPARATOR.'jomres'.DIRECTORY_SEPARATOR.'jomres.php') ) { 208 221 define_jomres_sub_dir_in_plugins_dir_as_root(); 209 run_jomres_installer(); 210 } 211 } else { // fallback for updated installations 212 define( 'JOMRES_ROOT_DIRECTORY', 'jomres' ); 213 } 214 } 215 } 216 } 217 218 /** 219 * The Jomres wp plugin functions. 220 */ 221 require_once plugin_dir_path( __FILE__ ) . 'includes/functions.php'; 222 223 /** 224 * Register the activate and deactivate callbacks. 225 */ 226 register_activation_hook( __FILE__, 'activate_jomres' ); 227 register_deactivation_hook( __FILE__, 'deactivate_jomres' ); 228 229 /** 230 * The core plugin class that is used to define internationalization, 231 * admin-specific hooks, and public-facing site hooks. 232 */ 233 require_once plugin_dir_path( __FILE__ ) . 'includes/jomres.php'; 234 235 /** 236 * Begins Jomres execution. 237 * 238 * Since everything within the plugin is registered via hooks, 239 * then kicking off the plugin from this point in the file does 240 * not affect the page life cycle. 241 * 242 * @since 9.9.19 243 */ 244 run_jomres(); 222 } else { 223 if ( !is_dir(JOMRES_WP_PLUGIN_PATH . DIRECTORY_SEPARATOR . 'jomres' . DIRECTORY_SEPARATOR) ) { // Let's see if we can install Jomres in the jomres subdir of wp-content, instead of it's traditional location off root 224 if (mkdir(JOMRES_WP_PLUGIN_PATH . DIRECTORY_SEPARATOR . 'jomres' . DIRECTORY_SEPARATOR)) { 225 define_jomres_sub_dir_in_plugins_dir_as_root(); 226 run_jomres_installer(); 227 } 228 } else { // fallback for updated installations 229 define( 'JOMRES_ROOT_DIRECTORY', 'jomres' ); 230 } 231 } 232 } 233 } 234 235 /** 236 * The Jomres wp plugin functions. 237 */ 238 require_once plugin_dir_path( __FILE__ ) . 'includes/functions.php'; 239 240 /** 241 * Register the activate and deactivate callbacks. 242 */ 243 register_activation_hook( __FILE__, 'activate_jomres' ); 244 register_deactivation_hook( __FILE__, 'deactivate_jomres' ); 245 246 /** 247 * The core plugin class that is used to define internationalization, 248 * admin-specific hooks, and public-facing site hooks. 249 */ 250 require_once plugin_dir_path( __FILE__ ) . 'includes/jomres.php'; 251 252 /** 253 * Begins Jomres execution. 254 * 255 * Since everything within the plugin is registered via hooks, 256 * then kicking off the plugin from this point in the file does 257 * not affect the page life cycle. 258 * 259 * @since 9.9.19 260 */ 261 run_jomres(); -
jomres/trunk/uninstall.php
r2309296 r2717163 33 33 require_once ABSPATH . 'jomres_root.php'; 34 34 } else { 35 define ( 'JOMRES_ROOT_DIRECTORY', 'jomres' ); 35 if (!defined('JOMRES_ROOT_DIRECTORY')) { 36 define ( 'JOMRES_ROOT_DIRECTORY', 'jomres' ); 37 } 36 38 } 37 39
Note: See TracChangeset
for help on using the changeset viewer.