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


PHP AJXP_Utils::getRemoteContent方法代码示例

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


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

示例1: jumploaderInstallApplet

 public function jumploaderInstallApplet($params)
 {
     if (is_file($this->getBaseDir() . "/jumploader_z.jar")) {
         return "ERROR: The applet is already installed!";
     }
     $fileData = AJXP_Utils::getRemoteContent("http://jumploader.com/jar/jumploader_z.jar");
     if (!is_writable($this->getBaseDir())) {
         file_put_contents(AJXP_CACHE_DIR . "/jumploader_z.jar", $fileData);
         return "ERROR: The applet was downloaded, but the folder plugins/uploader.jumploader is not writeable. Applet is located in the cache folder, please put it manually in the plugin folder.";
     } else {
         file_put_contents($this->getBaseDir() . "/jumploader_z.jar", $fileData);
         return "SUCCESS: Installed applet successfully!";
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:14,代码来源:class.JumploaderProcessor.php

示例2: postProcess

 public function postProcess($action, $httpVars, $params)
 {
     $jsonData = json_decode($params["ob_output"], true);
     if ($jsonData != false) {
         $url = $jsonData["publiclet_link"];
         $elementId = $jsonData["element_id"];
     } else {
         $url = $params["ob_output"];
         $elementId = -1;
     }
     $BITLY_USER = $this->getFilteredOption("BITLY_USER");
     $BITLY_APIKEY = $this->getFilteredOption("BITLY_APIKEY");
     if (empty($BITLY_USER) || empty($BITLY_APIKEY)) {
         print $url;
         $this->logError("Config", "Bitly Shortener : you must drop the conf.shorten.bitly.inc file inside conf.php and set the login/api key!");
         return;
     }
     $bitly_login = $BITLY_USER;
     $bitly_api = $BITLY_APIKEY;
     $format = 'json';
     $version = '2.0.1';
     $bitly = 'http://api.bit.ly/shorten?version=' . $version . '&longUrl=' . urlencode($url) . '&login=' . $bitly_login . '&apiKey=' . $bitly_api . '&format=' . $format;
     $response = AJXP_Utils::getRemoteContent($bitly);
     $json = json_decode($response, true);
     if (isset($json['results'][$url]['shortUrl'])) {
         print $json['results'][$url]['shortUrl'];
         $this->updateMetaShort($httpVars["file"], $elementId, $json['results'][$url]['shortUrl']);
     } else {
         print $url;
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:31,代码来源:class.BitlyShortener.php

示例3: postProcess

 public function postProcess($action, $httpVars, $params)
 {
     $url = $params["ob_output"];
     if (!isset($this->pluginConf["BITLY_USER"]) || !isset($this->pluginConf["BITLY_APIKEY"])) {
         print $url;
         AJXP_Logger::logAction("error", "Bitly Shortener : you must drop the conf.shorten.bitly.inc file inside conf.php and set the login/api key!");
         return;
     }
     $bitly_login = $this->pluginConf["BITLY_USER"];
     $bitly_api = $this->pluginConf["BITLY_APIKEY"];
     $format = 'json';
     $version = '2.0.1';
     $bitly = 'http://api.bit.ly/shorten?version=' . $version . '&longUrl=' . urlencode($url) . '&login=' . $bitly_login . '&apiKey=' . $bitly_api . '&format=' . $format;
     $response = AJXP_Utils::getRemoteContent($bitly);
     $json = json_decode($response, true);
     if (isset($json['results'][$url]['shortUrl'])) {
         print $json['results'][$url]['shortUrl'];
         $this->updateMetaShort($httpVars["file"], $json['results'][$url]['shortUrl']);
     } else {
         print $url;
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:22,代码来源:class.BitlyShortener.php

示例4: downloadArchive

 public function downloadArchive()
 {
     $this->archive = $this->workingFolder . "/" . basename($this->archiveURL);
     if ($this->debugMode && is_file($this->archive)) {
         return "Already downloaded";
     }
     if (self::$context) {
         $content = file_get_contents($this->archiveURL, null, self::$context);
     } else {
         $content = AJXP_Utils::getRemoteContent($this->archiveURL);
     }
     if ($content === false || strlen($content) == 0) {
         throw new Exception("Error while downloading");
     }
     file_put_contents($this->archive, $content);
     return "File saved in " . $this->archive;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:17,代码来源:class.AjaXplorerUpgrader.php

示例5: postProcess

 public function postProcess($action, $httpVars, $params)
 {
     $type = $this->getFilteredOption("SHORTEN_TYPE");
     if (empty($type)) {
         return;
     }
     $jsonData = json_decode($params["ob_output"], true);
     $elementId = -1;
     if ($jsonData != false) {
         $url = $jsonData["publiclet_link"];
         $elementId = $jsonData["element_id"];
     } else {
         $url = $params["ob_output"];
     }
     switch (intval($type["shorten_type"])) {
         case 0:
             if (!isset($type["ADFLY_TYPE"]) || !isset($type["ADFLY_APIKEY"]) || !isset($type["ADFLY_UID"]) || !isset($type["ADFLY_DOMAIN"])) {
                 print $url;
                 $this->logError("Config", "adFly Shortener : you must set the api key!");
                 return;
             }
             $adfly_type = $type["ADFLY_TYPE"];
             $adfly_api = $type["ADFLY_APIKEY"];
             $adfly_uid = $type["ADFLY_UID"];
             $adfly_dom = $type["ADFLY_DOMAIN"];
             $adfly = 'http://api.adf.ly/api.php?key=' . $adfly_api . '&uid=' . $adfly_uid . '&advert_type=' . $adfly_type . '&domain=' . $adfly_dom . '&url=' . urlencode($url);
             $response = AJXP_Utils::getRemoteContent($adfly);
             $response = strip_tags($response, '<body>');
             $response = strip_tags($response);
             if (isset($response)) {
                 print $response;
                 $this->updateMetaShort($httpVars["file"], $elementId, $response);
             } else {
                 print $url;
             }
             break;
         case 1:
             if (!isset($type["BITLY_USER"]) || !isset($type["BITLY_APIKEY"])) {
                 print $url;
                 $this->logError("Config", "Bitly Shortener : you must drop the conf.shorten.bitly.inc file inside conf.php and set the login/api key!");
                 return;
             }
             $bitly_login = $type["BITLY_USER"];
             $bitly_api = $type["BITLY_APIKEY"];
             $format = 'json';
             $version = '2.0.1';
             $bitly = 'http://api.bit.ly/shorten?version=' . $version . '&longUrl=' . urlencode($url) . '&login=' . $bitly_login . '&apiKey=' . $bitly_api . '&format=' . $format;
             $response = AJXP_Utils::getRemoteContent($bitly);
             $json = json_decode($response, true);
             if (isset($json['results'][$url]['shortUrl'])) {
                 print $json['results'][$url]['shortUrl'];
                 $this->updateMetaShort($httpVars["file"], $elementId, $json['results'][$url]['shortUrl']);
             } else {
                 print $url;
             }
             break;
         case 2:
             if (!isset($type["GOOGL_APIKEY"])) {
                 print $url;
                 $this->logError("Config", "Goo.gl Shortener : you must set the api key!");
                 return;
             }
             $data = array('longUrl' => $url, 'key' => $type["GOOGL_APIKEY"]);
             $options = array('http' => array('method' => 'POST', 'content' => json_encode($data), 'header' => "Content-Type: application/json\r\n" . "Accept: application/json\r\n"));
             $goourl = 'https://www.googleapis.com/urlshortener/v1/url';
             $context = stream_context_create($options);
             $result = file_get_contents($goourl, false, $context);
             $json = (array) json_decode($result);
             if (isset($json['id'])) {
                 print $json['id'];
                 $this->updateMetaShort($httpVars["file"], $elementId, $json['id']);
             } else {
                 print $url;
             }
             break;
         case 3:
             if (!isset($type["POST_APIKEY"])) {
                 print $url;
                 $this->logError("Config", "po.st Shortener : you must set the api key!");
                 return;
             }
             $post_api = $type["POST_APIKEY"];
             $post = 'http://po.st/api/shorten?longUrl=' . urlencode($url) . '&apiKey=' . $post_api . '&format=txt';
             $response = AJXP_Utils::getRemoteContent($post);
             if (isset($response)) {
                 print $response;
                 $this->updateMetaShort($httpVars["file"], $elementId, $response);
             } else {
                 print $url;
             }
             break;
         case 4:
             if (!isset($type["YOURLS_DOMAIN"])) {
                 print $url;
                 $this->logError("Config", "yourls Shortener : you must set the domain name");
                 return;
             }
             if (!isset($type["YOURLS_APIKEY"])) {
                 print $url;
                 $this->logError("Config", "yourls Shortener : you must set the api key");
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.multiShortener.php

示例6: switchAction

 public function switchAction($action, $httpVars, $filesVars)
 {
     if (!isset($this->actions[$action])) {
         return false;
     }
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(true)) {
         return false;
     }
     $streamData = $repository->streamData;
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
     if ($action == "post_to_zohoserver") {
         $sheetExt = explode(",", "xls,xlsx,ods,sxc,csv,tsv");
         $presExt = explode(",", "ppt,pps,odp,sxi");
         $docExt = explode(",", "doc,docx,rtf,odt,sxw");
         require_once AJXP_BIN_FOLDER . "/http_class/http_class.php";
         $selection = new UserSelection($repository, $httpVars);
         // Backward compat
         if (strpos($httpVars["file"], "base64encoded:") !== 0) {
             $file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
         } else {
             $file = $selection->getUniqueFile();
         }
         $target = base64_decode($httpVars["parent_url"]);
         $tmp = call_user_func(array($streamData["classname"], "getRealFSReference"), $destStreamURL . $file);
         $tmp = SystemTextEncoding::fromUTF8($tmp);
         $node = new AJXP_Node($destStreamURL . $file);
         AJXP_Controller::applyHook("node.read", array($node));
         $this->logInfo('Preview', 'Posting content of ' . $file . ' to Zoho server');
         $extension = strtolower(pathinfo(urlencode(basename($file)), PATHINFO_EXTENSION));
         $httpClient = new http_class();
         $httpClient->request_method = "POST";
         $secureToken = $httpVars["secure_token"];
         $_SESSION["ZOHO_CURRENT_EDITED"] = $destStreamURL . $file;
         $_SESSION["ZOHO_CURRENT_UUID"] = md5(rand() . "-" . microtime());
         if ($this->getFilteredOption("USE_ZOHO_AGENT", $repository->getId())) {
             $saveUrl = $this->getFilteredOption("ZOHO_AGENT_URL", $repository->getId());
         } else {
             $saveUrl = $target . "/" . AJXP_PLUGINS_FOLDER . "/editor.zoho/agent/save_zoho.php";
         }
         $b64Sig = $this->signID($_SESSION["ZOHO_CURRENT_UUID"]);
         $params = array('id' => $_SESSION["ZOHO_CURRENT_UUID"], 'apikey' => $this->getFilteredOption("ZOHO_API_KEY", $repository->getId()), 'output' => 'url', 'lang' => "en", 'filename' => urlencode(basename($file)), 'persistence' => 'false', 'format' => $extension, 'mode' => 'normaledit', 'saveurl' => $saveUrl . "?signature=" . $b64Sig);
         $service = "exportwriter";
         if (in_array($extension, $sheetExt)) {
             $service = "sheet";
         } else {
             if (in_array($extension, $presExt)) {
                 $service = "show";
             } else {
                 if (in_array($extension, $docExt)) {
                     $service = "exportwriter";
                 }
             }
         }
         $arguments = array();
         $httpClient->GetRequestArguments("https://" . $service . ".zoho.com/remotedoc.im", $arguments);
         $arguments["PostValues"] = $params;
         $arguments["PostFiles"] = array("content" => array("FileName" => $tmp, "Content-Type" => "automatic/name"));
         $err = $httpClient->Open($arguments);
         if (empty($err)) {
             $err = $httpClient->SendRequest($arguments);
             if (empty($err)) {
                 $response = "";
                 while (true) {
                     $body = "";
                     $error = $httpClient->ReadReplyBody($body, 1000);
                     if ($error != "" || strlen($body) == 0) {
                         break;
                     }
                     $response .= $body;
                 }
                 $result = trim($response);
                 $matchlines = explode("\n", $result);
                 $resultValues = array();
                 foreach ($matchlines as $line) {
                     list($key, $val) = explode("=", $line, 2);
                     $resultValues[$key] = $val;
                 }
                 if ($resultValues["RESULT"] == "TRUE" && isset($resultValues["URL"])) {
                     header("Location: " . $resultValues["URL"]);
                 } else {
                     echo "Zoho API Error " . $resultValues["ERROR_CODE"] . " : " . $resultValues["WARNING"];
                     echo "<script>window.parent.setTimeout(function(){parent.hideLightBox();}, 2000);</script>";
                 }
             }
             $httpClient->Close();
         }
     } else {
         if ($action == "retrieve_from_zohoagent") {
             $targetFile = $_SESSION["ZOHO_CURRENT_EDITED"];
             $id = $_SESSION["ZOHO_CURRENT_UUID"];
             $ext = pathinfo($targetFile, PATHINFO_EXTENSION);
             $node = new AJXP_Node($targetFile);
             $node->loadNodeInfo();
             AJXP_Controller::applyHook("node.before_change", array(&$node));
             $b64Sig = $this->signID($id);
             if ($this->getFilteredOption("USE_ZOHO_AGENT", $repository->getId())) {
                 $url = $this->getFilteredOption("ZOHO_AGENT_URL", $repository->getId()) . "?ajxp_action=get_file&name=" . $id . "&ext=" . $ext . "&signature=" . $b64Sig;
                 $data = AJXP_Utils::getRemoteContent($url);
                 if (strlen($data)) {
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.ZohoEditor.php


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