/tests/canoo/tests/testcases/level0/2.8.0/plug-ins/plugins/deliveryDataPrepare/oxDeliveryDataPrepare/dataCommon.delivery.php

https://github.com/orchestra-io/sample-openx · PHP · 80 lines · 31 code · 10 blank · 39 comment · 2 complexity · de05e556724bb6043954ba33c2ea24cd MD5 · raw file

  1. <?php
  2. /*
  3. +---------------------------------------------------------------------------+
  4. | OpenX v${RELEASE_MAJOR_MINOR} |
  5. | =======${RELEASE_MAJOR_MINOR_DOUBLE_UNDERLINE} |
  6. | |
  7. | Copyright (c) 2003-2009 OpenX Limited |
  8. | For contact details, see: http://www.openx.org/ |
  9. | |
  10. | This program is free software; you can redistribute it and/or modify |
  11. | it under the terms of the GNU General Public License as published by |
  12. | the Free Software Foundation; either version 2 of the License, or |
  13. | (at your option) any later version. |
  14. | |
  15. | This program is distributed in the hope that it will be useful, |
  16. | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  17. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  18. | GNU General Public License for more details. |
  19. | |
  20. | You should have received a copy of the GNU General Public License |
  21. | along with this program; if not, write to the Free Software |
  22. | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
  23. +---------------------------------------------------------------------------+
  24. $Id: dataCommon.delivery.php 33425 2009-03-07 01:38:49Z chris.nutting $
  25. */
  26. /**
  27. * @package Plugin
  28. * @subpackage openxDeliveryLog
  29. */
  30. MAX_Dal_Delivery_Include();
  31. /**
  32. * Component prepares data which may be used by deliveryLog plugins
  33. * or other deliveryDataPrepare components as a base for their data preparations.
  34. * All data is stored in $GLOBALS['_MAX']['deliveryData']
  35. *
  36. * @param int $adId
  37. * @param int $zoneId
  38. */
  39. function Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon($adId, $zoneId)
  40. {
  41. // Prevent the function from running twice
  42. if (!empty($GLOBALS['_MAX']['deliveryData']['Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon'])) {
  43. return;
  44. }
  45. $GLOBALS['_MAX']['deliveryData']['Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon'] = true;
  46. $GLOBALS['_MAX']['deliveryData']['creative_id'] = $adId;
  47. $GLOBALS['_MAX']['deliveryData']['zone_id'] = $zoneId;
  48. // Calculate start date of current Operation Interval
  49. if (empty($GLOBALS['_MAX']['NOW'])) {
  50. $GLOBALS['_MAX']['NOW'] = time();
  51. }
  52. $time = $GLOBALS['_MAX']['NOW'];
  53. $oi = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'];
  54. $GLOBALS['_MAX']['deliveryData']['interval_start'] = gmdate('Y-m-d H:i:s', $time - $time % ($oi * 60));
  55. $GLOBALS['_MAX']['deliveryData']['ip_address'] = $_SERVER['REMOTE_ADDR'];
  56. }
  57. // Followig methods are required due to functions names limitations
  58. function Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon_Delivery_logRequest($adId, $zoneId)
  59. {
  60. Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon($adId, $zoneId);
  61. }
  62. function Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon_Delivery_logImpression($adId, $zoneId)
  63. {
  64. Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon($adId, $zoneId);
  65. }
  66. function Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon_Delivery_logClick($adId, $zoneId)
  67. {
  68. Plugin_deliveryDataPrepare_oxDeliveryDataPrepare_dataCommon($adId, $zoneId);
  69. }
  70. ?>