Plugin Directory

Changeset 3340460


Ignore:
Timestamp:
08/06/2025 03:06:41 PM (8 months ago)
Author:
Genoo
Message:

Release $SOURCE_TAG

Location:
wpmktgengine/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • wpmktgengine/trunk/libs/WPME/Extensions/Clever/Plugins.php

    r3320257 r3340460  
    4949    public function __construct()
    5050    {
    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);
    5468        }
    55         $this->installedPlugins = \get_plugins();
    56         $this->nag = new Nag();
    5769    }
    5870
     
    106118      // If it's a plugin, that is not our own, and remote
    107119      // 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)){
    109121        return $res;
    110122      }
     
    112124      $plugins = $this->getSupportedPlugins();
    113125      $plugin = array_filter($plugins, function($name) use($args){
    114         return $name['slug'] == $args->slug;
     126        return isset($name['slug']) && $name['slug'] == $args->slug;
    115127      });
    116128      $plugin = current($plugin);
    117129      // If no plugin found, return original response
    118       if (!array_key_exists('slug', $plugin)) {
     130      if (!$plugin || !array_key_exists('slug', $plugin)) {
    119131          return $res;
    120132      }
     
    127139      $resClone->homepage = 'https://wpmktgengine.com/';
    128140      $resClone->author_profile = 'https://wpmktgengine.com/';
    129       $resClone->requires = $args->wp_version;
     141      $resClone->requires = isset($args->wp_version) ? $args->wp_version : '';
    130142      $resClone->slug = $args->slug;
    131143      $resClone->sections = ["description" => $plugin['desc']];
     
    156168    public function pluginsLoaded()
    157169    {
    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                    }
    165183                }
    166184            }
     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);
    167191        }
    168192    }
     
    173197    public function pluginNotices()
    174198    {
    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);
    188224        }
    189225    }
  • wpmktgengine/trunk/libs/WPMKTENGINE/Api.php

    r2419690 r3340460  
    130130     * @param RepositorySettings $settings
    131131     */
    132 
    133132    public function __construct(RepositorySettingsFactory $settingsRepo)
    134133    {
    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       
    137138        // settings repository
    138139        $this->settingsRepo = $settingsRepo;
     
    12321233     * @return mixed|null
    12331234     */
    1234 
    12351235    public function buildQuery($action, $params = null)
    12361236    {
     
    12441244            if(Strings::endsWith($prepAction, "[S]") || Strings::endsWith($prepAction, "[D]") || Strings::endsWith($prepAction, "[P]")){
    12451245                // GET STRING
    1246                 if(!is_array($params)){
     1246                if(!is_array($params) && $params !== null){
    12471247                    $prepUrl .= '/' . $params;
    12481248                }
     
    12501250                // GET ARRAY
    12511251                foreach($params as $param){
    1252                     $prepUrl .= '/' . $param;
     1252                    if($param !== null){
     1253                        $prepUrl .= '/' . $param;
     1254                    }
    12531255                }
    12541256            }
    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);
    12571260        }
    12581261        return null;
  • wpmktgengine/trunk/libs/WPMKTENGINE/RepositorySettings.php

    r2901585 r3340460  
    9999     * @param  string $option  settings field name
    100100     * @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     */
    105104    public static function getOption($option, $section, $default = '')
    106105    {
    107106        $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       
    108113        if (isset($options[$option])) {
     114            // Return the original value, preserving its type (array, string, etc.)
    109115            return $options[$option];
    110116        }
     117       
    111118        return $default;
    112119    }
     
    170177    public function getApiKey()
    171178    {
    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        }
    173188    }
    174189
     
    618633    {
    619634        $postTypes = $this->getOption('genooCTAPostTypes', self::KEY_CTA);
    620         if (!empty($postTypes)) {
     635        if (!empty($postTypes) && is_array($postTypes)) {
    621636            return array_keys($postTypes);
    622637        } else {
  • wpmktgengine/trunk/libs/WPMKTENGINE/Utils/Strings.php

    r3320257 r3340460  
    105105     * @return bool
    106106     */
    107 
    108107    public static function contains($haystack, $needle)
    109108    {
     109        // Ensure both parameters are strings to prevent deprecation warnings
     110        if (!is_string($haystack) || !is_string($needle)) {
     111            return false;
     112        }
    110113        return strpos($haystack, $needle) !== FALSE;
    111114    }
  • wpmktgengine/trunk/libs/WPMKTENGINE/Wordpress/Utils.php

    r3320257 r3340460  
    4444     * @return mixed
    4545     */
    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    }
    4852
    4953
  • wpmktgengine/trunk/wpmktgengine-init.php

    r3320257 r3340460  
    4848    public function __construct()
    4949    {
    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        }
    7991    }
    8092
     
    8395     * Initialize
    8496     */
    85 
    8697    public function init()
    8798    {
    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);
    90102       
    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        }
    209232    }
    210233
     
    215238    public static function activate()
    216239    {
    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        }
    219254    }
    220255
  • wpmktgengine/trunk/wpmktgengine.php

    r3320257 r3340460  
    66    Author URI: http://www.genoo.com/
    77    Author Email: info@genoo.com
    8     Version: 4.0.30
     8    Version: 4.0.31
    99    License: GPLv2
    1010    Text Domain: wpmktgengine
     
    1414    Tested up to PHP: 8.3
    1515*/
     16
     17// Comprehensive error suppression during plugin loading to prevent "headers already sent" errors
     18if (!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
    1628/**
    1729 * This file is part of the WPMKTGENGINE plugin.
Note: See TracChangeset for help on using the changeset viewer.