当前位置: 首页>>代码示例>>PHP>>正文


PHP Oara_Utilities::yearsOfDifference方法代码示例

本文整理汇总了PHP中Oara_Utilities::yearsOfDifference方法的典型用法代码示例。如果您正苦于以下问题:PHP Oara_Utilities::yearsOfDifference方法的具体用法?PHP Oara_Utilities::yearsOfDifference怎么用?PHP Oara_Utilities::yearsOfDifference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oara_Utilities的用法示例。


在下文中一共展示了Oara_Utilities::yearsOfDifference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPaymentHistory

 /**
  * (non-PHPdoc)
  *
  * @see Oara/Network/Oara_Network_Publisher_Base#getPaymentHistory()
  */
 public function getPaymentHistory()
 {
     $paymentHistory = array();
     $filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2));
     $past = new Zend_Date("01-01-2010", "dd-MM-yyyy");
     $now = new Zend_Date();
     $dateList = Oara_Utilities::yearsOfDifference($past, $now);
     $dateList[] = $now;
     foreach ($this->_siteList as $site) {
         for ($i = 0; $i < count($dateList) - 1; $i++) {
             $bdate = clone $dateList[$i];
             $edate = clone $dateList[$i + 1];
             if ($i != count($dateList) - 1) {
                 $edate->subDay(1);
             }
             echo "getting Payment for Site " . $site->id . " and year " . $bdate->toString("yyyy") . " \n\n";
             // https://65.245.193.87
             $url = "https://reportws.linksynergy.com/downloadreport.php?bdate=" . $bdate->toString("yyyyMMdd") . "&edate=" . $edate->toString("yyyyMMdd") . "&token=" . $site->secureToken . "&nid=" . $this->_nid . "&reportid=1";
             $result = file_get_contents($url);
             if (preg_match("/You cannot request/", $result)) {
                 throw new Exception("Reached the limit");
             }
             $paymentLines = str_getcsv($result, "\n");
             $number = count($paymentLines);
             for ($j = 1; $j < $number; $j++) {
                 $paymentData = str_getcsv($paymentLines[$j], ",");
                 $obj = array();
                 $date = new Zend_Date($paymentData[1], "yyyy-MM-dd");
                 $obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
                 $obj['value'] = $filter->filter($paymentData[5]);
                 $obj['method'] = "BACS";
                 $obj['pid'] = $paymentData[0];
                 $paymentHistory[] = $obj;
             }
         }
     }
     return $paymentHistory;
 }
开发者ID:rao0088,项目名称:php-oara,代码行数:43,代码来源:LinkShare.php


注:本文中的Oara_Utilities::yearsOfDifference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。