コード例 #1
0
  function saveCache()
  {
    $cache_file = $this->getCacheFile();

    $fp = fopen($cache_file, 'w+');
    if ($fp === false)
    {
      Debug :: writeError("Couldn't create cache file '{$cache_file}', perhaps wrong permissions",
      __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
      return;
    }

    fwrite($fp, "<?php\n");

    fwrite($fp, '$cache_resolved_paths = ' . var_export($this->_resolved_paths, true) . ";\n");

    fwrite($fp, "\n?>");
    fclose($fp);
  }
コード例 #2
0
 protected function _browseToHomePage()
 {
     $ch = curlInit();
     curlSetopt($ch, CURLOPT_URL, SHIPPING_FEDEX_HOME_SERVER);
     curlSetopt($ch, CURLOPT_USERAGENT, SHIPPING_FEDEX_SERVER_USERAGENT);
     curlSetopt($ch, CURLOPT_FAILONERROR, 1);
     curlSetopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curlSetopt($ch, CURLOPT_TIMEOUT, SHIPPING_FEDEX_SERVER_TIMEOUT);
     curlSetopt($ch, CURLOPT_COOKIEJAR, SHIPPING_FEDEX_SERVER_COOKIE_FILE);
     curlSetopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curlExec($ch);
     if (curlErrno($ch) != 0) {
         Debug::writeError('curl error', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('error' => curlError($ch)));
         curlClose($ch);
         return false;
     }
     curlClose($ch);
     return true;
 }
コード例 #3
0
 function writeException($e)
 {
   if(is_a($e, 'LimbException'))
     Debug :: writeError($e->getMessage(), $e->getBacktrace(), $e->getAdditionalParams());
   else
     Debug :: writeError($e->getMessage(), $e->getBacktrace());
 }
コード例 #4
0
  function _parseString(&$contents)
  {
    $lines =& preg_split("#\r\n|\r|\n#", $contents);
    unset($contents);

    if ($lines === false)
    {
      Debug::writeError("'{$this->file_path}' is empty", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
      return false;
    }

    $current_group = 'default';

    if (count($lines) == 0)
      return false;

    // check for charset
    if (preg_match("/#charset[^=]*=(.+)/", $lines[0], $match))
    {
      $this->charset = trim($match[1]);
    }

    foreach ($lines as $line)
    {
      if (($line = trim($line)) == '')
        continue;
      // removing comments after #, not after # inside ""

      $line = preg_replace('/([^"#]+|"(.*?)")|(#[^#]*)/', "\\1", $line);
      // check for new group
      if (preg_match("#^\[(.+)\]\s*$#", $line, $new_group_name_array))
      {
        $new_group_name = trim($new_group_name_array[1]);
        $current_group = $this->_parseConstants($new_group_name);

        if(!isset($this->group_values[$current_group]))
          $this->group_values[$current_group] = array();
        continue;
      }
      // check for variable
      if (preg_match("#^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_-]*)\]){0,1}(\s*)=(.*)$#", $line, $value_array))
      {
        $var_name = trim($value_array[1]);

        $var_value = trim($value_array[5]);

        if (preg_match('/^"(.*)"$/', $var_value, $m))
          $var_value = $m[1];

        $var_value = $this->_parseConstants($var_value);

        if ($value_array[2])//check for array []
        {
          if ($value_array[3]) //check for hashed array ['test']
          {
            $key_name = $value_array[3];

            if (isset($this->group_values[$current_group][$var_name]) &&
                is_array($this->group_values[$current_group][$var_name]))
              $this->group_values[$current_group][$var_name][$key_name] = $var_value;
            else
              $this->group_values[$current_group][$var_name] = array($key_name => $var_value);
          }
          else
          {
            if (isset($this->group_values[$current_group][$var_name]) &&
                is_array($this->group_values[$current_group][$var_name]))
              $this->group_values[$current_group][$var_name][] = $var_value;
            else
              $this->group_values[$current_group][$var_name] = array($var_value);
          }
        }
        else
        {
          $this->group_values[$current_group][$var_name] = $var_value;
        }
      }
    }
  }
コード例 #5
0
 static public function writeException($e)
 {
   if($e instanceof LimbException)
     Debug :: writeError($e->getMessage(), $e->getFile() . ' : ' . $e->getLine(), $e->getAdditionalParams());
   else
     Debug :: writeError($e->getMessage(), $e->getFile() . ' : ' . $e->getLine());
 }