From dc33373f28e08b873e412827c88c78f15de7b8a8 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 21 Jun 2016 17:36:15 -0400 Subject: [PATCH] Some code fixes, and video code finished. --- classes/data/settings/dataSettingsGeneral.php | 8 + config/plugin.ini | 12 +- index.php | 2 +- models/front/members/detail.php | 28 ++- models/front/members/list.php | 4 +- ...1.1.10.sql => create_database_V1.1.11.sql} | 3 +- setup/databaseScripts/dbVersions.php | 1 + .../update_database_V1.1.11.sql | 12 ++ setup/hooksHelp.html | 14 ++ setup/shortcodes.php | 171 +++++++++--------- views/admin/management/index.html | 1 + views/admin/member/memberInfo.html | 2 +- views/front/members/detail.html | 26 +++ 13 files changed, 183 insertions(+), 101 deletions(-) rename setup/databaseScripts/{create_database_V1.1.10.sql => create_database_V1.1.11.sql} (99%) create mode 100644 setup/databaseScripts/update_database_V1.1.11.sql diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index 24d2a215..9a62a0d9 100644 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -787,6 +787,14 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'default' => false, 'use' => 'a' ), + + // Front-end Member Detail - Show Video + 'detail_show_video' => array( + 'field' => 'detail_show_video', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), /* * Front-end Member Detail Map Options diff --git a/config/plugin.ini b/config/plugin.ini index dc411f54..ffd7cb89 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -312,14 +312,14 @@ day_of_month_bit[31] = 'Thirty First' ; Video Types video_type[1] = 'YouTube' video_type[2] = 'Vimeo' -video_type[21] = 'MP4 File Upload' -video_type[22] = 'WebM File Upload' -video_type[23] = 'Ogg File Upload' +;video_type[21] = 'MP4 File Upload' +;video_type[22] = 'WebM File Upload' +;video_type[23] = 'Ogg File Upload' video_type_numb['YouTube'] = 1 video_type_numb['Vimeo'] = 2 -video_type_numb['MP4'] = 21 -video_type_numb['WebM'] = 22 -video_type_numb['Ogg'] = 23 +;video_type_numb['MP4'] = 21 +;video_type_numb['WebM'] = 22 +;video_type_numb['Ogg'] = 23 \ No newline at end of file diff --git a/index.php b/index.php index b9622e06..fbdb2455 100644 --- a/index.php +++ b/index.php @@ -39,7 +39,7 @@ */ define('GLM_MEMBERS_PLUGIN_VERSION', '2.1.9'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.10'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.11'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { diff --git a/models/front/members/detail.php b/models/front/members/detail.php index b0e8ae6e..e7f0e6f8 100644 --- a/models/front/members/detail.php +++ b/models/front/members/detail.php @@ -31,13 +31,13 @@ $GLOBALS['showOpts'] = array( 'map-email' => 'detail_map_show_email', 'map-categories' => 'detail_map_show_categories', 'map-credit-cards' => 'detail_map_show_creditcards', - 'map-amentities' => 'detail_map_show_amenities', + 'map-amenities' => 'detail_map_show_amenities', 'logo' => 'detail_show_logo', 'address' => 'detail_show_address', - 'street' => 'detail_show_street', + 'street' => 'detail_show_street', 'city-state-zip' => 'detail_show_citystatezip', 'country' => 'detail_show_country', - 'region' => 'detail_show_region', + 'region' => 'detail_show_region', 'description' => 'detail_show_descr', 'short-description' => 'detail_show_short_descr', 'phone' => 'detail_show_phone', @@ -47,7 +47,8 @@ $GLOBALS['showOpts'] = array( 'email' => 'detail_show_email', 'categories' => 'detail_show_categories', 'credit-cards' => 'detail_show_creditcards', - 'amentities' => 'detail_show_amenities' + 'amenities' => 'detail_show_amenities', + 'video' => 'detail_show_video' ); // Load Members data abstract @@ -293,6 +294,25 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo } } } + // Create embed code based on video type. Parse the url for the proper code. + // - 1 = youtube + // - 2 = vimeo + $video_url = $memberData['video_url']; + + if (strpos($video_url, 'youtube') !== false) { + if (strpos($video_url, 'embed') !== false) { + $memberData['video_embed'] = ''; + } else { + $memberData['video_embed'] = preg_replace("/\s*[a-zA-Z\/\/:\.]*www.youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i","",$video_url); + } + } else if (strpos($video_url, 'vimeo') !== false) { + if (strpos($video_url, 'player') !== false) { + $memberData['video_embed'] = ''; + } else { + $memberData['video_embed'] = preg_replace("/\s*[a-zA-Z\/\/:\.]*www.vimeo.com\/([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i","",$video_url); + } + } + } $expanded = htmlspecialchars($_GET['expanded']); diff --git a/models/front/members/list.php b/models/front/members/list.php index 408a5a7f..f7b0b81d 100644 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -33,7 +33,7 @@ $GLOBALS['showOpts'] = array( 'map-email' => 'list_map_show_email', 'map-categories' => 'list_map_show_categories', 'map-credit-cards' => 'list_map_show_creditcards', - 'map-amentities' => 'list_map_show_amenities', + 'map-amenities' => 'list_map_show_amenities', 'search' => 'list_show_search', 'search-filters-opened' => 'list_show_search_filters_opened', 'search-text' => 'list_show_search_text', @@ -57,7 +57,7 @@ $GLOBALS['showOpts'] = array( 'email' => 'list_show_email', 'categories' => 'list_show_categroies', 'credit-cards' => 'list_show_creditcards', - 'amentities' => 'list_show_amenities', + 'amenities' => 'list_show_amenities', 'packages' => 'list_show_packages', 'packages-link' => 'list_show_packages_link' ); diff --git a/setup/databaseScripts/create_database_V1.1.10.sql b/setup/databaseScripts/create_database_V1.1.11.sql similarity index 99% rename from setup/databaseScripts/create_database_V1.1.10.sql rename to setup/databaseScripts/create_database_V1.1.11.sql index f2c122c3..65645bdb 100644 --- a/setup/databaseScripts/create_database_V1.1.10.sql +++ b/setup/databaseScripts/create_database_V1.1.11.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database -- File Created: 12/09/14 15:27:15 --- Database Version: 1.1.7 +-- Database Version: 1.1.11 -- Database Creation Script -- -- To permit each query below to be executed separately, @@ -306,6 +306,7 @@ CREATE TABLE {prefix}settings_general ( detail_show_coupons BOOLEAN DEFAULT '0', detail_show_packages BOOLEAN DEFAULT '0', detail_show_events BOOLEAN DEFAULT '0', + detail_show_video BOOLEAN DEFAULT '0', detail_map_show_logo BOOLEAN DEFAULT '0', detail_map_logo_size TINYTEXT NULL, detail_map_show_descr BOOLEAN DEFAULT '0', diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index ce770d67..76a145c3 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -42,6 +42,7 @@ $glmMembersDbVersions = array( '1.1.8' => array('version' => '1.1.8', 'tables' => 14, 'date' => '6/01/16'), '1.1.9' => array('version' => '1.1.9', 'tables' => 16, 'date' => '6/13/16'), '1.1.10' => array('version' => '1.1.10', 'tables' => 16, 'date' => '6/16/16'), + '1.1.11' => array('version' => '1.1.11', 'tables' => 16, 'date' => '6/21/16'), ); diff --git a/setup/databaseScripts/update_database_V1.1.11.sql b/setup/databaseScripts/update_database_V1.1.11.sql new file mode 100644 index 00000000..5426e3a4 --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.11.sql @@ -0,0 +1,12 @@ +-- Gaslight Media Members Database +-- File Created: 6/21/16 15:19:15 +-- Database Version: 1.1.11 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashses + +-- Add new setting for showing events on member detail pages + + +ALTER TABLE {prefix}settings_general ADD COLUMN detail_show_video BOOLEAN DEFAULT true; \ No newline at end of file diff --git a/setup/hooksHelp.html b/setup/hooksHelp.html index e64b3660..31e4e2d8 100644 --- a/setup/hooksHelp.html +++ b/setup/hooksHelp.html @@ -717,6 +717,20 @@ public function glmMembersAddTabForMembers($addOnTabs) + + glm-member-db-front-members-detail-videoBefore + Filter + $memberID + + + + + glm-member-db-front-members-detail-videoAfter + Filter + $memberID + + + glm-member-db-front-members-detail-pageBottom Filter diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 9d7f833d..822cc9b4 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -69,57 +69,56 @@ $glmMembersShortcodes = array( 'action' => 'list', 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', 'attributes' => array( - 'category' => false, - 'category-name' => 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-amentities' => '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', - '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', - 'amentities' => 'list_show_amenities', - 'amenity-groups' => false, - 'packages' => 'list_show_packages', - 'packages-link' => 'list_show_packages_link', + 'category' => false, + 'category-name' => 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', + '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', + 'packages' => 'list_show_packages', + 'packages-link' => 'list_show_packages_link' ) ), 'glm-member-detail' => array( @@ -128,41 +127,41 @@ $glmMembersShortcodes = array( '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-amentities' => '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', - 'amentities' => 'detail_show_amenities', + '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' ) ) ); diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 46c23aef..ff70e93d 100644 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -367,6 +367,7 @@ Show Coupons: Show Packages: Show Events: + Show Video: diff --git a/views/admin/member/memberInfo.html b/views/admin/member/memberInfo.html index 7a0c069e..5f7e71c9 100644 --- a/views/admin/member/memberInfo.html +++ b/views/admin/member/memberInfo.html @@ -591,7 +591,7 @@ - +
Video Type: + +

{$member.video_title}

+
{$member.video_embed}
+

{$member.video_descr}

+ {foreach $member.video as $c} + + + + {/foreach} +
+ {if $c.parent_name}{$c.parent_name}: {/if}{$c.name} + {if $c.parent_name}{$c.parent_name}: {/if}{$c.name} +
+ + + {/if} + + {apply_filters('glm-member-db-front-members-detail-videoAfter', '', $member.id)} {apply_filters('glm-member-db-front-members-detail-dataBottom','',$member.id)} -- 2.17.1