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


PHP Shineisp_Commons_Utilities::getTld方法代码示例

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


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

示例1: findRegistrarIDbyDomain

 /**
  * Get a record by domain name
  * @param $domain
  * @return integer
  */
 public static function findRegistrarIDbyDomain($domainname)
 {
     // Get the domain and tld extension from the domain name
     $arrdomain = Shineisp_Commons_Utilities::getTld($domainname);
     if (!empty($arrdomain[0]) && !empty($arrdomain[1])) {
         $domain = $arrdomain[0];
         $tld = $arrdomain[1];
     } else {
         throw new Exception('It was not possible get the tld extension from the domain name', "666");
     }
     // Get the code of the tld domain
     $tld = DomainsTlds::getbyTld($tld);
     if (empty($tld)) {
         throw new Exception("Tld extension has not been found or the name of the domain is malformed", "666");
     }
     $registrar = Doctrine_Query::create()->from('Registrars r')->leftJoin('r.Domains d ON d.registrars_id = r.registrars_id')->where("d.domain = ?", $domain)->andWhere('d.tld_id = ?', $tld['tld_id'])->andWhere('r.active = ?', true)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     if (!empty($registrar[0]['registrars_id']) && is_numeric($registrar[0]['registrars_id'])) {
         return $registrar[0]['registrars_id'];
     } else {
         return false;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:27,代码来源:Registrars.php

示例2: renewOrder

 /**
  * renewOrder
  * Renew of Order
  * @return orderid integer
  */
 public static function renewOrder($customer_id, $products)
 {
     $order = new Orders();
     $i = 0;
     $total = 0;
     $vat = 0;
     $tldid = null;
     // Check if there are auto-renewal services/products
     if (!self::checkAutorenewProducts($products)) {
         return false;
     }
     if (is_numeric($customer_id)) {
         $customer = Customers::getAllInfo($customer_id);
         if (count($products) > 0) {
             $order->customer_id = $customer_id;
             $order->isp_id = $customer['isp_id'];
             $order->is_renewal = true;
             $order->order_date = date('Y-m-d');
             $order->status_id = Statuses::id("tobepaid", "orders");
             // To be paid
             $order->uuid = Shineisp_Commons_Uuid::generate();
             $order->save();
             // Create the public number but I need the order id
             $order->order_number = self::formatOrderId($order->getIncremented());
             $order->save();
             // Get the generated order id
             $orderid = $order->getIncremented();
             // Log data
             Shineisp_Commons_Utilities::log("A new renewal order (" . $order->order_number . ") for " . $customer['fullname'] . " has been created successfully");
             // Add a fastlink to a order
             $link_exist = Fastlinks::findlinks($orderid, $customer_id, 'orders');
             if (count($link_exist) == 0) {
                 $link = new Fastlinks();
                 $link->controller = "orders";
                 $link->action = "edit";
                 $link->params = json_encode(array('id' => $orderid));
                 $link->customer_id = $customer_id;
                 $link->sqltable = "orders";
                 $link->id = $orderid;
                 $link->code = Shineisp_Commons_Utilities::GenerateRandomString();
                 $link->save();
             }
             if (count($products) > 0) {
                 foreach ($products as $product) {
                     $orderitem = new OrdersItems();
                     if (!empty($product['oldorderitemid']) && is_numeric($product['oldorderitemid'])) {
                         // Find the details of the old order item details
                         $oldOrderDetails = OrdersItems::find($product['oldorderitemid'], null, true);
                         // Check if the last order is present in the db and check if the product must be renewed
                         if (!empty($oldOrderDetails[0]) && $product['renew']) {
                             // Set the new order details fields
                             $orderitem->order_id = $orderid;
                             $orderitem->product_id = $oldOrderDetails[0]['product_id'];
                             $orderitem->billing_cycle_id = $oldOrderDetails[0]['billing_cycle_id'];
                             if ($product['type'] == "service") {
                                 // Get the number of the months to be sum to the expiration date of the service
                                 $date_end = Shineisp_Commons_Utilities::add_date(date($oldOrderDetails[0]['date_end']), null, BillingCycle::getMonthsNumber($oldOrderDetails[0]['billing_cycle_id']) * $oldOrderDetails[0]['quantity']);
                                 $orderitem->date_start = $oldOrderDetails[0]['date_end'];
                                 // The new order will have the date_end as date_start
                                 $orderitem->date_end = Shineisp_Commons_Utilities::formatDateIn($date_end);
                                 $orderitem->price = $oldOrderDetails[0]['price'];
                                 $orderitem->vat = $oldOrderDetails[0]['vat'];
                                 $orderitem->percentage = $oldOrderDetails[0]['percentage'];
                                 $orderitem->subtotal = $oldOrderDetails[0]['subtotal'];
                                 $orderitem->cost = $oldOrderDetails[0]['cost'];
                             } elseif ($product['type'] == "domain") {
                                 // Get the number of the months to be sum to the expiration date of the domain
                                 $parameters = json_decode($oldOrderDetails[0]['parameters'], true);
                                 $tldid = !empty($parameters['tld']) ? $parameters['tld'] : NULL;
                                 $domain = !empty($parameters['domain']['name']) ? $parameters['domain']['name'] : NULL;
                                 // get the tld information
                                 $arrdomain = Shineisp_Commons_Utilities::getTld($domain);
                                 if (!empty($arrdomain[1])) {
                                     $tld = DomainsTlds::getbyTld($arrdomain[1]);
                                     if (!empty($tld['tld_id'])) {
                                         $tax = Taxes::getTaxbyTldID($tld['tld_id']);
                                         // Check if the product has some tax to be added
                                         $orderitem->tld_id = $tld['tld_id'];
                                         if (!empty($tld['tax_id'])) {
                                             $vat = $tld['renewal_price'] * $tax['percentage'] / 100;
                                             $subtotal = $tld['renewal_price'] * ($tax['percentage'] + 100) / 100;
                                             $percentage = $tax['percentage'];
                                         } else {
                                             $vat = 0;
                                             $subtotal = $tld['renewal_price'];
                                             $percentage = 0;
                                         }
                                     }
                                 }
                                 $date_end = Shineisp_Commons_Utilities::add_date(date($product['expiring_date']), null, BillingCycle::getMonthsNumber($oldOrderDetails[0]['billing_cycle_id']) * $oldOrderDetails[0]['quantity']);
                                 $orderitem->date_start = $product['expiring_date'];
                                 // The new order will have the date_end as date_start
                                 $orderitem->date_end = Shineisp_Commons_Utilities::formatDateIn($date_end);
                                 $orderitem->parameters = json_encode(array('domain' => array('name' => trim($domain), 'tld' => $tldid, 'action' => 'renewDomain', 'authinfo' => null)));
                                 $orderitem->vat = $vat;
//.........这里部分代码省略.........
开发者ID:kokkez,项目名称:shineisp,代码行数:101,代码来源:Orders.php

示例3: getRegistrarsIDbyName

 /**
  * getRegistrarsIDbyName
  * Get the domain id starting from the domain name
  * @param unknown_type $domain
  */
 public static function getRegistrarsIDbyName($domainname)
 {
     // Get the domain and tld extension from the domain name
     $arrdomain = Shineisp_Commons_Utilities::getTld($domainname);
     if (!empty($arrdomain[0]) && !empty($arrdomain[1])) {
         $domain = $arrdomain[0];
         $tld = $arrdomain[1];
     } else {
         throw new Exception('It was not possible get the tld extension from the domain name', "666");
     }
     $record = Doctrine_Query::create()->select("domain_id, registrars_id")->from('Domains d')->leftJoin('d.Customers c')->where('domain = ?', $domain)->andWhere('tld = ?', $tld)->addWhere("c.isp_id = ?", Isp::getCurrentId())->execute(null, Doctrine::HYDRATE_ARRAY);
     if (!empty($record[0]['registrars_id'])) {
         return $record[0]['registrars_id'];
     } else {
         return false;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:22,代码来源:Domains.php


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