Overview

Namespaces

  • Html2Text
  • Izberg
    • Exception
    • Resource
      • Category

Classes

  • Html2Text\Html2Text
  • Izberg\Helper
  • Izberg\Izberg
  • Izberg\Resource
  • Izberg\Resource\Address
  • Izberg\Resource\Application
  • Izberg\Resource\ApplicationCategory
  • Izberg\Resource\Attributes
  • Izberg\Resource\BillingAddress
  • Izberg\Resource\Brand
  • Izberg\Resource\Carrier
  • Izberg\Resource\Cart
  • Izberg\Resource\CartItem
  • Izberg\Resource\CartShippingChoice
  • Izberg\Resource\Category
  • Izberg\Resource\Category\CategoryAbstract
  • Izberg\Resource\Country
  • Izberg\Resource\CoverImage
  • Izberg\Resource\Currency
  • Izberg\Resource\Discount
  • Izberg\Resource\ExtraInfo
  • Izberg\Resource\Feed
  • Izberg\Resource\LocaleConfig
  • Izberg\Resource\Merchant
  • Izberg\Resource\MerchantAddress
  • Izberg\Resource\MerchantImage
  • Izberg\Resource\MerchantOrder
  • Izberg\Resource\MerchantReview
  • Izberg\Resource\Message
  • Izberg\Resource\Meta
  • Izberg\Resource\Offer
  • Izberg\Resource\OfferImage
  • Izberg\Resource\Order
  • Izberg\Resource\OrderItem
  • Izberg\Resource\Payment
  • Izberg\Resource\PaymentCardAlias
  • Izberg\Resource\Product
  • Izberg\Resource\ProductAttribute
  • Izberg\Resource\ProductBrand
  • Izberg\Resource\ProductChannel
  • Izberg\Resource\ProductChannelFileOutput
  • Izberg\Resource\Productoffer
  • Izberg\Resource\ProductOfferVariation
  • Izberg\Resource\ProductVariation
  • Izberg\Resource\ProfileImage
  • Izberg\Resource\Receiver
  • Izberg\Resource\ReturnRequest
  • Izberg\Resource\Review
  • Izberg\Resource\Sender
  • Izberg\Resource\ShippingAddress
  • Izberg\Resource\ShippingMerchantTemplate
  • Izberg\Resource\ShippingProvider
  • Izberg\Resource\ShippingProviderAssignment
  • Izberg\Resource\ShoppingPreference
  • Izberg\Resource\User
  • Izberg\Resource\Webhook

Exceptions

  • Izberg\Exception\BadRequestException
  • Izberg\Exception\ForbiddenException
  • Izberg\Exception\GenericException
  • Izberg\Exception\HttpException
  • Izberg\Exception\InternalErrorException
  • Izberg\Exception\MethodNotAllowedException
  • Izberg\Exception\NotFoundException
  • Izberg\Exception\UnauthorizedException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace Izberg;
 3: 
 4: class Helper
 5: {
 6:   /**
 7:     * Camelize a string
 8:   * @param string $value Text to camelize
 9:     */
10:   public function camelize($value)
11:   {
12:     return strtr(ucwords(strtr($value, array('_' => ' ', '.' => '_ ', '\\' => '_ '))), array(' ' => ''));
13:   }
14: 
15:   /**
16:     * Uncamelize a string
17:   * @param string $value Text to uncamelize
18:   * @param string $splitter Char to use to split
19:     */
20:   public function uncamelize($value,$splitter="_") {
21:     $value=preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', $splitter.'$0', $value));
22:     return strtolower($value);
23:   }
24: 
25:   public function readFromUrl($url, $output_file = null)
26:   {
27:     $maxTries = 3;
28:     $upload = false;
29:     for ($try=1; $try<=$maxTries; $try++) {
30:         $upload = $this->get_url_contents($url, $output_file);
31:         if ($upload) {
32:             break;
33:         }
34:     }
35:     return $upload;
36:   }
37: 
38:   private function get_url_contents($url, $output_file = null){
39:       $ch = curl_init();
40:       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
41:       curl_setopt($ch, CURLOPT_HEADER, false);
42:       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
43:       curl_setopt($ch, CURLOPT_URL, $url);
44:       curl_setopt($ch, CURLOPT_REFERER, $url);
45: 
46:       if ($output_file) {
47:         var_dump("use file");
48:         $fp = fopen ($output_file, 'w+');
49:         curl_setopt($ch, CURLOPT_FILE, $fp);
50:       } else {
51:         curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
52:       }
53: 
54:       // curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1");
55:       // curl_setopt($ch, CURLOPT_PROXYPORT, 8888);
56: 
57:       $result = curl_exec($ch);
58:       curl_close($ch);
59:       return $result;
60:     }
61: }
62: 
API documentation generated by ApiGen