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


PHP file::file_url方法代码示例

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


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

示例1: metaWeblog_newMediaObject

 function metaWeblog_newMediaObject($args)
 {
     global $DB;
     global $session;
     $out = array();
     list($website_id, $username, $password, $file_struct) = $args;
     // check auth
     if (metaWeblog_userAllowed($username, $password, $website_id)) {
         $file_name_tmp = uniqid('metaweblog-upload-');
         file_put_contents(NAVIGATE_PRIVATE . '/' . $website_id . '/files/' . $file_name_tmp, $file_struct['bits']);
         $file = file::register_upload($file_name_tmp, $file_struct['name'], 0, NULL, false);
         @unlink(AVIGATE_PRIVATE . '/' . $website_id . '/files/' . $file_name_tmp);
         // if everything goes fine, file is renamed, so cannot be deleted here
         $out = array('id' => $file->id, 'file' => $file->name, 'url' => file::file_url($file->id, 'inline'), 'type' => $file->mime);
     } else {
         $out = new IXR_Error(401, "User not allowed.");
     }
     return $out;
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:19,代码来源:nvweb_xmlrpc.php

示例2: core_terminate

                     $file->refresh();
                     $DB->disconnect();
                     core_terminate();
                 }
             }
         }
     }
     echo false;
     core_terminate();
 } else {
     if ($_REQUEST['engine'] == 'tinymce') {
         $DB = new database();
         $DB->connect();
         $file = file::register_upload($_FILES['file']['tmp_name'], $_FILES['file']['name'], 0, NULL, true);
         if (!empty($file)) {
             echo json_encode(array('location' => file::file_url($file->id)));
         } else {
             echo json_encode(false);
         }
         $DB->disconnect();
         core_terminate();
     } else {
         // plUpload engine
         if ($user->permission("files.upload") == "true") {
             // Get parameters
             $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
             $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
             $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
             // Clean the fileName for security reasons
             $fileName = base64_encode($fileName);
             // Remove old temp files
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:31,代码来源:navigate_upload.php

示例3: load_from_vimeo

 public function load_from_vimeo($reference, $cache = true)
 {
     global $website;
     if ($cache) {
         $cache = 30 * 24 * 60;
     } else {
         $cache = 0;
     }
     $info = nvweb_template_oembed_cache('vimeo', 'http://vimeo.com/api/oembed.json?url=http://vimeo.com/' . $reference . '&format=json', $cache);
     if (empty($info)) {
         return false;
     }
     $this->id = 'vimeo#' . $reference;
     $this->type = 'video';
     $this->name = $info->title;
     $this->size = NULL;
     $this->mime = 'video/vimeo';
     $this->width = $info->width;
     $this->height = $info->height;
     $this->uploaded_by = $info->author_name;
     $this->access = 0;
     $this->permission = 0;
     $this->enabled = 1;
     $this->video_thumbnail_retrieve($info->thumbnail_url, "vimeo", $reference);
     $this->extra = array('reference' => $info->video_id, 'link' => 'https://www.vimeo.com/' . $reference, 'thumbnail_url' => str_replace('http://', 'https://', $info->thumbnail_url), 'thumbnail_big' => str_replace('http://', 'https://', $info->thumbnail_url), 'thumbnail_cache' => 'private/' . $website->id . '/thumbnails/video-vimeo-' . $reference, 'thumbnail_cache_absolute' => file::file_url('private/' . $website->id . '/thumbnails/video-vimeo-' . $reference) . '&type=image', 'duration' => '', 'embed_code' => '<iframe src="https://player.vimeo.com/video/' . $reference . '?" frameborder="0" allowfullscreen></iframe>');
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:26,代码来源:file.class.php

示例4: generate_feed


//.........这里部分代码省略.........
                        AND (s.date_unpublish = 0 OR s.date_unpublish > ' . core_time() . ')
                        AND s.permission = 0
                        AND (s.access = 0)
                        AND (i.access = 0)
                        AND d.website = i.website
                        AND d.node_type = "item"
                        AND d.subtype = "title"
                        AND d.node_id = i.id
                        AND d.lang = ' . protect($current['lang']) . '
                      ORDER BY pdate DESC
                      LIMIT ' . $limit . '
                     OFFSET 0');
         $rs = $DB->result();
         for ($x = 0; $x < count($rs); $x++) {
             if (nvweb_object_enabled($rs[$x])) {
                 $texts = webdictionary::load_element_strings('item', $rs[$x]->id);
                 $paths = path::loadElementPaths('item', $rs[$x]->id);
                 $fitem = new FeedItem();
                 $fitem->title = $texts[$current['lang']]['title'];
                 $fitem->link = $website->absolute_path() . $paths[$current['lang']];
                 switch ($item->content) {
                     case 'title':
                         // no description
                         break;
                     case 'content':
                         $fitem->description = $texts[$current['lang']]['section-main'];
                         break;
                     case 'summary':
                     default:
                         $fitem->description = $texts[$current['lang']]['section-main'];
                         $fitem->description = str_replace(array('</p>', '<br />', '<br/>', '<br>'), array('</p>' . "\n", '<br />' . "\n", '<br/>' . "\n", '<br>' . "\n"), $fitem->description);
                         $fitem->description = core_string_cut($fitem->description, 500, '&hellip;');
                         break;
                 }
                 $fitem->date = $rs[$x]->date_to_display;
                 // find an image to attach to the item
                 // A) first enabled image in item gallery
                 // B) first image on properties
                 $image = '';
                 if (!empty($rs[$x]->galleries)) {
                     $galleries = mb_unserialize($rs[$x]->galleries);
                     $photo = @array_shift(array_keys($galleries[0]));
                     if (!empty($photo)) {
                         $image = $website->absolute_path(false) . '/object?type=image&id=' . $photo;
                     }
                 }
                 if (empty($image)) {
                     // no image found on galleries, look for image properties
                     $properties = property::load_properties("item", $rs[$x]->template, "item", $rs[$x]->id);
                     for ($p = 0; $p < count($properties); $p++) {
                         if ($properties[$p]->type == 'image') {
                             if (!empty($properties[$p]->value)) {
                                 $image = $properties[$p]->value;
                             } else {
                                 if (!empty($properties[$p]->dvalue)) {
                                     $image = $properties[$p]->dvalue;
                                 }
                             }
                             if (is_array($image)) {
                                 $image = array_values($image);
                                 $image = $image[0];
                             }
                             if (!empty($image)) {
                                 $image = $website->absolute_path(false) . '/object?type=image&id=' . $image;
                             }
                         }
                         // we only need the first image
                         if (!empty($image)) {
                             break;
                         }
                     }
                 }
                 if (!empty($image)) {
                     $fitem->image = $image;
                     // feedly will only display images of >450px --> http://blog.feedly.com/2015/07/31/10-ways-to-optimize-your-feed-for-feedly/
                     if (strpos($item->format, 'RSS') !== false) {
                         $fitem->description = '<img src="' . $image . '&width=640"><br />' . $fitem->description;
                     }
                 }
                 //$item->author = $contents->rows[$x]->author_name;
                 $feed->addItem($fitem);
             }
         }
         // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
         // MBOX, OPML, ATOM, ATOM10, ATOM0.3, HTML, JS
         //echo $rss->saveFeed("RSS1.0", "news/feed.xml");
     }
     $xml = $feed->createFeed($item->format);
     if ($item->format == "RSS2.0") {
         // add extra tweaks to improve the feed
         $xml = str_replace('<rss ', '<rss xmlns:webfeeds="http://webfeeds.org/rss/1.0" ', $xml);
         // also available:
         // <webfeeds:cover image="http://yoursite.com/a-large-cover-image.png" />\n
         // <webfeeds:accentColor>00FF00</webfeeds:accentColor>
         $xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:related layout="card" target="browser" />', $xml);
         $xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:logo>' . file::file_url($item->image) . '</webfeeds:logo>', $xml);
         $xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:icon>' . file::file_url($website->favicon) . '</webfeeds:icon>', $xml);
     }
     return $xml;
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:feed.class.php

示例5: nvweb_properties_render


//.........这里部分代码省略.........
                if ($provider == 'youtube') {
                    $embed = file::embed('youtube', $reference, $add);
                    if (!empty($vars['part']) || $vars['part'] != 'embed') {
                        $file->load_from_youtube($reference);
                    }
                } else {
                    if ($provider == 'vimeo') {
                        $embed = file::embed('vimeo', $reference, $add);
                        if (!empty($vars['part']) || $vars['part'] != 'embed') {
                            $file->load_from_vimeo($reference);
                        }
                    }
                }
            }
            switch (@$vars['return']) {
                case 'title':
                    $out = $file->title;
                    break;
                case 'mime':
                    $out = $file->mime;
                    break;
                case 'author':
                    if (is_numeric($file->uploaded_by)) {
                        $out = $website->name;
                    } else {
                        $out = $file->uploaded_by;
                    }
                    break;
                case 'path':
                case 'url':
                    $out = $file->extra['link'];
                    break;
                case 'thumbnail_url':
                    $out = file::file_url($file->extra['thumbnail_cache']) . $url_add;
                    break;
                case 'thumbnail':
                    $out = '<img src="' . file::file_url($file->extra['thumbnail_cache']) . $url_add . '" class="' . $vars['class'] . '" ' . $add . ' />';
                    break;
                case 'reference':
                    $out = $reference;
                    break;
                case 'provider':
                    $out = $provider;
                    break;
                case 'embed':
                default:
                    $out = $embed;
            }
            break;
        case 'article':
            // TO DO
            break;
        case 'category':
            $return = @$vars['return'];
            switch ($return) {
                case 'title':
                case 'name':
                    nvweb_menu_load_dictionary();
                    $out = $structure['dictionary'][$property->value];
                    break;
                case 'url':
                case 'link':
                    $out = nvweb_source_url('structure', $property->value);
                    break;
                default:
                    $out = $property->value;
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:67,代码来源:properties.php

示例6: run


//.........这里部分代码省略.........
                        // remove cached thumbnails
                        file::thumbnails_remove($item->id);
                        echo json_encode($status);
                    } else {
                        if (empty($item->focalpoint)) {
                            $item->focalpoint = '50#50';
                            $item->save();
                            // remove cached thumbnails
                            file::thumbnails_remove($item->id);
                        }
                        echo $item->focalpoint;
                    }
                    break;
                case 'video_info':
                    if ($_REQUEST['provider'] == 'youtube') {
                        $item->load_from_youtube($_REQUEST['reference'], false);
                        // force cache reload
                    } else {
                        if ($_REQUEST['provider'] == 'vimeo') {
                            $item->load_from_vimeo($_REQUEST['reference'], false);
                            // force cache reload
                        } else {
                            if (!empty($_REQUEST['reference']) && is_numeric($_REQUEST['reference'])) {
                                $item->load($_REQUEST['reference']);
                            } else {
                                if (is_numeric($_REQUEST['provider'])) {
                                    $item->load($_REQUEST['provider']);
                                } else {
                                    unset($item);
                                }
                            }
                            if (!empty($item)) {
                                // add some extra data
                                $item->extra = array('reference' => $item->id, 'link' => '', 'thumbnail' => 'img/icons/ricebowl/mimetypes/video.png', 'thumbnail_big' => 'img/icons/ricebowl/mimetypes/video.png', 'thumbnail_url' => 'img/icons/ricebowl/mimetypes/video.png', 'duration' => '', 'embed_code' => '<video src="' . file::file_url($item->id, 'inline') . '></video>');
                            }
                        }
                    }
                    if (!empty($item)) {
                        echo json_encode($item);
                    } else {
                        echo false;
                    }
                    break;
            }
            session_write_close();
            $DB->disconnect();
            exit;
            break;
        case 2:
            // show/edit item properties
        // show/edit item properties
        case "edit":
            $item->load($_REQUEST['id']);
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    unset($item);
                    $item = new file();
                    $item->load($_REQUEST['id']);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
            }
            $out = files_item_properties($item);
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:67,代码来源:files.php


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