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


PHP URL::getCurrent方法代码示例

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


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

示例1: control_panel__add_to_foot

 public function control_panel__add_to_foot()
 {
     if (URL::getCurrent(false) == '/publish') {
         $html = $this->js->link(array('fullscreen.js', 'redactor.min.js'));
         $options = $this->getConfig();
         # Load image browser folder
         if (class_exists('Fieldtype_redactor') && method_exists('Fieldtype_redactor', 'get_field_settings')) {
             $field_settings = Fieldtype_redactor::get_field_settings();
             if (isset($field_settings['image_dir'])) {
                 $image_path = Path::tidy($field_settings['image_dir'] . '/');
                 $options['imageGetJson'] = Config::getSiteRoot() . "TRIGGER/redactor/fetch_images?path={$image_path}";
                 $options['imageUpload'] = Config::getSiteRoot() . "TRIGGER/redactor/upload?path={$image_path}";
             }
             if (isset($field_settings['file_dir'])) {
                 $file_path = Path::tidy($field_settings['file_dir'] . '/');
                 $options['fileUpload'] = Config::getSiteRoot() . "TRIGGER/redactor/upload?path={$file_path}";
             }
             if (isset($field_settings['image_dir_append_slug'])) {
                 $options['uploadFields'] = array('subfolder' => '#publish-slug');
             }
         }
         $redactor_options = json_encode($options, JSON_FORCE_OBJECT);
         $html .= "<script>\n\n                var redactor_options = {$redactor_options};\n\n                \$(document).ready(\n                  function() {\n                    \$.extend(redactor_options, {'imageUploadErrorCallback': callback});\n                    \$('.redactor-container textarea').redactor(redactor_options);\n                  }\n\n                );\n\n\n                \$('body').on('addRow', '.grid', function() {\n                  \$.extend(redactor_options, {'imageUploadErrorCallback': callback});\n                  \$('.redactor-container textarea').redactor(redactor_options);\n                });\n\n                function callback(obj, json) {\n                  alert(json.error);\n                }\n              </script>";
         return $html;
     }
 }
开发者ID:nob,项目名称:joi,代码行数:26,代码来源:hooks.redactor.php

示例2: control_panel__add_to_foot

 /**
  * Add JS to footer
  *
  */
 public function control_panel__add_to_foot()
 {
     // Get the necessary support .js
     if (URL::getCurrent(false) == '/publish') {
         return $this->js->link('build/fileclerk.min.js');
     }
 }
开发者ID:omadahealth,项目名称:Statamic-File-Clerk,代码行数:11,代码来源:hooks.fileclerk.php

示例3: control_panel__add_to_head

 public function control_panel__add_to_head()
 {
     if (URL::getCurrent(false) == '/publish') {
         $file = 'defined-links.json';
         $current_content_list = file_get_contents($file, true);
         $current_content_list = json_decode($current_content_list);
         $content_set = ContentService::getContentByFolders(array("/*"));
         $content_set->multisort('url');
         $content_set = $content_set->get();
         $content_list = [];
         $content_list[] = ['name' => 'Select...', 'url' => false];
         foreach ($content_set as $content) {
             if (isset($content['url']) && isset($content['title'])) {
                 $name = '[' . $content['url'] . '] ' . $content['title'];
                 $url = $content['url'];
                 $content_list[] = ['name' => $name, 'url' => $url];
             }
         }
         if ($current_content_list !== $content_list) {
             $json = json_encode($content_list);
             file_put_contents($file, $json, FILE_USE_INCLUDE_PATH);
         }
         return $this->js->link('definedlinks.js');
     }
 }
开发者ID:highpanda,项目名称:statamic-definedlinks,代码行数:25,代码来源:hooks.definedlinks.php

