Example #1
0
function closure_compile($content)
{
    require_once dirname(__FILE__) . '/../../classes/httprequest/XEHttpRequest.class.php';
    $req = new XEHttpRequest('closure-compiler.appspot.com', 80);
    $ret = $req->send('/compile', 'POST', 5, array('output_info' => 'compiled_code', 'output_format' => 'text', 'compilation_level' => 'SIMPLE_OPTIMIZATIONS', 'js_code' => $content));
    return $ret->body;
}
Example #2
0
 function useRewriteModule()
 {
     if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) {
         return true;
     }
     require_once _XE_PATH_ . 'classes/httprequest/XEHttpRequest.class.php';
     $httpRequest = new XEHttpRequest($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']);
     $xeInstallPath = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php', 1));
     $output = $httpRequest->send($xeInstallPath . 'modules/install/conf/info.xml');
     return strpos($output->body, '<?xml') !== 0;
 }
 function sendApiRequest($resource, $parameters, $method, $basecamp = FALSE)
 {
     $oTextmessageModel =& getModel('textmessage');
     $config = $oTextmessageModel->getModuleConfig();
     if ($basecamp) {
         $parameters['coolsms_user'] = $config->cs_user_id;
         $api_secret = $config->cs_password;
     } else {
         $parameters['api_key'] = $config->api_key;
         $api_secret = $config->api_secret;
     }
     $parameters['salt'] = uniqid();
     $parameters['timestamp'] = strval(time());
     $parameters['User_Agent'] = 'RestTool';
     $parameters['signature'] = hash_hmac('md5', $parameters['timestamp'] . $parameters['salt'], $api_secret);
     //$parameters['handle_key'] = Context::get('handle_key');
     $query_string = sprintf("/senderid/1/%s", $resource);
     if ($method == 'GET') {
         $query_string = sprintf("%s?%s", $query_string, http_build_query($parameters));
     }
     require_once _XE_PATH_ . 'classes/httprequest/XEHttpRequest.class.php';
     $http = new XEHttpRequest('rest1.coolsms.co.kr', 80);
     $result = $http->send($query_string, $method, 10, $parameters);
     if (is_a($result, 'Object')) {
         return $result;
     }
     $output = new Object();
     $output->data = json_decode($result->body);
     if ($output->data->code) {
         $output->setError(-1);
         $output->setMessage(sprintf("%s : %s", $output->data->code, $output->data->message));
     }
     return $output;
 }