| 1 |
<?php |
| 2 |
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 3 |
#* Plugin Name: WPPizza |
| 4 |
#* Plugin URI: https://wordpress.org/extend/plugins/wppizza/ |
| 5 |
#* Description: A Restaurant Plugin (not only for Pizza) |
| 6 |
#* Version: 3.20.1 |
| 7 |
#* Requires PHP: 5.3 |
| 8 |
#* Author: ollybach |
| 9 |
#* Author URI: https://www.wp-pizza.com |
| 10 |
#* License: GPL2 |
| 11 |
#* Text Domain: wppizza |
| 12 |
#* Domain Path: lang |
| 13 |
#* |
| 14 |
#* License: |
| 15 |
#* |
| 16 |
#* Copyright 2012 ollybach (dev@wp-pizza.com) |
| 17 |
#* |
| 18 |
#* This program is free software; you can redistribute it and/or modify |
| 19 |
#* it under the terms of the GNU General Public License, version 2, as |
| 20 |
#* published by the Free Software Foundation. |
| 21 |
#* |
| 22 |
#* This program is distributed in the hope that it will be useful, |
| 23 |
#* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 |
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 |
#* GNU General Public License for more details. |
| 26 |
#* |
| 27 |
#* You should have received a copy of the GNU General Public License |
| 28 |
#* along with this program; if not, write to the Free Software |
| 29 |
#* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 30 |
#* or see <http://www.gnu.org/licenses/>. |
| 31 |
#* |
| 32 |
#* @package WPPizza |
| 33 |
#* @category Core |
| 34 |
#* @author ollybach |
| 35 |
#* |
| 36 |
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / |
| 37 |
|
| 38 |
/*************************************************************** |
| 39 |
* |
| 40 |
* Simply exit if accessed directly |
| 41 |
* |
| 42 |
***************************************************************/ |
| 43 |
if ( ! defined( 'ABSPATH' ) ) {exit();} |
| 44 |
|
| 45 |
/*************************************************************** |
| 46 |
* |
| 47 |
* for simplicities sake lets put this here at the top |
| 48 |
* MUST ALWAYS BE SET IN LINE WITH PLUGIN VERSION NUMBER ABOVE |
| 49 |
* |
| 50 |
* @since v3 |
| 51 |
* |
| 52 |
* @since v3.10 |
| 53 |
* major version number of plugin |
| 54 |
* |
| 55 |
* @since v3.19.3 |
| 56 |
* [for convenience in plugin/theme development] |
| 57 |
* allow constant overrides to enable beta versions for example |
| 58 |
***************************************************************/ |
| 59 |
if(!defined('WPPIZZA_VERSION')){ |
| 60 |
define('WPPIZZA_VERSION', '3.20.1'); |
| 61 |
} |
| 62 |
if(!defined('WPPIZZA_VERSION_MAJOR')){ |
| 63 |
define('WPPIZZA_VERSION_MAJOR', '3'); |
| 64 |
} |
| 65 |
|
| 66 |
/*************************************************************** |
| 67 |
* |
| 68 |
* |
| 69 |
* [CLASS] |
| 70 |
* @since v3 |
| 71 |
* |
| 72 |
* |
| 73 |
***************************************************************/ |
| 74 |
if (!class_exists( 'WPPIZZA' )){ |
| 75 |
class WPPIZZA { |
| 76 |
|
| 77 |
/* |
| 78 |
* @var WPPIZZA |
| 79 |
* @since 3.0 |
| 80 |
*/ |
| 81 |
private static $instance; |
| 82 |
|
| 83 |
/* |
| 84 |
setting properties |
| 85 |
to make php 8.2+ / 9.0 happy... |
| 86 |
*/ |
| 87 |
public $dbcookie; |
| 88 |
public $categories; |
| 89 |
public $helpers; |
| 90 |
public $gateways; |
| 91 |
public $email; |
| 92 |
public $admin_helper; |
| 93 |
public $markup_orderinfo; |
| 94 |
public $markup_openingtimes; |
| 95 |
public $markup_minicart; |
| 96 |
public $markup_maincart; |
| 97 |
public $markup_navigation; |
| 98 |
public $markup_search; |
| 99 |
public $markup_additives; |
| 100 |
public $markup_foodtype; |
| 101 |
public $markup_options; |
| 102 |
public $markup_pickup_choice; |
| 103 |
public $markup_totals; |
| 104 |
public $markup_pages; |
| 105 |
public $templates_menu_items; |
| 106 |
public $templates_email_print; |
| 107 |
public $admin_dashboard_widgets; |
| 108 |
public $sales_data; |
| 109 |
public $user; |
| 110 |
public $tips; |
| 111 |
public $db; |
| 112 |
public $order; |
| 113 |
public $cron; |
| 114 |
public $register_gateways; |
| 115 |
public $user_caps; |
| 116 |
|
| 117 |
|
| 118 |
/* |
| 119 |
* @var session |
| 120 |
* @since 3.0 |
| 121 |
*/ |
| 122 |
public $session; |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
function __construct() { |
| 127 |
|
| 128 |
/* |
| 129 |
some - somewhat inconsequentiial - setup actions to provide some useful links perhaps |
| 130 |
in the WP admin plugin page (wp-admin/plugins.php) for this plugin |
| 131 |
@since 3.16 |
| 132 |
*/ |
| 133 |
//add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);// FOR REFERENCE CURRENTLY NOT IMPLEMENTED |
| 134 |
add_filter('plugin_row_meta', array($this, 'plugin_meta_links'), 10, 2); |
| 135 |
} |
| 136 |
|
| 137 |
/*************************************************************** |
| 138 |
* Main WPPIZZA |
| 139 |
* |
| 140 |
* To insures only one instance of WPPIZZA exists in memory |
| 141 |
* |
| 142 |
* @since 3.0 |
| 143 |
* @static |
| 144 |
* @staticvar array $instance |
| 145 |
* @uses WPPIZZA::setup_constants() setup constants |
| 146 |
* @uses WPPIZZA::requires() Include all required files |
| 147 |
* @uses WPPIZZA::load_textdomain() load the language files |
| 148 |
* |
| 149 |
* @return WPPIZZA |
| 150 |
****************************************************************/ |
| 151 |
public static function instance() { |
| 152 |
|
| 153 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPPIZZA ) ) { |
| 154 |
|
| 155 |
self::$instance = new WPPIZZA; |
| 156 |
|
| 157 |
/**load custom functions.php - if exists**/ |
| 158 |
add_action( 'after_setup_theme', array( self::$instance, 'load_custom_functions')); |
| 159 |
|
| 160 |
/*setting up some constants*/ |
| 161 |
self::$instance->wppizza_constants(__FILE__); |
| 162 |
/**include all required files **/ |
| 163 |
self::$instance->requires(); |
| 164 |
/**cookies**/ |
| 165 |
self::$instance->dbcookie = new WPPIZZA_DBCOOKIE(); |
| 166 |
/**sessions**/ |
| 167 |
self::$instance->session = new WPPIZZA_SESSIONS(); |
| 168 |
/**categories**/ |
| 169 |
self::$instance->categories = new WPPIZZA_CATEGORIES_SORTED(); |
| 170 |
/**global helper functions**/ |
| 171 |
self::$instance->helpers = new WPPIZZA_HELPERS(); |
| 172 |
/**gateways**/ |
| 173 |
self::$instance->gateways = new WPPIZZA_GATEWAYS(); |
| 174 |
/**emails**/ |
| 175 |
self::$instance->email = new WPPIZZA_EMAIL(); |
| 176 |
/**admin only**/ |
| 177 |
if (is_admin()) { |
| 178 |
/**register gateways**/ |
| 179 |
self::$instance->register_gateways = new WPPIZZA_REGISTER_GATEWAYS(); |
| 180 |
/**admin user caps**/ |
| 181 |
self::$instance->user_caps = new WPPIZZA_USER_CAPS(); |
| 182 |
} |
| 183 |
|
| 184 |
/** |
| 185 |
admin helper functions (order history mainly) - these might also be used outside admin area |
| 186 |
(so moved outside is_admin() conditional since v3.5) ! |
| 187 |
**/ |
| 188 |
self::$instance->admin_helper = new WPPIZZA_ADMIN_HELPERS(); |
| 189 |
|
| 190 |
/** |
| 191 |
templates | shortcodes | widget markup | sales data |
| 192 |
**/ |
| 193 |
self::$instance->markup_orderinfo = new WPPIZZA_MARKUP_ORDERINFO(); /* shortcode or enabled in cart widget */ |
| 194 |
self::$instance->markup_openingtimes = new WPPIZZA_MARKUP_OPENINGTIMES(); /* shortcode or enabled in cart widget */ |
| 195 |
self::$instance->markup_minicart = new WPPIZZA_MARKUP_MINICART(); /* shortcode or enabled in cart widget */ |
| 196 |
self::$instance->markup_maincart = new WPPIZZA_MARKUP_MAINCART(); /* shortcode or cart widget */ |
| 197 |
self::$instance->markup_navigation = new WPPIZZA_MARKUP_NAVIGATION(); /* shortcode or navigation widget */ |
| 198 |
self::$instance->markup_search = new WPPIZZA_MARKUP_SEARCH(); /* shortcode or search widget */ |
| 199 |
self::$instance->markup_additives = new WPPIZZA_MARKUP_ADDITIVES(); /* shortcode or in menu items, menu items loop */ |
| 200 |
self::$instance->markup_foodtype = new WPPIZZA_MARKUP_FOODTYPE(); /* shortcode or in menu items, menu items loop */ |
| 201 |
self::$instance->markup_options = new WPPIZZA_MARKUP_OPTIONS(); /* shortcode to output some wppizza options */ |
| 202 |
self::$instance->markup_pickup_choice = new WPPIZZA_MARKUP_PICKUP_CHOICE(); /* shortcode and called in cart|orderpage templates */ |
| 203 |
self::$instance->markup_totals = new WPPIZZA_MARKUP_TOTALS(); /* shortcode only */ |
| 204 |
self::$instance->markup_pages = new WPPIZZA_MARKUP_PAGES(); /* auto (orderpage|confirmationpage|thankyoupage) and "orderhistory" shortcode */ |
| 205 |
self::$instance->templates_menu_items = new WPPIZZA_MARKUP_MENU_ITEMS(); /* single item, categories loop, add to cart button, bestsellers*/ |
| 206 |
self::$instance->templates_email_print = new WPPIZZA_MARKUP_EMAIL_PRINT(); /* email / print templates */ |
| 207 |
self::$instance->admin_dashboard_widgets = new WPPIZZA_DASHBOARD_WIDGETS(); /* auto dashboard widgets */ |
| 208 |
self::$instance->sales_data = new WPPIZZA_SALES_DATA(); /* auto sales data results */ |
| 209 |
|
| 210 |
|
| 211 |
/** |
| 212 |
user login / out/ register forms |
| 213 |
update details form |
| 214 |
registration emails / redirects |
| 215 |
tips |
| 216 |
etc |
| 217 |
**/ |
| 218 |
self::$instance->user = new WPPIZZA_USER();/* login form, registration, emails etc */ |
| 219 |
self::$instance->tips = new WPPIZZA_TIPS();/* tips options / values */ |
| 220 |
self::$instance->db = new WPPIZZA_DB();/* query insert update delete etc */ |
| 221 |
self::$instance->order = new WPPIZZA_ORDER();/* */ |
| 222 |
self::$instance->cron = new WPPIZZA_CRON();/* wppizza wp cronjobs */ |
| 223 |
|
| 224 |
} |
| 225 |
|
| 226 |
return self::$instance; |
| 227 |
} |
| 228 |
|
| 229 |
|
| 230 |
/************************************************************************************* |
| 231 |
* wppizza constants |
| 232 |
* |
| 233 |
* @access private |
| 234 |
* @since 3.0 |
| 235 |
* @return void |
| 236 |
*************************************************************************************/ |
| 237 |
private function wppizza_constants($PLUGIN_FILE_ABS_PATH) { |
| 238 |
require_once(dirname($PLUGIN_FILE_ABS_PATH) .'/includes/global.constants.inc.php'); |
| 239 |
} |
| 240 |
|
| 241 |
/************************************************************************************* |
| 242 |
* load wppizzas functions.php |
| 243 |
* - if exists in theme/childtheme directory as ./wppizza/functions.php |
| 244 |
* @since 3.0 |
| 245 |
* @return void |
| 246 |
*************************************************************************************/ |
| 247 |
function load_custom_functions(){ |
| 248 |
if(WPPIZZA_LOCATE_DIR !='' && file_exists(WPPIZZA_TEMPLATE_DIR . '/functions.php')){ |
| 249 |
include_once( WPPIZZA_TEMPLATE_DIR . '/functions.php'); |
| 250 |
} |
| 251 |
} |
| 252 |
|
| 253 |
/************************************************************************************* |
| 254 |
* Include our required files / classes |
| 255 |
* |
| 256 |
* @access private |
| 257 |
* @since 3.0 |
| 258 |
* @return void |
| 259 |
*************************************************************************************/ |
| 260 |
private function requires(){ |
| 261 |
require_once(WPPIZZA_PATH .'includes/setup/required.files.inc.php'); |
| 262 |
} |
| 263 |
/************************************************************************************* |
| 264 |
* Set some plugin settings links in the admin plugin page (next to deactivate link) |
| 265 |
* CURRENTLY NOT IMPLEMENTED |
| 266 |
* @access private |
| 267 |
* @since 3.16 |
| 268 |
* @return array |
| 269 |
*************************************************************************************/ |
| 270 |
function plugin_action_links($links, $file) { |
| 271 |
|
| 272 |
if (($file === plugin_basename(__FILE__) ) && (current_user_can('manage_options'))) { |
| 273 |
$settings = '<a href="'. admin_url('edit.php?post_type=wppizza&page=order_settings') .'">'. esc_html(__('Order Settings', 'wppizza-admin')) .'</a>'; |
| 274 |
array_unshift($links, $settings); |
| 275 |
} |
| 276 |
|
| 277 |
return $links; |
| 278 |
} |
| 279 |
|
| 280 |
/************************************************************************************* |
| 281 |
* Set plugin settings links |
| 282 |
* |
| 283 |
* @access private |
| 284 |
* @since 3.16 |
| 285 |
* @return array |
| 286 |
*************************************************************************************/ |
| 287 |
function plugin_meta_links($links, $file) { |
| 288 |
|
| 289 |
if ($file === plugin_basename(__FILE__)) { |
| 290 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="https://docs.wp-pizza.com/getting-started/?section=setup" title="'. esc_attr(__('Getting started', 'wppizza-admin')) .'">'. esc_html(__('Getting started', 'wppizza-admin')) .'</a>'; |
| 291 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="https://docs.wp-pizza.com" title="'. esc_attr(__('Documentation', 'wppizza-admin')) .'">'. esc_html(__('Documentation', 'wppizza-admin')) .'</a>'; |
| 292 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="https://www.wp-pizza.com" title="'. esc_attr(__('Homepage', 'wppizza-admin')) .'">'. esc_html(__('Homepage', 'wppizza-admin')) .'</a>'; |
| 293 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/plugins/wppizza/#developers" title="'. esc_attr(__('Changelog', 'wppizza-admin')) .'">'. esc_html(__('Changelog', 'wppizza-admin')) .'</a>'; |
| 294 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/support/plugin/wppizza/reviews/?rate=5#new-post" title="'. esc_attr(__('Click here to rate and review this plugin on WordPress.org', 'wppizza-admin')) .'">'. esc_html(__('Rate this plugin', 'wppizza-admin')) .' »</a>'; |
| 295 |
} |
| 296 |
|
| 297 |
return $links; |
| 298 |
} |
| 299 |
|
| 300 |
} |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
/************************************************************************************* |
| 305 |
* The main function responsible for returning WPPIZZA to functions everywhere. |
| 306 |
* |
| 307 |
* Example: $wppizza = WPPIZZA(); |
| 308 |
* |
| 309 |
* @since 3.0 |
| 310 |
* @return object WPPIZZA Instance |
| 311 |
*************************************************************************************/ |
| 312 |
function WPPIZZA() { |
| 313 |
return WPPIZZA::instance(); |
| 314 |
} |
| 315 |
function wppizza_ini() { |
| 316 |
WPPIZZA(); |
| 317 |
} |
| 318 |
add_action( 'plugins_loaded', 'wppizza_ini'); |
| 319 |
?> |