当前位置: 首页>>代码示例>>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;未经允许,请勿转载。