示例4: index

 /**
  * The {{ all_the_vars }} tag
  *
  * @return string
  */
 public function index()
 {
     $remove_underscored = $this->fetchParam('remove_underscored', true, null, true);
     // Tidy up the context values
     $context = $this->context;
     foreach ($context as $key => $val) {
         // Remove objects. You can't use them in templates.
         if (is_object($val)) {
             unset($context[$key]);
         }
         // Remove underscored variables.
         if ($remove_underscored && Pattern::startsWith($key, '_')) {
             unset($context[$key]);
         }
     }
     // Get extra page data
     $this->page_data = Content::get(URL::getCurrent());
     // CSS
     $output = $this->css->link('all_the_vars');
     if (!$this->fetchParam('websafe_font', false, null, true)) {
         $output .= '<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu+Mono" />';
     }
     // Create table
     $output .= $this->createTable($context, false);
     // Display on the screen
     die($output);
 }
开发者ID:jeffreyDcreative,项目名称:gkp,代码行数:32,代码来源:pi.all_the_vars.php

示例5: control_panel__add_to_foot

 public function control_panel__add_to_foot()
 {
     // only needed on publish pages
     if (URL::getCurrent(false) !== '/publish') {
         return "";
     }
     return $this->js->link('section_tabs');
 }
开发者ID:mindmergedesign,项目名称:statamic-section-tabs,代码行数:8,代码来源:hooks.section_tabs.php

示例6: control_panel__add_to_foot

 public function control_panel__add_to_foot()
 {
     // only needed on publish pages
     if (URL::getCurrent(false) !== '/globes') {
         return '';
     }
     return $this->js->link('globes');
 }
开发者ID:QDigitalStudio,项目名称:statamic-globes,代码行数:8,代码来源:hooks.globes.php

示例7: getParent

 /**
  * Retrieve the parent page
  * @return Array Array containing the content of the parent page
  */
 private function getParent()
 {
     $parent = URL::assemble(URL::popLastSegment(URL::getCurrent()));
     if (Taxonomy::isTaxonomyURL($parent)) {
         $parent = URL::popLastSegment($parent);
     }
     return Content::get($parent);
 }
开发者ID:Synergy23,项目名称:blackandwhite,代码行数:12,代码来源:pi.parent.php

示例8: control_panel__add_to_foot

 public function control_panel__add_to_foot()
 {
     if (URL::getCurrent(false) === '/entries') {
         $add_on = 'pagereorder_redux';
         $base_url = Config::get('_site_url', '/');
         return '<script type="text/javascript" src="' . $base_url . '/_add-ons/' . $add_on . '/js/jquery.' . $add_on . '.js"></script>';
     }
 }
开发者ID:fraklo,项目名称:pagereorder_redux,代码行数:8,代码来源:hooks.pagereorder_redux.php

示例9: control_panel__add_to_head

 public function control_panel__add_to_head()
 {
     if (URL::getCurrent(false) == '/publish') {
         // Inject JS & CSS file to head
         $js = $this->js->link('wChar.min.js');
         $css = $this->css->link('limited.css');
         return $js . $css;
     }
 }
开发者ID:Bferreira5,项目名称:Theme-Example,代码行数:9,代码来源:hooks.limited.php

