[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/ -> MP_ip_provider_.class.php (source)

   1  <?php
   2  abstract class MP_ip_provider_
   3  {
   4  	function __construct()
   5      {
   6          add_filter('MailPress_ip_providers_register',     array($this, 'register'), 8, 1);
   7          add_filter('MailPress_ip_url_'     . $this->id, array($this, 'url'), 8, 1);
   8          add_filter('MailPress_ip_content_' . $this->id, array($this, 'content'), 8, 2);
   9          add_filter('MailPress_ip_data_'    . $this->id, array($this, 'data'), 8, 2);
  10      }
  11  
  12  	function register($providers)
  13      {
  14          $providers[$this->id] = array('id' => $this->id, 'url' => $this->url, 'credit' => $this->credit, 'type' => $this->type);
  15          return $providers;
  16      }
  17  
  18  	function url($arg)
  19      {
  20          return $arg;
  21      }
  22  
  23  	function cache_custom($ip, $geo = false, $country = false, $subcountry = false, $html = false)
  24      {
  25          $stores = array('geo', 'country', 'subcountry', 'html');
  26  
  27          $content['provider']['id']      = $this->id;
  28          $content['provider']['credit'] = $this->credit;
  29  
  30          foreach ($stores as $store) 
  31          {
  32              if (empty($$store))     continue;
  33              if (!$$store)        continue;
  34              $content[$store] = $$store;
  35          }
  36  
  37          file_put_contents(MP_ABSPATH . 'tmp/' . $ip . '.spc', serialize($content));
  38  
  39          return $content;
  40      }
  41  
  42  	function xml2array($input, $recurse = false)
  43      {
  44              $data = ((!$recurse) && is_string($input)) ? simplexml_load_string($input): $input;
  45              if ($data instanceof SimpleXMLElement) $data = (array) $data;
  46              if (is_array($data)) foreach ($data as &$item) $item = $this->xml2array($item, true);
  47              return $data;
  48      }
  49  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1