From: Roland Häder Date: Tue, 27 Nov 2012 23:48:03 +0000 (+0000) Subject: Rewrote handling of 'menu adverts' to a filter. This allows e.g. ext-clickbanner... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0b4c98232a5c9c5b934a5049dc3c84ad32ab1125;p=mailer.git Rewrote handling of 'menu adverts' to a filter. This allows e.g. ext-clickbanner to register own filters on it --- diff --git a/.gitattributes b/.gitattributes index a02b84851c..662e05498a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -234,6 +234,7 @@ inc/filter/coupon_filter.php svneol=native#text/plain inc/filter/earning_filter.php svneol=native#text/plain inc/filter/forced_filter.php svneol=native#text/plain inc/filter/mediadata_filter.php svneol=native#text/plain +inc/filter/menu_filter.php svneol=native#text/plain inc/filter/online_filter.php svneol=native#text/plain inc/filter/order_filter.php svneol=native#text/plain inc/filter/other_filter.php svneol=native#text/plain diff --git a/inc/extensions/ext-menu.php b/inc/extensions/ext-menu.php index df067466fa..ef88dc00f0 100644 --- a/inc/extensions/ext-menu.php +++ b/inc/extensions/ext-menu.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.0.4'); +setThisExtensionVersion('0.0.5'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.0.0','0.0.1','0.0.2','0.0.3', '0.0.4')); +setExtensionVersionHistory(array('0.0.0','0.0.1','0.0.2','0.0.3', '0.0.4', '0.0.5')); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running @@ -57,6 +57,12 @@ switch (getExtensionMode()) { addAdminMenuSql('menu','memedit','Mitgliedsmenü editieren','Mitgliedsmenü editieren oder löschen',4); addAdminMenuSql('menu','guest_add','Gäste-Menü hinzufügen','Fügen Sie weitere Menüpunkte dem Gäste-Menü hinzu.',5); addAdminMenuSql('menu','guestedit','Gäste-Menü editieren','Gäste-Menü editieren, löschen',6); + + // Unregister filter + unregisterFilter(__FILE__, __LINE__, 'guest_menu_advert', 'ADD_GENERIC_MENU_ADVERT', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'member_menu_advert', 'ADD_GENERIC_MENU_ADVERT', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'guest_menu_advert_end', 'ADD_GENERIC_MENU_ADVERT_END', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'member_menu_advert_end', 'ADD_GENERIC_MENU_ADVERT_END', TRUE, isExtensionDryRun()); break; case 'remove': // Do stuff when removing extension @@ -108,6 +114,16 @@ switch (getExtensionMode()) { // Update notes (these will be set as task text!) setExtensionUpdateNotes("VARCHAR(50) ist zu kurz für Linktitel (wegen der dynamischen Anteile)."); break; + + case '0.0.5': // SQL queries for v0.0.5 + registerFilter(__FILE__, __LINE__, 'guest_menu_advert', 'ADD_GENERIC_MENU_ADVERT', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'member_menu_advert', 'ADD_GENERIC_MENU_ADVERT', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'guest_menu_advert_end', 'ADD_GENERIC_MENU_ADVERT_END', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'member_menu_advert_end', 'ADD_GENERIC_MENU_ADVERT_END', FALSE, TRUE, isExtensionDryRun()); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Filter hinzugefügt, die Werbeeinblendungen hinzufügen. Auf diese Filter kann später auch z.B. ext-clickbanner sich registrieren, damit die Werbung "exklusiv" angezeigt wird, muss das Flag exclusive auf TRUE gesetzt werden."); + break; } // END - switch break; diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index a4cb1d7e67..169365ac92 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -109,6 +109,7 @@ IN ( unregisterFilter(__FILE__, __LINE__, 'add_history_entry', 'ADD_HISTORY_ENTRY', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'init', 'GENERATE_FILE_SECRET_HASH', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'extra_autopurge', 'SERVER_NAME_EXTRA_AUTOPURGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'determine_menu_mode', 'DETERMINE_MENU_MODE_GENERIC', TRUE, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/filter/menu_filter.php b/inc/filter/menu_filter.php new file mode 100644 index 0000000000..efbccdfa1b --- /dev/null +++ b/inc/filter/menu_filter.php @@ -0,0 +1,74 @@ + diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 679d415d40..69b023ff4c 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -354,28 +354,38 @@ ORDER BY // Add separator $GLOBALS['rows'] .= loadTemplate('menu_separator', TRUE, $mode); - // Should we display adverts in this menu? - if ((isExtensionInstalledAndNewer('menu', '0.0.1')) && (getConfig($mode . '_menu_advert_enabled') == 'Y') && ($action != 'admin')) { - // Display advert template - $GLOBALS['rows'] .= loadTemplate('menu_' . $mode . '_advert_' . $action, TRUE); + // Prepare filter data array + $filterData = array( + 'output' => '', + 'exclusive' => FALSE, + 'action' => $action, + 'mode' => $mode, + ); - // Add separator again - $GLOBALS['rows'] .= loadTemplate('menu_separator', TRUE, $mode); - } // END - if + // Run filter chain + $filterData = runFilterChain($mode . '_menu_advert', $filterData); + + // Add content output + $GLOBALS['rows'] .= $filterData['output']; } // END - if } // END - while // Free memory SQL_FREERESULT($result_main); - // Should we display adverts in this menu? - if ((isExtensionInstalledAndNewer('menu', '0.0.1')) && (getConfig($mode . '_menu_advert_enabled') == 'Y')) { - // Add separator again - $GLOBALS['rows'] .= loadTemplate('menu_separator', TRUE, $mode); + // Prepare filter data array + $filterData = array( + 'output' => '', + 'exclusive' => FALSE, + 'action' => $action, + 'mode' => $mode, + ); + + // Run filter chain + $filterData = runFilterChain($mode . '_menu_advert_end', $filterData); - // Display advert template - $GLOBALS['rows'] .= loadTemplate('menu_' . $mode . '_advert_end', TRUE); - } // END - if + // Add content output + $GLOBALS['rows'] .= $filterData['output']; // Prepare data $content = array( diff --git a/theme/business/css/general.css b/theme/business/css/general.css index 62c550a01c..3ea07060a2 100644 --- a/theme/business/css/general.css +++ b/theme/business/css/general.css @@ -594,7 +594,7 @@ ul.show_timings_block { border: solid 1px #000000; background-color: #eeeeff; font-size: 10px; - width: 645px; + width: 685px; height: 20px; list-style: none inside; } @@ -602,7 +602,7 @@ ul.show_timings_block { .show_timings_column { background-color: #ffffff; margin-top: 2px; - width: 150px; + width: 160px; height: 14px; } diff --git a/theme/default/css/general.css b/theme/default/css/general.css index 301efebc3f..f2e0ec517a 100644 --- a/theme/default/css/general.css +++ b/theme/default/css/general.css @@ -603,7 +603,7 @@ ul.copyright_box { ul.show_timings_block { border: solid 1px #00aa44; background-color: #ddeedd; - width: 645px; + width: 685px; height: 20px; list-style: none inside; padding-left:0px; @@ -612,7 +612,7 @@ ul.show_timings_block { .show_timings_column { background-color: #eeffee; margin-top: 2px; - width: 150px; + width: 160px; height: 14px; font-size: 10px; } diff --git a/theme/desert/css/general.css b/theme/desert/css/general.css index 8c4b02dd96..4f1c2ba563 100644 --- a/theme/desert/css/general.css +++ b/theme/desert/css/general.css @@ -559,7 +559,7 @@ ul.show_timings_block { border: solid 1px #880000; background-color: #cccc99; font-size: 10px; - width: 645px; + width: 685px; height: 20px; list-style: none inside; } @@ -567,7 +567,7 @@ ul.show_timings_block { .show_timings_column { background-color: #ffffcc; margin-top: 2px; - width: 150px; + width: 160px; height: 14px; }