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


PHP Config::getSiteRoot方法代码示例

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


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

示例1: index

 public function index($value, $parameters = array())
 {
     $full_url_start = Config::getSiteURL() . Config::getSiteRoot();
     return preg_replace_callback('/="(\\/[^"]+)"/ism', function ($item) use($full_url_start) {
         return '="' . Path::tidy($full_url_start . $item[1]) . '"';
     }, $value);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:7,代码来源:mod.full_urls.php

示例2: render

 public function render()
 {
     $options = $this->getConfig();
     $field_options = array_get($this->field_config, 'options', array());
     $options = array_merge($options, $field_options);
     // File options
     if ($file_dir = array_get($this->field_config, 'file_dir', false)) {
         $file_dir = trim(array_get($this->field_config, 'file_dir'), '/') . '/';
         $options['fileUpload'] = Config::getSiteRoot() . 'TRIGGER/redactor/upload?path=' . $file_dir;
         $options['fileManagerJson'] = Config::getSiteRoot() . 'TRIGGER/redactor/fetch_files?path=' . $file_dir;
         $options['plugins'][] = 'filemanager';
     }
     // Image options
     if ($image_dir = array_get($this->field_config, 'image_dir', false)) {
         $image_dir = trim(array_get($this->field_config, 'image_dir'), '/') . '/';
         $options['imageUpload'] = Config::getSiteRoot() . 'TRIGGER/redactor/upload?path=' . $image_dir;
         $options['imageManagerJson'] = Config::getSiteRoot() . 'TRIGGER/redactor/fetch_images?path=' . $image_dir;
         $options['plugins'][] = 'imagemanager';
         if ($resize = array_get($this->field_config, 'resize')) {
             $options['imageUpload'] .= '&resize=1&' . http_build_query($resize);
         }
     }
     // Enable plugins
     $supported_plugins = array('table', 'video', 'fullscreen', 'fontcolor', 'fontsize', 'fontfamily');
     foreach ($options['buttons'] as $button) {
         if (in_array($button, $supported_plugins)) {
             $options['plugins'][] = $button;
         }
     }
     $vars = array('field_id' => $this->field_id, 'field_name' => $this->fieldname, 'tabindex' => $this->tabindex, 'field_data' => $this->field_data, 'field_config' => $this->field_config, 'options' => $options);
     $template = File::get($this->getAddonLocation() . 'views/fieldtype.html');
     return Parse::template($template, $vars);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:33,代码来源:ft.redactor.php

示例3: errorRedirect

 public static function errorRedirect($errorMessage)
 {
     $_SESSION['errorMessage'] = $errorMessage;
     $errorUrl = Config::getSiteRoot() . "/error.php";
     header("Location: " . $errorUrl);
     die;
 }
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:7,代码来源:utility.php

示例4: getContent

 public function getContent()
 {
     $url = URL::assemble(Config::getSiteRoot(), $this->fetchConfig('globals_url', null, null, false, false));
     $content = ContentService::getContentByUrl($url);
     $content = current($content->extract());
     return $content;
 }
开发者ID:Synergy23,项目名称:RealEstate,代码行数:7,代码来源:tasks.globals.php

示例5: index

 public function index()
 {
     $from = $this->fetchParam('from', false);
     if (!$from) {
         return null;
     }
     // account for subfolder
     if (strpos($from, Config::getSiteRoot()) !== 0) {
         $from = Path::tidy(Config::getSiteRoot() . $from);
     }
     $from = Path::addStartingSlash($from);
     $content_set = ContentService::getContentByURL($from);
     // filter
     $content_set->filter(array('show_hidden' => $this->fetchParam('show_hidden', false, null, true, false), 'show_drafts' => $this->fetchParam('show_drafts', false, null, true, false), 'show_past' => $this->fetchParam('show_past', true, null, true), 'show_future' => $this->fetchParam('show_future', false, null, true), 'type' => 'all', 'conditions' => trim($this->fetchParam('conditions', null, false, false, false))));
     // limit
     $limit = $this->fetchParam('limit', 1, 'is_numeric');
     $offset = $this->fetchParam('offset', 0, 'is_numeric');
     $content_set->limit($limit, $offset);
     // check for results
     if (!$content_set->count()) {
         return Parse::tagLoop($this->content, array(array('no_results' => true)));
     }
     // if content is used in this entries loop, parse it
     $parse_content = (bool) preg_match(Pattern::USING_CONTENT, $this->content);
     return Parse::tagLoop($this->content, $content_set->get($parse_content), false, $this->context);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:26,代码来源:pi.get_content.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     $this->theme_assets_path = Config::getThemeAssetsPath();
     $this->theme_path = Config::getCurrentthemePath();
     $this->theme_root = Config::getTemplatesPath();
     $this->site_root = Config::getSiteRoot();
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:8,代码来源:pi.theme.php

示例7: getCurrent

 /**
  * Get the full URL for the current request.
  *
  * @param boolean  $include_root  Should this include the site root itself?
  * @return string
  */
 public static function getCurrent($include_root = true)
 {
     $url = Request::getResourceURI();
     if ($include_root) {
         $url = Config::getSiteRoot() . '/' . $url;
     }
     return self::format($url);
 }
开发者ID:nob,项目名称:joi,代码行数:14,代码来源:url.php

示例8: getURL

 /**
  * Returns the URL for a given $taxonomy and $taxonomy_slug
  *
  * @param string  $folder  Folder to use
  * @param string  $taxonomy  Taxonomy to use
  * @param string  $taxonomy_slug  Taxonomy slug to use
  * @return string
  */
 public static function getURL($folder, $taxonomy, $taxonomy_slug)
 {
     $url = Config::getSiteRoot() . '/' . $folder . '/' . $taxonomy . '/';
     $url .= Config::getTaxonomySlugify() ? Slug::make($taxonomy_slug) : $taxonomy_slug;
     // if taxonomies are not case-sensitive, make it lowercase
     if (!Config::getTaxonomyCaseSensitive()) {
         $url = strtolower($url);
     }
     return Path::tidy($url);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:18,代码来源:taxonomy.php

示例9: index

 public function index()
 {
     // we need the local path
     if (!isset($this->context['_local_path'])) {
         return '';
     }
     // local path exists, return the correct format
     $path = Config::get('_admin_path') . '.php/publish?path=' . substr($this->context['_local_path'], 1, strrpos($this->context['_local_path'], '.') - 1);
     return URL::assemble(Config::getSiteRoot(), $path);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:10,代码来源:pi.control_panel_edit_url.php

示例10: contextualize

 /**
  * Contextualizes taxonomy links for a given folder
  *
  * @param string  $folder  Folder to insert
  * @return void
  */
 public function contextualize($folder = NULL)
 {
     // this may be empty, if so, abort
     if (!$folder) {
         return;
     }
     // create the contextual URL root that we'll append the slug to
     $contextual_url_root = Config::getSiteRoot() . $folder . "/";
     // append the slug
     foreach ($this->data as $value => $parts) {
         $this->data[$value]['url'] = Path::tidy($contextual_url_root . $parts['slug']);
     }
 }
开发者ID:nob,项目名称:joi,代码行数:19,代码来源:taxonomyset.php

示例11: order_set

 private function order_set($page_order, $entry_folder)
 {
     $content_path = Config::getContentRoot();
     $entries = Statamic::get_content_tree('/' . $entry_folder, 3, 5, false, true);
     $result = array('linkage' => null, 'message' => 'Page order saved successfully!', 'status' => 'success');
     // Array to store the links of old data coupled with new data.
     // We return this to the view so we can use JS to update the pathing on the page.
     $links = array();
     // Loop over original folder structure and rename all folders to
     // reflect the new order.
     $entry_url = implode('/', explode('/', $page_order[0]->url, -1));
     $entry_url = str_replace(Config::getSiteRoot(), '', $entry_folder);
     foreach ($page_order as $page) {
         $page_url = str_replace(Config::getSiteRoot(), '/', $page->url);
         foreach ($entries as $entry) {
             // Store original folder data.
             $file_ext = pathinfo($entry['raw_url'], PATHINFO_EXTENSION);
             // used to generate the old pathing info.
             $old_slug = $entry['slug'];
             // Match on the URL to get the correct order result for this item.
             if ($page_url == $entry['url']) {
                 break;
             }
         }
         $slug = explode('/', $page->url);
         $slug = preg_replace("/^\\/(.+)/uis", "\$1", end($slug));
         $new_name = sprintf("%02d", $page->index + 1) . '.' . $slug;
         $old_name = $old_slug;
         $links[] = array('old' => $old_name, 'new' => $new_name);
         $folder_path = $content_path . "/" . $entry_folder . "/";
         // Generate pathing to pass to rename()
         $new_path = $folder_path . $new_name . '.' . $file_ext;
         $old_path = $folder_path . $old_name . '.' . $file_ext;
         if ($new_path !== $old_path) {
             // Check the old path actually exists and the new one doesn't.
             if (File::exists($old_path) && !File::exists($new_path)) {
                 rename($old_path, $new_path);
             } else {
                 $result['status'] = 'error';
                 $result['message'] = 'Aborting: Can\'t guarantee file integrity ' . 'for folders ' . $old_path . ' & ' . $new_path;
                 Log::error($result['message'], 'pagereorder_redux');
                 break;
             }
         }
     }
     if ($result['status'] !== 'error') {
         // No error, set links
         $result['linkage'] = $links;
     }
     return $result;
 }
开发者ID:fraklo,项目名称:pagereorder_redux,代码行数:51,代码来源:hooks.pagereorder_redux.php

示例12: file__render_thumbnail

 public function file__render_thumbnail()
 {
     if (!($path = Request::get('path'))) {
         exit('No path specified');
     }
     $url = Path::toAsset($this->getTransformedImage($path));
     $url = Config::getSiteRoot() !== '/' ? str_replace(Config::getSiteRoot(), '', $url) : $url;
     $file = Path::assemble(BASE_PATH, $url);
     header('Content-type: image/jpeg');
     header('Content-length: ' . filesize($file));
     if ($file = fopen($file, 'rb')) {
         fpassthru($file);
     }
     exit;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:15,代码来源:hooks.file.php

示例13: process

 public function process()
 {
     $data = json_decode($this->field_data);
     // Normalize paths if we are running in a subdirectory
     if (($site_root = Config::getSiteRoot()) != '/') {
         foreach ($data as $i => $file) {
             $data[$i] = preg_replace('#^' . $site_root . '#', '/', $file);
         }
     }
     // Turn an array with one key into a string unless we want to force it into an array
     if (count($data) == 1 && !array_get($this->settings, 'force_array', false)) {
         $data = $data[0];
     } elseif (count($data) == 0) {
         $data = '';
     }
     return $data;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:17,代码来源:ft.file.php

示例14: render

 public function render()
 {
     $base_url = Config::getSiteRoot() . 'TRIGGER/markitup/upload';
     // build file url
     $file_path = Path::tidy(array_get($this->field_config, 'file_dir') . '/');
     $file_url = "{$base_url}?path={$file_path}";
     // build image url
     $image_path = Path::tidy(array_get($this->field_config, 'image_dir') . '/');
     $image_options = array('path' => $image_path, 'is_image' => true);
     $resize_options = array_get($this->field_config, 'resize', array());
     if (count($resize_options)) {
         $image_options['resize'] = true;
         $image_options += $resize_options;
     }
     $image_options_string = http_build_query($image_options);
     $image_url = "{$base_url}?{$image_options_string}";
     // build field
     $height = isset($this->field_config['height']) ? $this->field_config['height'] . 'px' : '300px';
     $html = "\n      <textarea\n        name='{$this->fieldname}'\n        style='height:{$height}'\n        tabindex='{$this->tabindex}'\n        class='input-textarea markitup'\n        data-image-url='{$image_url}'\n        data-file-url='{$file_url}'\n      >{$this->field_data}</textarea>";
     return $html;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:21,代码来源:ft.markitup.php

示例15: breadcrumbs

 public function breadcrumbs()
 {
     $url = $this->fetchParam('from', URL::getCurrent());
     $include_home = $this->fetchParam('include_home', true, false, true);
     $reverse = $this->fetchParam('reverse', false, false, true);
     $backspace = $this->fetchParam('backspace', false, 'is_numeric', false);
     $url = Path::resolve($url);
     $crumbs = array();
     if ($url != '/') {
         $segments = explode('/', ltrim($url, '/'));
         $segment_count = count($segments);
         $segment_urls = array();
         for ($i = 1; $i <= $segment_count; $i++) {
             $segment_urls[] = implode($segments, '/');
             array_pop($segments);
         }
         # Build array of breadcrumb pages
         foreach ($segment_urls as $key => $url) {
             $crumbs[$url] = Statamic::fetch_content_by_url($url);
             $page_url = '/' . rtrim(preg_replace(Pattern::NUMERIC, '', $url), '/');
             $crumbs[$url]['url'] = $page_url;
             $crumbs[$url]['is_current'] = $page_url == URL::getCurrent();
         }
     }
     # Add homepage
     if ($include_home) {
         $crumbs['/'] = Statamic::fetch_content_by_url('/');
         $crumbs['/']['url'] = Config::getSiteRoot();
         $crumbs['/']['is_current'] = URL::getCurrent() == '/';
     }
     # correct order
     if ($reverse !== TRUE) {
         $crumbs = array_reverse($crumbs);
     }
     $output = Parse::tagLoop(trim($this->content), $crumbs);
     if ($backspace) {
         $output = substr($output, 0, -$backspace);
     }
     return $output;
 }
开发者ID:nob,项目名称:joi,代码行数:40,代码来源:pi.nav.php


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