當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Url::toUri方法代碼示例

本文整理匯總了PHP中Url::toUri方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::toUri方法的具體用法?PHP Url::toUri怎麽用?PHP Url::toUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Url的用法示例。


在下文中一共展示了Url::toUri方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: uploadImage

 /**
  * Upload image
  */
 public function uploadImage()
 {
     $upload_path = Filesystem::makeDir(UPLOADS . DS . 'images' . DS . 'pages' . DS . date('Y/m/d/'));
     $filter = new Form_Filter_MachineName();
     if (!empty($_POST['editor_file_link'])) {
         $file = $upload_path . DS . $filter->value(basename($_POST['editor_file_link']));
         $info = Image::getInfo($file);
         copy($_POST['editor_file_link'], $file);
     } else {
         $image = new Upload_Image('file', array('path' => $upload_path));
         if ($image->upload()) {
             $info = $image->getInfo();
             $file = $image->file->path;
             //Ajax::json(array('succes'=>TRUE,'data'=>HTML::img(Url::toUri($image->file->path),$_POST['editor_file_alt'],array('width'=>$info->width,'height'=>$info->height))));
         }
         //Ajax::json(array('success'=>FALSE,'data'=>implode("\n",$image->errors)));
     }
     if (isset($file)) {
         if ($max = config('pages.image.max', '600x600')) {
             $size = explode('x', $max);
             sizeof($size) == 1 && ($size[1] = $size[0]);
             if ($info->width > $size[0] or $info->height > $size[1]) {
                 $image = new Image($file);
                 $image->resize($max);
                 $image->save();
             }
         }
         exit(Url::toUri($file));
     }
     exit;
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:34,代碼來源:Gear.php

示例2: image_preset

function image_preset($name, $path, $toUri = FALSE)
{
    $preset = new Image_Preset($name);
    if ($preset->load()) {
        $image = $preset->image($path)->render();
        return $toUri ? Url::toUri($image) : $image;
    }
}
開發者ID:romartyn,項目名稱:cogear,代碼行數:8,代碼來源:Gear.php

示例3: connector_action

 /**
  * Handle elFinder requests
  */
 public function connector_action()
 {
     $path = $this->user->dir();
     Filesystem::makeDir($path);
     $opts = array('root' => $path, 'URL' => Url::toUri($path), 'rootAlias' => 'Home', 'dotFiles' => false, 'dirSize' => true, 'fileMode' => 0666, 'dirMode' => 0777, 'mimeDetect' => 'internal', 'uploadAllow' => array('image/jpeg', 'image/png', 'image/gif', 'image/jpg'), 'imgLib' => 'gd', 'tmbDir' => '.thumbs', 'tmbAtOnce' => 5, 'tmbSize' => 48, 'fileURL' => true, 'dateFormat' => 'j M Y H:i');
     $fm = new elFinder_Object($opts);
     $fm->run();
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:11,代碼來源:Gear.php

示例4: get

 /**
  * Get icon uri
  *
  * @param string $name
  * @return string|boolean
  */
 public function get($name)
 {
     $file = $this->path . DS . $name . '.' . $this->ext;
     if (file_exists($file)) {
         return Url::toUri($file);
     }
     return NULL;
     //return $this->icons->$name ? Url::toUri($this->icons->$name) : NULL;
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:15,代碼來源:Set.php

示例5: render

 /**
  * Render
  */
 public function render()
 {
     $this->getAttributes();
     if ($this->value && ($this->value = Url::link(Url::toUri(UPLOADS . $this->value, ROOT, FALSE)))) {
         $tpl = new Template('Form.file');
         $tpl->assign($this->attributes);
         $tpl->value = $this->value;
         $this->code = $tpl->render();
     }
     return parent::render();
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:14,代碼來源:File.php

示例6: render

 /**
  * Render
  */
 public function render()
 {
     $this->getAttributes();
     $this->attributes->type = 'file';
     $this->attributes->class = 'ajaxed image';
     $tpl = new Template('Upload_Ajax.image');
     $tpl->assign($this->attributes);
     if ($this->value && ($this->value = Url::link(Url::toUri(UPLOADS . $this->value, ROOT, FALSE)))) {
         $tpl->value = $this->value;
         $tpl->image = $this->image;
     }
     $this->code = $tpl->render();
     return Form_Element_Abstract::render();
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:17,代碼來源:Image.php

示例7: avatar_action

 /**
  * Set avatar from social account
  * 
  * @param type $id 
  */
 public function avatar_action($id)
 {
     $loginza = new Db_ORM('users_loginza');
     $loginza->id = $id;
     if ($loginza->find() && ($this->user->id == $id or access('loginza delete_all'))) {
         if ($loginza->photo) {
             $user = new User_Object();
             $user->id = $this->user->id;
             $path = UPLOADS . DS . 'avatars' . DS . $this->user->id . DS . basename($loginza->photo);
             copy($loginza->photo, $path);
             $user->avatar = Url::toUri($path, UPLOADS);
             $user->save();
             Ajax::json(array('action' => 'reload'));
         }
     } else {
         Ajax::denied();
     }
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:23,代碼來源:Gear.php

示例8: processUpload

 /**
  * Process upload
  * 
  * @return string
  */
 protected function processUpload()
 {
     if (file_exists($this->file->path) && !$this->options->overwrite) {
         $filename = pathinfo($this->file->name, PATHINFO_FILENAME);
         $this->file->path = str_replace($filename, $filename . '_' . time(), $this->file->path);
     }
     move_uploaded_file($this->file->tmp_name, $this->file->path);
     $this->uri = Url::toUri($this->file->path, UPLOADS, FALSE);
     return $this->uri;
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:15,代碼來源:File.php

示例9: pathToUri

 /**
  * Make nice uri for file
  *
  * @param string $file
  * @param string
  */
 public static function pathToUri($file, $replace = ROOT)
 {
     return l(Url::toUri($file, $replace, FALSE));
 }
開發者ID:brussens,項目名稱:cogear2,代碼行數:10,代碼來源:Object.php

示例10: render

 /**
  * Render avatar
  *  
  * @param string $file 
  */
 public function render($preset = 'avatar.small')
 {
     $file = UPLOADS . '/' . $this->file;
     return HTML::img(Url::toUri(image_preset($preset, $file)), $this->object->login, array('class' => 'avatar'));
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:10,代碼來源:Avatar.php

示例11: load

 /**
  * Load scripts
  */
 public function load()
 {
     $path = Url::toUri(dirname(__FILE__));
     js($path . '/editor/editor.js');
     css($path . '/editor/css/editor.css');
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:9,代碼來源:Editor.php

示例12: renderFavicon

 /**
  * Render favicon
  */
 public function renderFavicon()
 {
     echo '<link rel="shortcut icon" href="' . Url::toUri(UPLOADS) . cogear()->get('theme.favicon') . '" />' . "\n";
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:7,代碼來源:Gear.php

示例13: renderLogo

 /**
  * Render site logo
  */
 public function renderLogo()
 {
     if ($logo = config('theme.logo')) {
         echo HTML::a(Url::link(), HTML::img(Url::toUri(UPLOADS . $logo), config('site.name')));
     }
 }
開發者ID:romartyn,項目名稱:cogear,代碼行數:9,代碼來源:Theme.php

示例14: render

 /**
  * Render avatar
  *
  * @param string $file
  */
 public function render($preset = 'avatar.small')
 {
     return HTML::img(Url::toUri(image_preset($preset, $this->getFile())), $this->object()->login, array('class' => 'avatar'));
 }
開發者ID:brussens,項目名稱:cogear2,代碼行數:9,代碼來源:Avatar.php


注:本文中的Url::toUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。