From 5eeeb3ffef28d3fa4c2756c6ee380fd8da110292 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 1 Dec 2016 10:31:39 -0500 Subject: [PATCH] Update for config checks on adminHook and shortcode Use $config instead of $this->config. Was getting error messages about undefined indexes when activating the member plugin. --- setup/adminHooks.php | 2 +- setup/shortcodes.php | 884 +++++++++++++++++++++---------------------- 2 files changed, 443 insertions(+), 443 deletions(-) diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 36b06a05..7a5aa073 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -128,7 +128,7 @@ function glmRemoveDashboard () { } add_action('admin_menu', 'glmRemoveDashboard'); -if ( $this->config['settings']['enable_members'] ) { +if ( isset( $config ) && isset( $config['settings'] ) && $config['settings']['enable_members'] ) { add_filter( 'glm-member-db-dashboard-member-widgets', function ( $member = null ) { diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 9f5926b0..743a8b8b 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -61,456 +61,456 @@ * ) * */ -$config = $GLOBALS['config']; -if ( $config['settings']['enable_members'] ) { -$glmMembersShortcodes = array( - 'glm-members-list' => array( - 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, - 'menu' => 'members', - 'action' => 'list', - 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', - 'attributes' => array( - 'category' => false, - 'category-name' => false, - 'category-search' => false, - 'text-search' => false, - 'amenity-search' => false, - 'region-search' => false, - 'alpha' => false, - 'blank-start' => false, - 'show' => false, - 'view' => false, - 'map' => 'list_show_map', - 'map-opened' => 'list_map_show_opened', - 'map-name-link' => 'list_map_show_detaillink', - 'map-logo' => 'list_map_show_logo', - 'map-description' => 'list_map_show_descr', - 'map-short-description' => 'list_map_show_short_descr', - 'map-address' => 'list_map_show_address', - 'map-street' => 'list_map_show_street', - 'map-city-state-zip' => 'list_map_show_citystatezip', - 'map-country' => 'list_map_show_country', - 'map-region' => 'list_map_show_region', - 'map-phone' => 'list_map_show_phone', - 'map-toll-free' => 'list_map_show_tollfree', - 'map-url' => 'list_map_show_url', - 'map-url-new-target' => 'list_map_show_url_newtarget', - 'map-email' => 'list_map_show_email', - 'map-categories' => 'list_map_show_categories', - 'map-credit-cards' => 'list_map_show_creditcards', - 'map-amenities' => 'list_map_show_amenities', - 'search' => 'list_show_search', - 'search-filters-opened' => 'list_show_search_filters_opened', - 'search-text' => 'list_show_search_text', - 'search-categories' => 'list_show_search_category', - 'search-amenities' => 'list_show_search_amenities', - 'search-alpha' => 'list_show_search_alpha', - 'list' => 'list_show_list', - 'name-link' => 'list_show_detail_link', - 'logo' => 'list_show_logo', - 'logo-filler' => 'list_show_logo_filler', - 'address' => 'list_show_address', - 'street' => 'list_show_street', - 'city-state-zip' => 'list_show_citystatezip', - 'country' => 'list_show_country', - 'region' => 'list_show_region', - 'description' => 'list_show_descr', - 'short-description' => 'list_show_short_descr', - 'phone' => 'list_show_phone', - 'toll-free' => 'list_show_tollfree', - 'url' => 'list_show_url', - 'url-new-target' => 'list_show_url_newtarget', - 'email' => 'list_show_email', - 'categories' => 'list_show_categroies', - 'credit-cards' => 'list_show_creditcards', - 'amenities' => 'list_show_amenities', - 'amenity-groups' => 'amenity-groups', - 'packages' => 'list_show_packages', - 'packages-link' => 'list_show_packages_link', +//$config = $GLOBALS['config']; +if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) { + $glmMembersShortcodes = array( + 'glm-members-list' => array( + 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, + 'menu' => 'members', + 'action' => 'list', + 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', + 'attributes' => array( + 'category' => false, + 'category-name' => false, + 'category-search' => false, + 'text-search' => false, + 'amenity-search' => false, + 'region-search' => false, + 'alpha' => false, + 'blank-start' => false, + 'show' => false, + 'view' => false, + 'map' => 'list_show_map', + 'map-opened' => 'list_map_show_opened', + 'map-name-link' => 'list_map_show_detaillink', + 'map-logo' => 'list_map_show_logo', + 'map-description' => 'list_map_show_descr', + 'map-short-description' => 'list_map_show_short_descr', + 'map-address' => 'list_map_show_address', + 'map-street' => 'list_map_show_street', + 'map-city-state-zip' => 'list_map_show_citystatezip', + 'map-country' => 'list_map_show_country', + 'map-region' => 'list_map_show_region', + 'map-phone' => 'list_map_show_phone', + 'map-toll-free' => 'list_map_show_tollfree', + 'map-url' => 'list_map_show_url', + 'map-url-new-target' => 'list_map_show_url_newtarget', + 'map-email' => 'list_map_show_email', + 'map-categories' => 'list_map_show_categories', + 'map-credit-cards' => 'list_map_show_creditcards', + 'map-amenities' => 'list_map_show_amenities', + 'search' => 'list_show_search', + 'search-filters-opened' => 'list_show_search_filters_opened', + 'search-text' => 'list_show_search_text', + 'search-categories' => 'list_show_search_category', + 'search-amenities' => 'list_show_search_amenities', + 'search-alpha' => 'list_show_search_alpha', + 'list' => 'list_show_list', + 'name-link' => 'list_show_detail_link', + 'logo' => 'list_show_logo', + 'logo-filler' => 'list_show_logo_filler', + 'address' => 'list_show_address', + 'street' => 'list_show_street', + 'city-state-zip' => 'list_show_citystatezip', + 'country' => 'list_show_country', + 'region' => 'list_show_region', + 'description' => 'list_show_descr', + 'short-description' => 'list_show_short_descr', + 'phone' => 'list_show_phone', + 'toll-free' => 'list_show_tollfree', + 'url' => 'list_show_url', + 'url-new-target' => 'list_show_url_newtarget', + 'email' => 'list_show_email', + 'categories' => 'list_show_categroies', + 'credit-cards' => 'list_show_creditcards', + 'amenities' => 'list_show_amenities', + 'amenity-groups' => 'amenity-groups', + 'packages' => 'list_show_packages', + 'packages-link' => 'list_show_packages_link', + ) + ), + 'glm-member-detail' => array( + 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, + 'menu' => 'members', + 'action' => 'detail', + 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', + 'attributes' => array( + 'id' => false, + 'show' => false, + 'map' => 'detail_show_map', + 'map-logo' => 'detail_map_show_logo', + 'map-description' => 'detail_map_show_descr', + 'map-short-description' => 'detail_map_show_short_descr', + 'map-address' => 'detail_map_show_address', + 'map-street' => 'detail_map_show_street', + 'map-city-state-zip' => 'detail_map_show_citystatezip', + 'map-country' => 'detail_map_show_country', + 'map-region' => 'detail_map_show_region', + 'map-phone' => 'detail_map_show_phone', + 'map-toll-free' => 'detail_map_show_tollfree', + 'map-url' => 'detail_map_show_url', + 'map-url-new-target' => 'detail_map_show_url_newtarget', + 'map-email' => 'detail_map_show_email', + 'map-categories' => 'detail_map_show_categories', + 'map-credit-cards' => 'detail_map_show_creditcards', + 'map-amenities' => 'detail_map_show_amenities', + 'logo' => 'detail_show_logo', + 'address' => 'detail_show_address', + 'street' => 'detail_show_street', + 'city-state-zip' => 'detail_show_citystatezip', + 'country' => 'detail_show_country', + 'region' => 'detail_show_region', + 'description' => 'detail_show_descr', + 'short-description' => 'detail_show_short_descr', + 'phone' => 'detail_show_phone', + 'toll-free' => 'detail_show_tollfree', + 'url' => 'detail_show_url', + 'url-new-target' => 'detail_show_url_newtarget', + 'email' => 'detail_show_email', + 'categories' => 'detail_show_categories', + 'credit-cards' => 'detail_show_creditcards', + 'amenities' => 'detail_show_amenities' + ) + ), + 'glm-member-featured' => array( + 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, + 'menu' => 'members', + 'action' => 'featured', + 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', + 'attributes' => array ( + 'number' => 1 + ) ) - ), - 'glm-member-detail' => array( - 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, - 'menu' => 'members', - 'action' => 'detail', - 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', - 'attributes' => array( - 'id' => false, - 'show' => false, - 'map' => 'detail_show_map', - 'map-logo' => 'detail_map_show_logo', - 'map-description' => 'detail_map_show_descr', - 'map-short-description' => 'detail_map_show_short_descr', - 'map-address' => 'detail_map_show_address', - 'map-street' => 'detail_map_show_street', - 'map-city-state-zip' => 'detail_map_show_citystatezip', - 'map-country' => 'detail_map_show_country', - 'map-region' => 'detail_map_show_region', - 'map-phone' => 'detail_map_show_phone', - 'map-toll-free' => 'detail_map_show_tollfree', - 'map-url' => 'detail_map_show_url', - 'map-url-new-target' => 'detail_map_show_url_newtarget', - 'map-email' => 'detail_map_show_email', - 'map-categories' => 'detail_map_show_categories', - 'map-credit-cards' => 'detail_map_show_creditcards', - 'map-amenities' => 'detail_map_show_amenities', - 'logo' => 'detail_show_logo', - 'address' => 'detail_show_address', - 'street' => 'detail_show_street', - 'city-state-zip' => 'detail_show_citystatezip', - 'country' => 'detail_show_country', - 'region' => 'detail_show_region', - 'description' => 'detail_show_descr', - 'short-description' => 'detail_show_short_descr', - 'phone' => 'detail_show_phone', - 'toll-free' => 'detail_show_tollfree', - 'url' => 'detail_show_url', - 'url-new-target' => 'detail_show_url_newtarget', - 'email' => 'detail_show_email', - 'categories' => 'detail_show_categories', - 'credit-cards' => 'detail_show_creditcards', - 'amenities' => 'detail_show_amenities' - ) - ), - 'glm-member-featured' => array( - 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, - 'menu' => 'members', - 'action' => 'featured', - 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', - 'attributes' => array ( - 'number' => 1 - ) - ) -); + ); -$glmMembersShortcodesDescription = ' - ShortcodeAttributeDescription - - [glm-members-list] -   - - Displays a list of members and a map with markers for each member. Optionally, - the attributes below may used to modify the display of this page. - - - -   - - category="{ category ID(s) }" - - - The "category" attribute is used to set the default display of members - to only those mnembers in a specific category or categories by specifying - the category IDs. To select multiple categories, separate the categories with a ",". - Categories are specified by ID number. The ID for each category is - shown in the Member Categories list. The selection of which members - to display may be overridded by the "category-search" parameter although - these categories will always show in the list of categories that may be - selected in the search filter form. - - - -   - - category-name="{ category name(s) }" - - - The "category-name" attribute is used to set the default display of members - to only those mnembers in a specific category or categories by specifying - the category names. To select multiple categories, separate the category - names with a ",". Category names must match the name of a - category exactly to be selected. Category names must be enclosed in quotes. - The selection of which members to display may be overridded by the "category-search" - parameter although these categories will always show in the list of categories that may be - selected in the search filter form. - - - -   - - category-search="{ a single category ID }" - - - The "category-search" attribute is used display only members in a specific category. - The ID for each category is - shown in the Member Categories list. This may be overridden by a "categorySearch" - URL parameter. This parameter does not override the categories that show in the - category selection list of the search filter form set by either "category" or - "category-name" above. - - - -   - - text-search="{ text to search for }" - - - The "text-search" attribute is used to filter results by a specified text - string. If a string is provided, the results will only include members with - this text in their name, description, short description or street address. - This may be overridden by a "testSearch" URL parameter. - - - -   - - amenity-search="{ amenity ID }" - - - The "amenity-search" attribute selects members who have the specified amenity. - The amenity is specified by ID rather than name. This may be overridden by an - "amenitySearch" URL parameter. - - - -   - - region-search="{ region ID }" - - - The "region-search" attribute selects members who are listed in the specified - region. The region is specified by ID rather than name. This may be overridden by - a "regionSearch" URL parameter. - - + $glmMembersShortcodesDescription = ' + ShortcodeAttributeDescription -   - - alpha="{ initial letter of members }" - - - The "alpha" attribute selects members with names that start with that letter/number - to be listed. This only affects the selection of what is currently displayed, not - the overall results so the full list of all letters for which there are results are - still displayed. This may be overridden by an "alpha" URL parameter. - - - - - amenity-groups="1,2" - - The "amenity-groups" attribute is used to display only the amenities that are in specific groups or a group. - Separate the groups with a "," - - + [glm-members-list] +   + + Displays a list of members and a map with markers for each member. Optionally, + the attributes below may used to modify the display of this page. + + -   - - blank-start="{True/False}" - - - The "blank-start" attribute tells the page whether or not to display the list of members - when the user first hits the page. When "blank-start" is "True", the page first displays - with the member search form but without any list of members. When the user submits their - first search, the page is re-displayed with the member list resuts. Subsequent submissions - of the page also display any results found by the search as does selection of the alpha - (letter) links. - - - -   - - show="{ content to show }" - - - The "show" attribute is used control what content should be displayed in the - member list. The default is to show the content selected in the "Management", - "General Settings" page under "Member List Page Options". -

- Content to show or not show is specified by a comma separated list of the - items listed below. Each item must be preceded by either a "+" or a "-" to - indicate whether the that content should or should not be shown. -

-

- There are two special items "all" and "none". These should not have a "+" or - "-" in front of them and should be the first item in the comma separated - list. These can be used to turn all content on or turn all content off. Any - items listed after this will add or remove those items from being displayed. -

-

- The only content that may not be disabled is the member name. This will always - show regardless of any settings, although there is a setting to show this as a - link or not as a link. -

-

- Global Options
- all - none -

-

- Map Options
- map - map-name-link - map-logo - map-opened - map-description - map-short-description - map-street - map-city-state-zip - map-address - map-region - map-phone - map-country - map-url - map-url-new-target - map-toll-free - map-categories - map-credit-cards - map-email +   + + category="{ category ID(s) }" + + + The "category" attribute is used to set the default display of members + to only those mnembers in a specific category or categories by specifying + the category IDs. To select multiple categories, separate the categories with a ",". + Categories are specified by ID number. The ID for each category is + shown in the Member Categories list. The selection of which members + to display may be overridded by the "category-search" parameter although + these categories will always show in the list of categories that may be + selected in the search filter form. + + + +   + + category-name="{ category name(s) }" + + + The "category-name" attribute is used to set the default display of members + to only those mnembers in a specific category or categories by specifying + the category names. To select multiple categories, separate the category + names with a ",". Category names must match the name of a + category exactly to be selected. Category names must be enclosed in quotes. + The selection of which members to display may be overridded by the "category-search" + parameter although these categories will always show in the list of categories that may be + selected in the search filter form. + + + +   + + category-search="{ a single category ID }" + + + The "category-search" attribute is used display only members in a specific category. + The ID for each category is + shown in the Member Categories list. This may be overridden by a "categorySearch" + URL parameter. This parameter does not override the categories that show in the + category selection list of the search filter form set by either "category" or + "category-name" above. + + + +   + + text-search="{ text to search for }" + + + The "text-search" attribute is used to filter results by a specified text + string. If a string is provided, the results will only include members with + this text in their name, description, short description or street address. + This may be overridden by a "testSearch" URL parameter. + + + +   + + amenity-search="{ amenity ID }" + + + The "amenity-search" attribute selects members who have the specified amenity. + The amenity is specified by ID rather than name. This may be overridden by an + "amenitySearch" URL parameter. + + + +   + + region-search="{ region ID }" + + + The "region-search" attribute selects members who are listed in the specified + region. The region is specified by ID rather than name. This may be overridden by + a "regionSearch" URL parameter. + + + +   + + alpha="{ initial letter of members }" + + + The "alpha" attribute selects members with names that start with that letter/number + to be listed. This only affects the selection of what is currently displayed, not + the overall results so the full list of all letters for which there are results are + still displayed. This may be overridden by an "alpha" URL parameter. + + + + + amenity-groups="1,2" + + The "amenity-groups" attribute is used to display only the amenities that are in specific groups or a group. + Separate the groups with a "," + + + +   + + blank-start="{True/False}" + + + The "blank-start" attribute tells the page whether or not to display the list of members + when the user first hits the page. When "blank-start" is "True", the page first displays + with the member search form but without any list of members. When the user submits their + first search, the page is re-displayed with the member list resuts. Subsequent submissions + of the page also display any results found by the search as does selection of the alpha + (letter) links. + + + +   + + show="{ content to show }" + + + The "show" attribute is used control what content should be displayed in the + member list. The default is to show the content selected in the "Management", + "General Settings" page under "Member List Page Options". +

+ Content to show or not show is specified by a comma separated list of the + items listed below. Each item must be preceded by either a "+" or a "-" to + indicate whether the that content should or should not be shown. +

+

+ There are two special items "all" and "none". These should not have a "+" or + "-" in front of them and should be the first item in the comma separated + list. These can be used to turn all content on or turn all content off. Any + items listed after this will add or remove those items from being displayed. +

+

+ The only content that may not be disabled is the member name. This will always + show regardless of any settings, although there is a setting to show this as a + link or not as a link. +

+

+ Global Options
+ all + none +

+

+ Map Options
+ map + map-name-link + map-logo + map-opened + map-description + map-short-description + map-street + map-city-state-zip + map-address + map-region + map-phone + map-country + map-url + map-url-new-target + map-toll-free + map-categories + map-credit-cards + map-email +

+

+ Search Form Options
+ search + search-text + search-categories + search-amenities + search-alpha + search-filters-opened + logo-filler

-

- Search Form Options
- search - search-text - search-categories - search-amenities - search-alpha - search-filters-opened - logo-filler -

-

- Member List Options
- list - name-link - logo - address - street - city-state-zip - country - region - description - short-description - phone - toll-free - url - url-new-target - email - categories - credit-cards - amenities - packages - packages-link -

- - - -   - - view="{ view to use }" - - - Current options available are: list (default), grid -

- The "view" attribute tells the page which view file to use. The "list" value will display - by default, and features a succession of page-wide rows containing an image, member contact - info, and the short description. The "grid" value will display a three-columned series of - rows showing the featured image or logo, and below it simply the name and a few links. +

+ Member List Options
+ list + name-link + logo + address + street + city-state-zip + country + region + description + short-description + phone + toll-free + url + url-new-target + email + categories + credit-cards + amenities + packages + packages-link

- - + + + +   + + view="{ view to use }" + + + Current options available are: list (default), grid +

+ The "view" attribute tells the page which view file to use. The "list" value will display + by default, and features a succession of page-wide rows containing an image, member contact + info, and the short description. The "grid" value will display a three-columned series of + rows showing the featured image or logo, and below it simply the name and a few links. +

+ + - + - - [glm-member-detail] -   - - Displays details for a specific member along with a map showing their location. The - "id" attribute below is required to specify which member to display. - - - -   - - id="{ member ID }" - - - This is an optional attribute for [glm-member-detail] that specifies the ID of - the desired member. The ID for a member is displayed both in the left column - of the member list and at the top of the Member Dashboard. Only one ID may - be specified. If this attribute is not supplied, the page will look for a - member name slug as the last part of the path in the URL and try to locate - an active member information record with "Name for URLs" set to the same - string. - - - -   - - show="{ content to show }" - - - The "show" attribute is used control what content should be displayed in - member detail. The default is to show the content selected in the "Management", - "General Settings" page under "Member Detail Page Options". -

- Content to show or not show is specified by a comma separated list of the - items listed below. Each item must be preceded by either a "+" or a "-" to - indicate whether the that content should or should not be shown. -

-

- There are two special items "all" and "none". These should not have a "+" or - "-" in front of them and should be the first item in the comma separated - list. These can be used to turn all content on or turn all content off. Any - items listed after this will add or remove those items from being displayed. -

-

- The only content that may not be disabled is the member name. This will always - show regardless of any settings, although there is a setting to show this as a - link or not as a link. -

-

- Global Options
- all - none -

-

- Map Options
- map - map-logo - map-description - map-short-description - map-address - map-street - map-city-state-zip - map-country - map-region - map-phone - map-toll-free - map-url - map-url-new-target - map-email - map-categories - map-credit-cards - map-amenities -

-

- Directions Options
- directions -

-

- Member Detail Options
- logo - address - street - city-state-zip - country - region - description - short-description - phone - toll-free - url - url-new-target - email - categories - credit-cards - amenities - -

- - -'; + + [glm-member-detail] +   + + Displays details for a specific member along with a map showing their location. The + "id" attribute below is required to specify which member to display. + + + +   + + id="{ member ID }" + + + This is an optional attribute for [glm-member-detail] that specifies the ID of + the desired member. The ID for a member is displayed both in the left column + of the member list and at the top of the Member Dashboard. Only one ID may + be specified. If this attribute is not supplied, the page will look for a + member name slug as the last part of the path in the URL and try to locate + an active member information record with "Name for URLs" set to the same + string. + + + +   + + show="{ content to show }" + + + The "show" attribute is used control what content should be displayed in + member detail. The default is to show the content selected in the "Management", + "General Settings" page under "Member Detail Page Options". +

+ Content to show or not show is specified by a comma separated list of the + items listed below. Each item must be preceded by either a "+" or a "-" to + indicate whether the that content should or should not be shown. +

+

+ There are two special items "all" and "none". These should not have a "+" or + "-" in front of them and should be the first item in the comma separated + list. These can be used to turn all content on or turn all content off. Any + items listed after this will add or remove those items from being displayed. +

+

+ The only content that may not be disabled is the member name. This will always + show regardless of any settings, although there is a setting to show this as a + link or not as a link. +

+

+ Global Options
+ all + none +

+

+ Map Options
+ map + map-logo + map-description + map-short-description + map-address + map-street + map-city-state-zip + map-country + map-region + map-phone + map-toll-free + map-url + map-url-new-target + map-email + map-categories + map-credit-cards + map-amenities +

+

+ Directions Options
+ directions +

+

+ Member Detail Options
+ logo + address + street + city-state-zip + country + region + description + short-description + phone + toll-free + url + url-new-target + email + categories + credit-cards + amenities + +

+ + + '; } else { $glmMembersShortcodes = array(); $glmMembersShortcodesDescription = ''; -- 2.17.1