From a75bcd13c4ffcde5041032e11679c8bf9958ba5e Mon Sep 17 00:00:00 2001 From: pjaudiomv <34245618+pjaudiomv@users.noreply.github.com> Date: Wed, 28 Sep 2022 21:39:04 -0400 Subject: [PATCH] Fix warnings (#27) --- bmlt-wordpress-satellite-plugin.php | 33 ++++++++++++++++------------- composer.json | 4 +--- composer.lock | 14 ++++++------ readme.txt | 5 ++++- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/bmlt-wordpress-satellite-plugin.php b/bmlt-wordpress-satellite-plugin.php index 05f66b8..b932b5e 100644 --- a/bmlt-wordpress-satellite-plugin.php +++ b/bmlt-wordpress-satellite-plugin.php @@ -7,9 +7,9 @@ * These need to be without the asterisks, as WP parses them. * Plugin Name: BMLT WordPress Satellite Plugin URI: https://bmlt.app -Author: MAGSHARE +Author: bmlt-enabled Description: This is a WordPress plugin satellite of the Basic Meeting List Toolbox. -Version: 3.11.2 +Version: 3.11.3 Install: Drop this directory into the "wp-content/plugins/" directory and activate it. ********************************************************************************************/ @@ -139,7 +139,8 @@ protected function cms_get_page_settings_id( if (!$in_check_mobile && isset($this->my_http_vars['bmlt_settings_id']) && is_array($this->getBMLTOptions($this->my_http_vars['bmlt_settings_id']))) { $my_option_id = $this->my_http_vars['bmlt_settings_id']; } else { - $support_mobile = preg_replace('/\D/', '', trim($this->cms_get_post_meta($page->ID, 'bmlt_mobile'))); + $cms_post_meta_mobile = isset($page->ID) && !empty($page->ID) ? $this->cms_get_post_meta($page->ID, 'bmlt_mobile') : null; + $support_mobile = preg_replace('/\D/', '', trim($cms_post_meta_mobile)); if (!$support_mobile && $in_check_mobile) { $support_mobile = self::get_shortcode($in_content, 'bmlt_mobile'); @@ -153,13 +154,13 @@ protected function cms_get_page_settings_id( if ($in_check_mobile && $support_mobile && !isset($this->my_http_vars['BMLTPlugin_mobile']) && (self::mobile_sniff_ua($this->my_http_vars) != 'xhtml')) { $my_option_id = $support_mobile; } elseif (!$in_check_mobile) { - $my_option_id = intval(preg_replace('/\D/', '', trim($this->cms_get_post_meta($page->ID, 'bmlt_settings_id')))); + $cms_post_meta_settings = isset($page->ID) && !empty($page->ID) ? $this->cms_get_post_meta($page->ID, 'bmlt_settings_id') : null; + $my_option_id = intval(preg_replace('/\D/', '', trim($cms_post_meta_settings))); if (isset($this->my_http_vars['bmlt_settings_id']) && intval($this->my_http_vars['bmlt_settings_id'])) { $my_option_id = intval($this->my_http_vars['bmlt_settings_id']); - } elseif ($in_content = $in_content ? $in_content : $page->post_content) { + } elseif ($in_content = isset($in_content) ? $in_content : (isset($page->post_content) ? $page->post_content : null)) { $my_option_id_content = parent::cms_get_page_settings_id($in_content, $in_check_mobile); - - $my_option_id = $my_option_id_content ? $my_option_id_content : $my_option_id; + $my_option_id = $my_option_id_content ?: $my_option_id; } if (!$my_option_id) { // If nothing else gives, we go for the default (first) settings. @@ -307,15 +308,15 @@ public function standard_head($from_admin = false) ///< True, if this was cal $page_id = null; $page = get_page($page_id); - $support_mobile = $this->cms_get_page_settings_id($page->post_content, true); + $support_mobile = isset($page->post_content) && !empty($page->post_content) ? $this->cms_get_page_settings_id($page->post_content, true) : null; if ($support_mobile) { $mobile_options = $this->getBMLTOptions_by_id($support_mobile); } else { $support_mobile = null; } - - $options = $this->getBMLTOptions_by_id($this->cms_get_page_settings_id($page->post_content)); + $options_standard = isset($page->post_content) && !empty($page->post_content) ? $page->post_content : null; + $options = $this->getBMLTOptions_by_id($this->cms_get_page_settings_id($options_standard)); if ($support_mobile && is_array($mobile_options) && count($mobile_options)) { $mobile_url = $_SERVER['PHP_SELF'].'?BMLTPlugin_mobile&bmlt_settings_id='.$support_mobile; @@ -343,9 +344,11 @@ public function standard_head($from_admin = false) ///< True, if this was cal || $this->get_shortcode($page->post_content, 'simple_search_list') ) { $head_content = "\n\n\n\n"; - if (!$this->get_shortcode($page->post_content, 'bmlt')) { + ## TODO: Is this right? + if (isset($page->post_content) && !$this->get_shortcode($page->post_content, 'bmlt')) { $load_head = false; } + $this->my_http_vars['start_view'] = $options['bmlt_initial_view']; @@ -417,15 +420,15 @@ public function standard_head($from_admin = false) ///< True, if this was cal $head_content .= self::stripFile('javascript.js'); - if ($this->get_shortcode($page->post_content, 'bmlt_quicksearch')) { + if (isset($page->post_content) && !empty($page->post_content) && $this->get_shortcode($page->post_content, 'bmlt_quicksearch')) { $head_content .= self::stripFile('quicksearch.js') . (defined('_DEBUG_MODE_') ? "\n" : ''); } - if ($this->get_shortcode($page->post_content, 'bmlt_map')) { + if (isset($page->post_content) && !empty($page->post_content) && $this->get_shortcode($page->post_content, 'bmlt_map')) { $head_content .= self::stripFile('map_search.js'); } - if ($this->get_shortcode($page->post_content, 'bmlt_mobile')) { + if (isset($page->post_content) && !empty($page->post_content) && $this->get_shortcode($page->post_content, 'bmlt_mobile')) { $head_content .= self::stripFile('fast_mobile_lookup.js'); } @@ -578,7 +581,7 @@ protected function set_callbacks() add_action('admin_init', array ( self::get_plugin_object(), 'admin_ajax_handler' )); add_action('admin_menu', array ( self::get_plugin_object(), 'option_menu' )); add_action('init', array ( self::get_plugin_object(), 'filter_init' )); - wp_enqueue_script("leaflet", $this->get_plugin_path() . "table_display.js", false, filemtime($this->get_plugin_path() . "table_display.js"), false); + wp_enqueue_script("table_display", $this->get_plugin_path() . "table_display.js", false, filemtime(plugin_dir_path(__FILE__) . "vendor/bmlt/bmlt-satellite-base-class/table_display.js"), false); } else { echo ""; } diff --git a/composer.json b/composer.json index be8692d..28e4c25 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,6 @@ "license": "MIT", "authors": [{ "name": "littlegreenviper" - },{ - "name": "radius314" },{ "name": "pjaudiomv" }], @@ -14,7 +12,7 @@ "squizlabs/php_codesniffer": "3.*" }, "require": { - "bmlt/bmlt-satellite-base-class": "^3.11.3", + "bmlt/bmlt-satellite-base-class": "^3.11.4", "bmlt/bmlt-satellite-driver": "1.1" } } diff --git a/composer.lock b/composer.lock index c49af2a..02806f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1622b5276658f9fe2e123a6054ab8053", + "content-hash": "1c4d3079cc220b50264598482ca76d94", "packages": [ { "name": "bmlt/bmlt-satellite-base-class", - "version": "3.11.3", + "version": "3.11.4", "source": { "type": "git", "url": "https://github.com/bmlt-enabled/bmlt-satellite-base-class.git", - "reference": "62b35df9ef9763a6b82d27dde63f222c01bc5a5f" + "reference": "b1fb2ed42815bbf9927d792bdbd347f953e960e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bmlt-enabled/bmlt-satellite-base-class/zipball/62b35df9ef9763a6b82d27dde63f222c01bc5a5f", - "reference": "62b35df9ef9763a6b82d27dde63f222c01bc5a5f", + "url": "https://api.github.com/repos/bmlt-enabled/bmlt-satellite-base-class/zipball/b1fb2ed42815bbf9927d792bdbd347f953e960e3", + "reference": "b1fb2ed42815bbf9927d792bdbd347f953e960e3", "shasum": "" }, "require": { @@ -45,9 +45,9 @@ "description": "This is a generic CMS plugin class for a BMLT satellite client.", "support": { "issues": "https://github.com/bmlt-enabled/bmlt-satellite-base-class/issues", - "source": "https://github.com/bmlt-enabled/bmlt-satellite-base-class/tree/3.11.3" + "source": "https://github.com/bmlt-enabled/bmlt-satellite-base-class/tree/3.11.4" }, - "time": "2022-09-28T19:47:46+00:00" + "time": "2022-09-29T01:30:17+00:00" }, { "name": "bmlt/bmlt-satellite-driver", diff --git a/readme.txt b/readme.txt index 2c4cea3..b33f4ea 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Tags: na, meeting list, meeting finder, maps, recovery, addiction, webservant Author: bmlt-enabled Requires at least: 4.0 Tested up to: 6.0.2 -Stable tag: 3.11.2 +Stable tag: 3.11.3 This is a "satellite" plugin for the Basic Meeting List Toolbox (BMLT). @@ -28,6 +28,9 @@ This is a standard WordPress plugin. Either use the in-dashboard installer, or m = Changelog = += 3.11.3 = +* Fixes a bunch of PHP warnings. + = 3.11.2 = * Fix for fast table display not displaying properly.