示例10: control_panel__add_to_foot

 /**
  * Creates JavaScript to add to the Control Panel's footer
  *
  * @return string
  */
 function control_panel__add_to_foot()
 {
     if (URL::getCurrent() == '/publish') {
         $html = $this->js->link('jquery.spectrum.js');
         // load in global options
         $spectrum_options = json_encode($this->getConfig());
         $html .= $this->js->inline("\n                    var spectrum_options = {$spectrum_options};\n                    \$(document).ready(function() {\n                        \$('input[type=text].colorpicker').each(function() {\n                            var preferences = \$.extend({}, spectrum_options, \$(this).data('spectrum'));\n                            \$(this)\n                                .spectrum({\n                                    color: \$(this).val() || preferences.starting_color,\n                                    flat: preferences.select_on_page,\n                                    showInput: preferences.show_input,\n                                    showInitial: preferences.show_initial,\n                                    showAlpha: preferences.show_alpha,\n                                    localStorageKey: preferences.local_storage_key,\n                                    showPalette: preferences.show_palette,\n                                    showPaletteOnly: preferences.show_palette_only,\n                                    showSelectionPalette: preferences.show_selection_palette,\n                                    cancelText: preferences.cancel_text,\n                                    chooseText: preferences.choose_text,\n                                    preferredFormat: preferences.preferred_format,\n                                    maxSelectionSize: preferences.max_selection_size,\n                                    palette: preferences.palette\n                                });\n                        });\n\n                        // for dynamically loaded rows\n                        \$('body').on('addRow', '.grid', function() {\n                            var input = \$(this).find('input[type=text].colorpicker');\n\n                            input\n                                .each(function() {\n                                    var preferences = \$.extend({}, spectrum_options, \$(this).data('spectrum'));\n\n                                    // check for already-initialized fields\n                                    if (\$(this).next().is('.sp-replacer')) {\n                                        return;\n                                    }\n\n                                    \$(this)\n                                        .spectrum({\n                                            color: \$(this).val() || preferences.starting_color,\n                                            flat: preferences.select_on_page,\n                                            showInput: preferences.show_input,\n                                            showInitial: preferences.show_initial,\n                                            showAlpha: preferences.show_alpha,\n                                            localStorageKey: preferences.local_storage_key,\n                                            showPalette: preferences.show_palette,\n                                            showPaletteOnly: preferences.show_palette_only,\n                                            showSelectionPalette: preferences.show_selection_palette,\n                                            cancelText: preferences.cancel_text,\n                                            chooseText: preferences.choose_text,\n                                            preferredFormat: preferences.preferred_format,\n                                            maxSelectionSize: preferences.max_selection_size,\n                                            palette: preferences.palette\n                                        });\n                                });\n                        });\n                    });\n                ");
         return $html;
     }
 }
开发者ID:nob,项目名称:joi,代码行数:15,代码来源:hooks.color.php

