Changeset 3340460
- Timestamp:
- 08/06/2025 03:06:41 PM (8 months ago)
- Location:
- wpmktgengine/trunk
- Files:
-
- 7 edited
-
libs/WPME/Extensions/Clever/Plugins.php (modified) (6 diffs)
-
libs/WPMKTENGINE/Api.php (modified) (4 diffs)
-
libs/WPMKTENGINE/RepositorySettings.php (modified) (3 diffs)
-
libs/WPMKTENGINE/Utils/Strings.php (modified) (1 diff)
-
libs/WPMKTENGINE/Wordpress/Utils.php (modified) (1 diff)
-
wpmktgengine-init.php (modified) (3 diffs)
-
wpmktgengine.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpmktgengine/trunk/libs/WPME/Extensions/Clever/Plugins.php
r3320257 r3340460 49 49 public function __construct() 50 50 { 51 $this->supportedPlugins = $this->getSupportedPlugins(); 52 if (!function_exists( 'get_plugins')){ 53 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 51 // Suppress deprecation warnings during initialization 52 $error_reporting_level = error_reporting(); 53 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 54 55 try { 56 $this->supportedPlugins = $this->getSupportedPlugins(); 57 if (!function_exists( 'get_plugins')){ 58 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 59 } 60 $this->installedPlugins = \get_plugins(); 61 $this->nag = new Nag(); 62 } catch (\Exception $e) { 63 // Log initialization errors but don't display them 64 error_log('WPMKTGENGINE Clever Plugins Error: ' . $e->getMessage()); 65 } finally { 66 // Restore error reporting level 67 error_reporting($error_reporting_level); 54 68 } 55 $this->installedPlugins = \get_plugins();56 $this->nag = new Nag();57 69 } 58 70 … … 106 118 // If it's a plugin, that is not our own, and remote 107 119 // one hosted in a repo, return regular response. 108 if(! in_array($args->slug, $this->remotePlugins)){120 if(!$args || !is_object($args) || !isset($args->slug) || !in_array($args->slug, $this->remotePlugins)){ 109 121 return $res; 110 122 } … … 112 124 $plugins = $this->getSupportedPlugins(); 113 125 $plugin = array_filter($plugins, function($name) use($args){ 114 return $name['slug'] == $args->slug;126 return isset($name['slug']) && $name['slug'] == $args->slug; 115 127 }); 116 128 $plugin = current($plugin); 117 129 // If no plugin found, return original response 118 if (! array_key_exists('slug', $plugin)) {130 if (!$plugin || !array_key_exists('slug', $plugin)) { 119 131 return $res; 120 132 } … … 127 139 $resClone->homepage = 'https://wpmktgengine.com/'; 128 140 $resClone->author_profile = 'https://wpmktgengine.com/'; 129 $resClone->requires = $args->wp_version;141 $resClone->requires = isset($args->wp_version) ? $args->wp_version : ''; 130 142 $resClone->slug = $args->slug; 131 143 $resClone->sections = ["description" => $plugin['desc']]; … … 156 168 public function pluginsLoaded() 157 169 { 158 // Search for plugins 159 $plugins = $this->getActivePlugins(); 160 if($plugins && !empty($plugins)){ 161 foreach($plugins as $plugin){ 162 // Check if we support plugin 163 if($this->isSupportedPlugin($plugin) && !$this->isExtensionInstalled($plugin)){ 164 $this->addNotificationFor($plugin); 170 // Suppress deprecation warnings during plugin loading 171 $error_reporting_level = error_reporting(); 172 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 173 174 try { 175 // Search for plugins 176 $plugins = $this->getActivePlugins(); 177 if($plugins && !empty($plugins)){ 178 foreach($plugins as $plugin){ 179 // Check if we support plugin 180 if($this->isSupportedPlugin($plugin) && !$this->isExtensionInstalled($plugin)){ 181 $this->addNotificationFor($plugin); 182 } 165 183 } 166 184 } 185 } catch (\Exception $e) { 186 // Log plugin loading errors but don't display them 187 error_log('WPMKTGENGINE Clever Plugins Load Error: ' . $e->getMessage()); 188 } finally { 189 // Restore error reporting level 190 error_reporting($error_reporting_level); 167 191 } 168 192 } … … 173 197 public function pluginNotices() 174 198 { 175 // Add modal 176 add_thickbox(); 177 // Render notices 178 foreach($this->notifications as $notification){ 179 // Plugin definition 180 $pluginDefinition = $this->supportedPlugins[$notification]; 181 // Get plugin message 182 // Render message 183 $this->nag->renderNotice( 184 $this->generateInstallMessage($pluginDefinition), 185 crc32($notification), 186 true 187 ); 199 // Suppress deprecation warnings during notice rendering 200 $error_reporting_level = error_reporting(); 201 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 202 203 try { 204 // Add modal 205 add_thickbox(); 206 // Render notices 207 foreach($this->notifications as $notification){ 208 // Plugin definition 209 $pluginDefinition = $this->supportedPlugins[$notification]; 210 // Get plugin message 211 // Render message 212 $this->nag->renderNotice( 213 $this->generateInstallMessage($pluginDefinition), 214 crc32($notification), 215 true 216 ); 217 } 218 } catch (\Exception $e) { 219 // Log notice rendering errors but don't display them 220 error_log('WPMKTGENGINE Clever Plugins Notice Error: ' . $e->getMessage()); 221 } finally { 222 // Restore error reporting level 223 error_reporting($error_reporting_level); 188 224 } 189 225 } -
wpmktgengine/trunk/libs/WPMKTENGINE/Api.php
r2419690 r3340460 130 130 * @param RepositorySettings $settings 131 131 */ 132 133 132 public function __construct(RepositorySettingsFactory $settingsRepo) 134 133 { 135 // assign API key 136 $this->key = $settingsRepo->getApiKey(); 134 // assign API key - ensure it's always a string 135 $apiKey = $settingsRepo->getApiKey(); 136 $this->key = is_string($apiKey) ? $apiKey : ''; 137 137 138 // settings repository 138 139 $this->settingsRepo = $settingsRepo; … … 1232 1233 * @return mixed|null 1233 1234 */ 1234 1235 1235 public function buildQuery($action, $params = null) 1236 1236 { … … 1244 1244 if(Strings::endsWith($prepAction, "[S]") || Strings::endsWith($prepAction, "[D]") || Strings::endsWith($prepAction, "[P]")){ 1245 1245 // GET STRING 1246 if(!is_array($params) ){1246 if(!is_array($params) && $params !== null){ 1247 1247 $prepUrl .= '/' . $params; 1248 1248 } … … 1250 1250 // GET ARRAY 1251 1251 foreach($params as $param){ 1252 $prepUrl .= '/' . $param; 1252 if($param !== null){ 1253 $prepUrl .= '/' . $param; 1254 } 1253 1255 } 1254 1256 } 1255 // lastQuery 1256 return $this->lastQuery = Utils::addQueryParam($prepUrl, 'api_key', $this->key); 1257 // lastQuery - ensure API key is never null 1258 $apiKey = $this->key ?: ''; 1259 return $this->lastQuery = Utils::addQueryParam($prepUrl, 'api_key', $apiKey); 1257 1260 } 1258 1261 return null; -
wpmktgengine/trunk/libs/WPMKTENGINE/RepositorySettings.php
r2901585 r3340460 99 99 * @param string $option settings field name 100 100 * @param string $section the section name this field belongs to 101 * @param string $default default text if it's not found 102 * @return string 103 */ 104 101 * @param mixed $default default value if it's not found 102 * @return mixed 103 */ 105 104 public static function getOption($option, $section, $default = '') 106 105 { 107 106 $options = get_option($section); 107 108 // Ensure $options is an array and not null/false 109 if (!is_array($options)) { 110 return $default; 111 } 112 108 113 if (isset($options[$option])) { 114 // Return the original value, preserving its type (array, string, etc.) 109 115 return $options[$option]; 110 116 } 117 111 118 return $default; 112 119 } … … 170 177 public function getApiKey() 171 178 { 172 return $this->getOption('apiKey', self::KEY_SETTINGS); 179 $apiKey = $this->getOption('apiKey', self::KEY_SETTINGS); 180 // Ensure we always return a string, never null 181 if (is_string($apiKey)) { 182 return $apiKey; 183 } elseif (is_array($apiKey)) { 184 return ''; 185 } else { 186 return (string)$apiKey; 187 } 173 188 } 174 189 … … 618 633 { 619 634 $postTypes = $this->getOption('genooCTAPostTypes', self::KEY_CTA); 620 if (!empty($postTypes) ) {635 if (!empty($postTypes) && is_array($postTypes)) { 621 636 return array_keys($postTypes); 622 637 } else { -
wpmktgengine/trunk/libs/WPMKTENGINE/Utils/Strings.php
r3320257 r3340460 105 105 * @return bool 106 106 */ 107 108 107 public static function contains($haystack, $needle) 109 108 { 109 // Ensure both parameters are strings to prevent deprecation warnings 110 if (!is_string($haystack) || !is_string($needle)) { 111 return false; 112 } 110 113 return strpos($haystack, $needle) !== FALSE; 111 114 } -
wpmktgengine/trunk/libs/WPMKTENGINE/Wordpress/Utils.php
r3320257 r3340460 44 44 * @return mixed 45 45 */ 46 47 public static function addQueryParam($url, $key, $value = null){ return add_query_arg($key, $value, $url); } 46 public static function addQueryParam($url, $key, $value = null) 47 { 48 // Ensure value is never null to prevent deprecation warnings 49 $safeValue = $value !== null ? $value : ''; 50 return add_query_arg($key, $safeValue, $url); 51 } 48 52 49 53 -
wpmktgengine/trunk/wpmktgengine-init.php
r3320257 r3340460 48 48 public function __construct() 49 49 { 50 // start the engine last file to require, rest is auto 51 // custom auto loader, PSR-0 Standard 52 require_once('wpmktgengine-loader.php'); 53 $classLoader = new WPMKTENGINELoader(); 54 $classLoader->setPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR); 55 $classLoader->addNamespace('WPMKTENGINE'); 56 $classLoader->addNamespace('WPME'); 57 $classLoader->register(); 58 // Cosntants define 59 define('WPMKTENGINE_KEY', 'WPMKTENGINE'); 60 define('WPMKTENGINE_FILE', WPMKTENGINE_PLUGIN); 61 define('WPMKTENGINE_HOME_URL',get_option('siteurl')); 62 define('WPMKTENGINE_FOLDER', plugins_url(NULL, __FILE__)); 63 define('WPMKTENGINE_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR); 64 define('WPMKTENGINE_ASSETS', WPMKTENGINE_FOLDER . '/assets/'); 65 define('WPMKTENGINE_ASSETS_DIR', WPMKTENGINE_ROOT . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR); 66 // Storage 67 $saveToWpContent = \WPMKTENGINE\RepositorySettings::getOption('genooCTASave', \WPMKTENGINE\RepositorySettings::KEY_MISC, false); 68 if($saveToWpContent){ 69 define('WPMKTENGINE_CACHE', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'cache_wpme' . DIRECTORY_SEPARATOR); 70 } else { 71 define('WPMKTENGINE_CACHE', WPMKTENGINE_ROOT . 'cache' . DIRECTORY_SEPARATOR); 72 } 73 define('WPMKTENGINE_DEBUG', get_option('WPMKTENGINEDebug')); 74 define('WPMKTENGINE_REFRESH', sha1('new-admin-styling')); 75 define('WPMKTENGINE_BUILDER', 'https://genoolabs.com/simplepagebuilder/'); 76 define('WPMKTENGINE_LEAD_COOKIE', '_gtld'); 77 // wp init 78 Action::add('plugins_loaded', array($this, 'init'), 1); 50 // Suppress deprecation warnings during initialization 51 $error_reporting_level = error_reporting(); 52 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 53 54 try { 55 // start the engine last file to require, rest is auto 56 // custom auto loader, PSR-0 Standard 57 require_once('wpmktgengine-loader.php'); 58 $classLoader = new WPMKTENGINELoader(); 59 $classLoader->setPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR); 60 $classLoader->addNamespace('WPMKTENGINE'); 61 $classLoader->addNamespace('WPME'); 62 $classLoader->register(); 63 // Cosntants define 64 define('WPMKTENGINE_KEY', 'WPMKTENGINE'); 65 define('WPMKTENGINE_FILE', WPMKTENGINE_PLUGIN); 66 define('WPMKTENGINE_HOME_URL', get_option('siteurl') ?: ''); 67 define('WPMKTENGINE_FOLDER', plugins_url(NULL, __FILE__)); 68 define('WPMKTENGINE_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR); 69 define('WPMKTENGINE_ASSETS', WPMKTENGINE_FOLDER . '/assets/'); 70 define('WPMKTENGINE_ASSETS_DIR', WPMKTENGINE_ROOT . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR); 71 // Storage 72 $saveToWpContent = \WPMKTENGINE\RepositorySettings::getOption('genooCTASave', \WPMKTENGINE\RepositorySettings::KEY_MISC, false); 73 if($saveToWpContent){ 74 define('WPMKTENGINE_CACHE', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'cache_wpme' . DIRECTORY_SEPARATOR); 75 } else { 76 define('WPMKTENGINE_CACHE', WPMKTENGINE_ROOT . 'cache' . DIRECTORY_SEPARATOR); 77 } 78 define('WPMKTENGINE_DEBUG', get_option('WPMKTENGINEDebug') ?: false); 79 define('WPMKTENGINE_REFRESH', sha1('new-admin-styling')); 80 define('WPMKTENGINE_BUILDER', 'https://genoolabs.com/simplepagebuilder/'); 81 define('WPMKTENGINE_LEAD_COOKIE', '_gtld'); 82 // wp init 83 Action::add('plugins_loaded', array($this, 'init'), 1); 84 } catch (\Exception $e) { 85 // Log initialization errors but don't display them 86 error_log('WPMKTGENGINE Initialization Error: ' . $e->getMessage()); 87 } finally { 88 // Restore error reporting level 89 error_reporting($error_reporting_level); 90 } 79 91 } 80 92 … … 83 95 * Initialize 84 96 */ 85 86 97 public function init() 87 98 { 88 // Dropins 89 require_once WPMKTENGINE_ROOT . '/extensions/dropins.php'; 99 // Suppress deprecation warnings during initialization 100 $error_reporting_level = error_reporting(); 101 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 90 102 91 // initialize 92 $this->repositarySettings = new \WPME\RepositorySettingsFactory(); 93 $this->api = new \WPME\ApiFactory($this->repositarySettings); 94 $this->cache = new \WPME\CacheFactory(WPMKTENGINE_CACHE); 95 // helper constants 96 define('WPMKTENGINE_PART_SETUP', $this->api->isSetup()); 97 define('WPMKTENGINE_SETUP', $this->api->isSetupFull(TRUE)); 98 define('WPMKTENGINE_SETUP_LEAD_TYPES', $this->api->isSetupFull(FALSE)); 99 define('WPMKTENGINE_LUMENS', FALSE); 100 define('WPMKTENGINE_DEV', apply_filters('wpmktengine_dev', FALSE)); 101 // Set APIs 102 if(WPMKTENGINE_DEV === FALSE){ 103 define('WPMKTENGINE_DOMAIN', '//wpmeapp.genoo.com'); 104 define('WPMKTENGINE_API_DOMAIN', '//api.genoo.com'); 105 } elseif(WPMKTENGINE_DEV === TRUE){ 106 define('WPMKTENGINE_DOMAIN', '//wpmedev.odportals.com'); 107 define('WPMKTENGINE_API_DOMAIN', '//wpmedev.odportals.com'); 108 } 109 if(WPMKTENGINE_SETUP){ 110 define('WPMKTENGINE_BUILDER_NEW', WPMKTENGINE_BUILDER . 'index-login.php?api='. $this->repositarySettings->getApiKey() .'&domain=' . WPMKTENGINE_HOME_URL); 111 } else { 112 define('WPMKTENGINE_BUILDER_NEW', ''); 113 } 114 // Make globals global 115 global $WPME_API; 116 global $WPME_CACHE; 117 global $WPME_STYLES; 118 global $WPME_STYLES_JS; 119 global $WPME_MODALS; 120 $WPME_API = $this->api; 121 $WPME_CACHE = $this->cache; 122 $WPME_STYLES = ''; 123 $WPME_STYLES_JS = ''; 124 $WPME_MODALS = array(); 125 126 /** 127 * 0. Text-domain 128 */ 129 load_plugin_textdomain('wpmktengine', false, dirname(plugin_basename(__FILE__)) . '/lang/'); 130 131 /** 132 * 1. Debug call? 133 */ 134 if(WPMKTENGINE_DEBUG){ new Debug(); } 135 136 /** 137 * 2. Register Widgets / Shortcodes / Cron, etc. 138 */ 139 if(WPMKTENGINE_SETUP){ 140 Ajax::register(); 141 Comments::register(); 142 Users::register($this->repositarySettings, $this->api); 143 Widgets::register(); 144 Widgets::registerDashboard(); 145 Shortcodes::register(); 146 Helpscreen::register(); 147 // Extensions 148 // Shortocde Surveys 149 \WPME\Extensions\ShortcodesSurveys::register(); 150 // Ctas 151 \WPME\Extensions\CTAs::register(); 152 \WPME\Extensions\ShortcodesInEditor::register(); 153 \WPME\Extensions\LandingPages\LandingPages::register(); 154 \WPME\Extensions\TrackingLink\Shortcode::register(); 155 // Clever plugins 156 global $pagenow; 157 if(current_user_can('manage_options')){ 158 $cleverPlugins = new \WPME\Extensions\Clever\Plugins(); 159 $cleverPlugins->register(); 160 } 161 // Customizer 162 $customizerExtension = new \WPME\Customizer\CustomizerExtension(); 163 $customizerExtension->registerCustomizerPreview(); 164 // Add Josh's webinar code 165 require_once WPMKTENGINE_ROOT . '/libs/WPME/Extensions/Webinar.php'; 166 // WP Seo 167 add_filter('wpseo_accessible_post_types', function($post_types){ 168 $post_types[] = 'wpme-landing-pages'; 169 return $post_types; 170 }, 10, 1); 171 // Elementor 172 // \WPME\Extensions\ElementorShortcodes\ElementorShortcodes::register(); 173 } 174 175 /** 176 * 3. Extensions 177 */ 178 // This runs in plugin_loaded 179 Action::run('wpmktengine_init', $this->repositarySettings, $this->api, $this->cache); 180 181 /** 182 * 4. Setup settings 183 */ 184 if(WPMKTENGINE_SETUP && WPMKTENGINE_SETUP_LEAD_TYPES == FALSE){ 185 // Partial setup, lets save the lead types now 186 $this->repositarySettings->setFirstLeadTypes($this->api); 187 } 188 189 /** 190 * 5. Init RSS 191 */ 192 193 if(WPMKTENGINE_SETUP){ 194 Action::add('init', array($this, 'jsonApi')); 195 } 196 197 /** 198 * 6. Admin | Frontend 199 */ 200 201 if(is_admin()){ 202 global $WPME_ADMIN; 203 $WPME_ADMIN = new Admin($this->api, $this->cache); 204 return $WPME_ADMIN; 205 } 206 global $WPME_FRONTEND; 207 $WPME_FRONTEND = new Frontend($this->repositarySettings, $this->api, $this->cache); 208 return $WPME_FRONTEND; 103 try { 104 // Dropins 105 require_once WPMKTENGINE_ROOT . '/extensions/dropins.php'; 106 107 // initialize 108 $this->repositarySettings = new \WPME\RepositorySettingsFactory(); 109 $this->api = new \WPME\ApiFactory($this->repositarySettings); 110 $this->cache = new \WPME\CacheFactory(WPMKTENGINE_CACHE); 111 // helper constants 112 define('WPMKTENGINE_PART_SETUP', $this->api->isSetup()); 113 define('WPMKTENGINE_SETUP', $this->api->isSetupFull(TRUE)); 114 define('WPMKTENGINE_SETUP_LEAD_TYPES', $this->api->isSetupFull(FALSE)); 115 define('WPMKTENGINE_LUMENS', FALSE); 116 define('WPMKTENGINE_DEV', apply_filters('wpmktengine_dev', FALSE)); 117 // Set APIs 118 if(WPMKTENGINE_DEV === FALSE){ 119 define('WPMKTENGINE_DOMAIN', '//wpmeapp.genoo.com'); 120 define('WPMKTENGINE_API_DOMAIN', '//api.genoo.com'); 121 } elseif(WPMKTENGINE_DEV === TRUE){ 122 define('WPMKTENGINE_DOMAIN', '//wpmedev.odportals.com'); 123 define('WPMKTENGINE_API_DOMAIN', '//wpmedev.odportals.com'); 124 } 125 if(WPMKTENGINE_SETUP){ 126 define('WPMKTENGINE_BUILDER_NEW', WPMKTENGINE_BUILDER . 'index-login.php?api='. $this->repositarySettings->getApiKey() .'&domain=' . WPMKTENGINE_HOME_URL); 127 } else { 128 define('WPMKTENGINE_BUILDER_NEW', ''); 129 } 130 // Make globals global 131 global $WPME_API; 132 global $WPME_CACHE; 133 global $WPME_STYLES; 134 global $WPME_STYLES_JS; 135 global $WPME_MODALS; 136 $WPME_API = $this->api; 137 $WPME_CACHE = $this->cache; 138 $WPME_STYLES = ''; 139 $WPME_STYLES_JS = ''; 140 $WPME_MODALS = array(); 141 142 /** 143 * 0. Text-domain 144 */ 145 load_plugin_textdomain('wpmktengine', false, dirname(plugin_basename(__FILE__)) . '/lang/'); 146 147 /** 148 * 1. Debug call? 149 */ 150 if(WPMKTENGINE_DEBUG){ new Debug(); } 151 152 /** 153 * 2. Register Widgets / Shortcodes / Cron, etc. 154 */ 155 if(WPMKTENGINE_SETUP){ 156 Ajax::register(); 157 Comments::register(); 158 Users::register($this->repositarySettings, $this->api); 159 Widgets::register(); 160 Widgets::registerDashboard(); 161 Shortcodes::register(); 162 Helpscreen::register(); 163 // Extensions 164 // Shortocde Surveys 165 \WPME\Extensions\ShortcodesSurveys::register(); 166 // Ctas 167 \WPME\Extensions\CTAs::register(); 168 \WPME\Extensions\ShortcodesInEditor::register(); 169 \WPME\Extensions\LandingPages\LandingPages::register(); 170 \WPME\Extensions\TrackingLink\Shortcode::register(); 171 // Clever plugins 172 global $pagenow; 173 if(current_user_can('manage_options')){ 174 $cleverPlugins = new \WPME\Extensions\Clever\Plugins(); 175 $cleverPlugins->register(); 176 } 177 // Customizer 178 $customizerExtension = new \WPME\Customizer\CustomizerExtension(); 179 $customizerExtension->registerCustomizerPreview(); 180 // Add Josh's webinar code 181 require_once WPMKTENGINE_ROOT . '/libs/WPME/Extensions/Webinar.php'; 182 // WP Seo 183 add_filter('wpseo_accessible_post_types', function($post_types){ 184 $post_types[] = 'wpme-landing-pages'; 185 return $post_types; 186 }, 10, 1); 187 // Elementor 188 // \WPME\Extensions\ElementorShortcodes\ElementorShortcodes::register(); 189 } 190 191 /** 192 * 3. Extensions 193 */ 194 // This runs in plugin_loaded 195 Action::run('wpmktengine_init', $this->repositarySettings, $this->api, $this->cache); 196 197 /** 198 * 4. Setup settings 199 */ 200 if(WPMKTENGINE_SETUP && WPMKTENGINE_SETUP_LEAD_TYPES == FALSE){ 201 // Partial setup, lets save the lead types now 202 $this->repositarySettings->setFirstLeadTypes($this->api); 203 } 204 205 /** 206 * 5. Init RSS 207 */ 208 209 if(WPMKTENGINE_SETUP){ 210 Action::add('init', array($this, 'jsonApi')); 211 } 212 213 /** 214 * 6. Admin | Frontend 215 */ 216 217 if(is_admin()){ 218 global $WPME_ADMIN; 219 $WPME_ADMIN = new Admin($this->api, $this->cache); 220 return $WPME_ADMIN; 221 } 222 global $WPME_FRONTEND; 223 $WPME_FRONTEND = new Frontend($this->repositarySettings, $this->api, $this->cache); 224 return $WPME_FRONTEND; 225 } catch (\Exception $e) { 226 // Log initialization errors but don't display them 227 error_log('WPMKTGENGINE Init Error: ' . $e->getMessage()); 228 } finally { 229 // Restore error reporting level 230 error_reporting($error_reporting_level); 231 } 209 232 } 210 233 … … 215 238 public static function activate() 216 239 { 217 // Save first post types 218 RepositorySettings::saveFirstSettings(); 240 // Suppress deprecation warnings during activation to prevent "headers already sent" error 241 $error_reporting_level = error_reporting(); 242 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 243 244 try { 245 // Save first post types 246 RepositorySettings::saveFirstSettings(); 247 } catch (\Exception $e) { 248 // Log activation errors but don't display them 249 error_log('WPMKTGENGINE Activation Error: ' . $e->getMessage()); 250 } finally { 251 // Restore error reporting level 252 error_reporting($error_reporting_level); 253 } 219 254 } 220 255 -
wpmktgengine/trunk/wpmktgengine.php
r3320257 r3340460 6 6 Author URI: http://www.genoo.com/ 7 7 Author Email: info@genoo.com 8 Version: 4.0.3 08 Version: 4.0.31 9 9 License: GPLv2 10 10 Text Domain: wpmktgengine … … 14 14 Tested up to PHP: 8.3 15 15 */ 16 17 // Comprehensive error suppression during plugin loading to prevent "headers already sent" errors 18 if (!defined('WP_DEBUG') || !WP_DEBUG) { 19 // Suppress all deprecation warnings in production 20 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_WARNING); 21 // Also suppress display of errors 22 ini_set('display_errors', 0); 23 } else { 24 // In debug mode, still suppress deprecation warnings but allow other errors 25 error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); 26 } 27 16 28 /** 17 29 * This file is part of the WPMKTGENGINE plugin.
Note: See TracChangeset
for help on using the changeset viewer.