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


PHP Api::getPublicKey方法代码示例

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


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

示例1: getScriptTag

    /**
     * Returns <script> sections to include Uploadcare widget
     *
     * @param string $version Uploadcare version
     * @param bool $async
     * @return string
     */
    public function getScriptTag($version = null, $async = false)
    {
        $async_attr = $async ? 'async="true"' : '';
        $result = <<<EOT
<script>UPLOADCARE_PUBLIC_KEY = "{$this->api->getPublicKey()}";</script>
<script {$async_attr} src="{$this->getScriptSrc($version)}" charset="UTF-8"></script>
EOT;
        return $result;
    }
开发者ID:awatbayazidi,项目名称:uploadcare-php,代码行数:16,代码来源:Widget.php

示例2: createGroup

 /**
  * Create group from array of File objects
  *
  * @param array $files
  * @return Group
  */
 public function createGroup($files)
 {
     $data = array('pub_key' => $this->api->getPublicKey());
     foreach ($files as $i => $file) {
         $data["files[{$i}]"] = $file->getUuid();
     }
     $ch = $this->__initRequest('group');
     $this->__setRequestType($ch);
     $this->__setData($ch, $data);
     $this->__setHeaders($ch);
     $resp = $this->__runRequest($ch);
     $group = $this->api->getGroup($resp->id);
     return $group;
 }
开发者ID:slawap,项目名称:uploadcare-php,代码行数:20,代码来源:Uploader.php

示例3: fromContent

 /**
  * Upload file from string using mime-type.
  *
  * @param string $content
  * @param string $mime_type
  * @return File
  */
 public function fromContent($content, $mime_type)
 {
     $tmpfile = tempnam(sys_get_temp_dir(), 'ucr');
     $temp = fopen($tmpfile, 'w');
     fwrite($temp, $content);
     fclose($temp);
     $data = array('UPLOADCARE_PUB_KEY' => $this->api->getPublicKey(), 'file' => sprintf('@%s;type=%s', $tmpfile, $mime_type));
     $ch = $this->__initRequest('base');
     $this->__setRequestType($ch);
     $this->__setData($ch, $data);
     $this->__setHeaders($ch);
     $data = $this->__runRequest($ch);
     $file_id = $data->file;
     return new File($file_id, $this->api);
 }
开发者ID:nemoluv,项目名称:pushwing,代码行数:22,代码来源:Uploader.php

示例4: fromPath

 /**
  * Upload file from local path.
  *
  * @param string $path
  * @param string $mime_type
  * @return File
  */
 public function fromPath($path, $mime_type = false)
 {
     if (function_exists('curl_file_create')) {
         if ($mime_type) {
             $f = curl_file_create($path, $mime_type);
         } else {
             $f = curl_file_create($path);
         }
     } else {
         if ($mime_type) {
             $f = '@' . $path . ';type=' . $mime_type;
         } else {
             $f = '@' . $path;
         }
     }
     $data = array('UPLOADCARE_PUB_KEY' => $this->api->getPublicKey(), 'file' => $f);
     $ch = $this->__initRequest('base');
     $this->__setRequestType($ch);
     $this->__setData($ch, $data);
     $this->__setHeaders($ch);
     $data = $this->__runRequest($ch);
     $file_id = $data->file;
     return new File($file_id, $this->api);
 }
开发者ID:kostya1017,项目名称:our,代码行数:31,代码来源:Uploader.php

示例5: getScriptTag

 /**
  * Returns <script> sections to include Uploadcare widget
  *
  * @param string $version Uploadcare version
  * @return string
  */
 public function getScriptTag($version = null)
 {
     $result = sprintf('<script>UPLOADCARE_PUBLIC_KEY = "%s";</script>', $this->api->getPublicKey());
     $result .= sprintf('<script async="async" src="%s"></script>', $this->getScriptSrc($version));
     return $result;
 }
开发者ID:spearous0001,项目名称:brief-blog,代码行数:12,代码来源:Widget.php


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