示例11: control_panel__add_to_head

 public function control_panel__add_to_head()
 {
     if (URL::getCurrent(false) != '/publish' && URL::getCurrent(false) != '/member') {
         return;
     }
     $config = array('max_files' => 1, 'allowed' => array(), 'destination' => 'UPLOAD_PATH', 'browse' => false);
     $fieldtype = Fieldtype::render_fieldtype('file', 'markituploader', $config, null, null, 'markituploader', 'markituploader');
     $template = File::get($this->getAddonLocation() . 'views/modal.html');
     return $this->js->inline('Statamic.markituploader = ' . json_encode(Parse::template($template, compact('fieldtype'))) . ';');
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:10,代码来源:hooks.markitup.php

示例12: control_panel__add_to_foot

 /**
  * Creates JavaScript to add to the Control Panel's footer
  *
  * @return string
  */
 function control_panel__add_to_foot()
 {
     if (URL::getCurrent(false) == '/publish') {
         $html = $this->js->link('jquery.spectrum.js');
         // load in global options
         $spectrum_options = json_encode($this->getConfig());
         $html .= $this->js->inline("\n                    var spectrum_options = {$spectrum_options};\n                    \$(document).ready(function() {\n\n                        function initSpectrum(el) {\n                            var preferences = \$.extend({}, spectrum_options, el.data('spectrum'));\n                            el.spectrum({\n                                color: el.val() || preferences.starting_color,\n                                flat: preferences.select_on_page,\n                                showInput: preferences.show_input,\n                                showInitial: preferences.show_initial,\n                                showAlpha: preferences.show_alpha,\n                                localStorageKey: preferences.local_storage_key,\n                                showPalette: preferences.show_palette,\n                                showPaletteOnly: preferences.show_palette_only,\n                                showSelectionPalette: preferences.show_selection_palette,\n                                cancelText: preferences.cancel_text,\n                                chooseText: preferences.choose_text,\n                                preferredFormat: preferences.preferred_format,\n                                maxSelectionSize: preferences.max_selection_size,\n                                palette: preferences.palette\n                            });\n                        }\n\n                        \$('input[type=text].colorpicker').each(function() {\n                            initSpectrum(\$(this));\n                        });\n\n                        // grid\n                        \$('body').on('addRow', '.grid', function() {\n                            \$(this).find('input[type=text].colorpicker').each(function() {\n                                initSpectrum(\$(this));\n                            });\n                        });\n\n                        // replicator\n                        \$('body').on('addSet', function(e, set) {\n                            \$(set).find('input[type=text].colorpicker').each(function() {\n                                initSpectrum(\$(this));\n                            });\n                        });\n                    });\n                ");
         return $html;
     }
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:15,代码来源:hooks.color.php

示例13: control_panel__add_to_foot

    /**
     * Adds items to control panel footer for certain pages
     *
     * @return string
     */
    public function control_panel__add_to_foot()
    {
        if (URL::getCurrent(false) == '/publish') {
            $html = $this->js->link(array('leaflet.js', 'jquery.location.js'));
            $options = json_encode($this->getConfig());
            // modal
            $html .= '
            <div id="location-selector" style="display: none;">
                <div class="modal" id="location-modal">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h3>Common Places</h3>
                    </div>
                    <div class="modal-body">
                        <ul></ul>
                    </div>
                    <div class="modal-footer">
                        &nbsp;
                    </div>
                </div>
            </div>

            <div id="address-lookup" style="display: none;">
                <div class="modal" id="address-modal">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h3>Locate an Address</h3>
                    </div>
                    <div class="modal-body">
                        <form>
                            <p>
                                <label for="modal-address-field">Address</label><br />
                                <input type="text" name="address" id="modal-address-field" value="" />
                                <input type="submit" name="lookup" value="Locate" />
                                <small>
                                    For example: 1120 Pine Grove Road, Gardners, PA
                                </small>
                            </p>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <small>
                            Geocoding Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="//developer.mapquest.com/content/osm/mq_logo.png"><br>
                            © OpenStreetMap contributors — <a href="http://www.openstreetmap.org/copyright">License</a>
                        </small>
                    </div>
                </div>
            </div>
            ';
            $html .= $this->js->inline("\n                \$(document).ready(function() {\n                    var location_options = {$options};\n                    \$('.input-location').each(function() {\n                        \$(this).addClass('location-enabled').location(location_options);\n                    });\n\n                    // for dynamically loaded rows\n                    \$('body').on('addRow', '.grid', function() {\n                        var input = \$(this).find('input[type=text].location');\n\n                        input\n                            .each(function() {\n                                \$(this).location(location_options);\n                            });\n                    });\n\n                    // now for replicator\n                    \$('body').on('addSet', function() {\n                        \$('.input-location').not('.location-enabled').addClass('location-enabled').location(location_options);\n                    });\n                });\n            ");
            return $html;
        }
        return "";
    }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:59,代码来源:hooks.location.php

示例14: count

 public function count()
 {
     $url = $this->fetchParam('from', URL::getCurrent());
     $url = Path::resolve($url);
     $max_depth = $this->fetchParam('max_depth', 1, 'is_numeric');
     $tree = Statamic::get_content_tree($url, 1, $max_depth);
     if ($this->content != '') {
         return Parse::tagLoop($this->content, $tree);
     } else {
         return count($tree);
     }
 }
开发者ID:nob,项目名称:joi,代码行数:12,代码来源:pi.nav.php

示例15: control_panel__add_to_foot

    public function control_panel__add_to_foot()
    {
        if (URL::getCurrent() == '/publish' && Request::get('path') == $this->tasks->getFilename()) {
            return $this->js->inline('
				$(".input-block").first().hide();
				$(".status-block")
					.html("<span class=\'folder\'>' . Localization::fetch('editing_globals') . '</span>")
					.next().find("li").first().hide();
				$("#item-content a").removeClass("active");
				$("#item-globals a").addClass("active");
			');
        }
    }
开发者ID:Synergy23,项目名称:RealEstate,代码行数:13,代码来源:hooks.globals.php


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