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


PHP Director::protocolAndHost方法代码示例

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


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

示例1: canIncludeInGoogleShoppingFeed

 /**
  * Can we add this object to a shopping feed?
  * 
  * @return boolean
  */
 public function canIncludeInGoogleShoppingFeed()
 {
     $can = true;
     // If object does not link to the current website or absolute
     // link not set.
     if ($this->owner->hasMethod('AbsoluteLink')) {
         $hostHttp = parse_url(Director::protocolAndHost(), PHP_URL_HOST);
         $objHttp = parse_url($this->owner->AbsoluteLink(), PHP_URL_HOST);
         if ($objHttp != $hostHttp) {
             $can = false;
         }
     } else {
         $can = false;
     }
     // If no price or title.
     if (!$this->owner->Title || !$this->owner->Price || !$this->owner->Condition || !$this->owner->Availability || !$this->owner->Brand || !$this->owner->MPN) {
         $can = false;
     }
     // Can any user view this item
     if ($can) {
         $can = $this->owner->canView();
     }
     if ($can && $this->owner->RemoveFromShoppingFeed) {
         $can = false;
     }
     $this->owner->invokeWithExtensions('alterCanIncludeInGoogleShoppingFeed', $can);
     return $can;
 }
开发者ID:spekulatius,项目名称:silverstripe-googleshoppingfeed,代码行数:33,代码来源:GoogleShoppingFeedExtension.php

示例2: onBeforeInit

 public function onBeforeInit()
 {
     $host = GlobalNavSiteTreeExtension::get_toolbar_hostname();
     if ((isset($_REQUEST['regenerate_nav']) || isset($_REQUEST['flush'])) && $host == Director::protocolAndHost() && (Permission::check('ADMIN') || Director::isDev())) {
         GlobalNavSiteTreeExtension::create_static_navs();
     }
 }
开发者ID:newleeland,项目名称:silverstripe-globaltoolbar,代码行数:7,代码来源:GlobalNavControllerExtension.php

示例3: __destruct

 /**
  * If emailLogFileTo and logFilePathName is set then email the logFilePathName content if not empty
  */
 public function __destruct()
 {
     if ($this->emailLogFileTo && $this->logFilePathName) {
         if ($body = file_get_contents($this->logFilePathName)) {
             $email = new \Email($this->config()->get('send_emails_from'), $this->emailLogFileTo, 'Debug log from: ' . \Director::protocolAndHost(), $body);
             $email->sendPlain();
         }
     }
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-modular,代码行数:12,代码来源:Debugger.php

示例4: CanTrackEvents

 public static function CanTrackEvents(Controller $controller)
 {
     $bIsContentController = is_a($controller, 'ContentController');
     if ($bIsContentController && SiteConfig::current_site_config()->GoogleAnalyticsTrackingID) {
         $strCurrentDomain = str_replace(Director::protocol(), '', Director::protocolAndHost());
         $arrDomains = explode(',', SiteConfig::current_site_config()->GoogleAnalyticsTrackDomain);
         return in_array($strCurrentDomain, $arrDomains);
     }
 }
开发者ID:helpfulrobot,项目名称:plumpss-googleanalytics,代码行数:9,代码来源:GoogleAnalyticsConfigExtension.php

示例5: close

 public function close()
 {
     $id = $this->getVar($this->attributes['name'] . 'ID');
     if (!$id) {
         return;
     }
     $image = DataObject::get_by_id('Image', $id);
     if ($image) {
         /* image specific attribute handling */
         if (!empty($this->attributes['width'])) {
             $newimage = $image->setWidth($this->attributes['width']);
             if ($newimage) {
                 $image = $newimage;
             }
         }
         if (!empty($this->attributes['height'])) {
             $newimage = $image->setHeight($this->attributes['height']);
             if ($newimage) {
                 $image = $newimage;
             }
         }
         $path = $image->Filename;
         $url = $image->getURL();
         if (strpos($url, 'http://') !== 0) {
             $url = '/' . ltrim($url, '/');
         }
         /*				if(substr($path,0,1) !== '/') 
         					$path = HOME_PATH . '/../userhomes/' . NSite::current_site()->PathName . '/' . $path;
         
         				$url = '/' . ltrim(Director::makeRelative(realpath($path)), '/');
         			}
         */
         if (file_exists($path)) {
             if (parse_url($url, PHP_URL_HOST) == '') {
                 // Convert relative url to absolute
                 $url = Director::protocolAndHost() . '/' . $url;
             }
             $title = $image->Title ? $image->Title : $image->Filename;
             if ($title) {
                 $title = Convert::raw2att($title);
             } else {
                 if (preg_match("/([^\\/]*)\\.[a-zA-Z0-9]{1,6}\$/", $title, $matches)) {
                     $title = Convert::raw2att($matches[1]);
                 }
             }
             echo "<img src=\"{$url}\" alt=\"{$title}\"";
             $copy_attributes = array('style', 'align');
             foreach ($copy_attributes as $name) {
                 if (isset($this->attributes[$name])) {
                     echo ' ' . $name . '="' . Convert::raw2att($this->attributes[$name]) . '"';
                 }
             }
             echo " />";
         }
     }
 }
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:56,代码来源:ssemail_image.php

示例6: send

 /**
  * @param IFoundationMember                                 $foundation_member
  * @param IFoundationMemberRevocationNotification           $notification
  * @param IFoundationMemberRevocationNotificationRepository $notification_repository
  */
 public function send(IFoundationMember $foundation_member, IFoundationMemberRevocationNotification $notification, IFoundationMemberRevocationNotificationRepository $notification_repository)
 {
     $email = EmailFactory::getInstance()->buildEmail(REVOCATION_NOTIFICATION_EMAIL_FROM, $foundation_member->Email, REVOCATION_NOTIFICATION_EMAIL_SUBJECT);
     $email->setTemplate('RevocationNotificationEmail');
     do {
         $hash = $notification->generateHash();
     } while ($notification_repository->existsHash($hash));
     $link = sprintf('%s/revocation-notifications/%s/action', Director::protocolAndHost(), $hash);
     $email->populateTemplate(array('TakeActionLink' => $link, 'EmailFrom' => REVOCATION_NOTIFICATION_EMAIL_FROM, 'ExpirationDate' => $notification->expirationDate()->format('F j')));
     $email->send();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:16,代码来源:RevocationNotificationEmailSender.php

示例7: canIncludeInGoogleSiteMap

 public function canIncludeInGoogleSiteMap()
 {
     $can = true;
     if ($this->owner->hasMethod('AbsoluteLink')) {
         $hostHttp = parse_url(Director::protocolAndHost(), PHP_URL_HOST);
         $objHttp = parse_url($this->owner->AbsoluteLink(), PHP_URL_HOST);
         if ($objHttp != $hostHttp) {
             $can = false;
         }
     }
     return $can;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:12,代码来源:GoogleSiteMapExtension.php

示例8: sendDeleteNotification

 public function sendDeleteNotification(IDupeMemberDeleteRequest $request)
 {
     $dupe = $request->getDupeAccount();
     $email_to = $dupe->getEmail();
     $email = EmailFactory::getInstance()->buildEmail(DUPE_EMAIL_FROM, $email_to, "You Have Requested to Delete Openstack Duplicated Account");
     $template_data = array('FirstName' => $dupe->getFirstName(), 'LastName' => $dupe->getLastName(), 'DupeAccount' => $email_to);
     $email->setTemplate('DupeMembers_DeleteAccountEmail');
     do {
         $token = $request->generateConfirmationHash();
     } while ($this->delete_request_repository->existsConfirmationToken($token));
     $template_data['ConfirmationLink'] = sprintf('%s/dupes-members/%s/delete', Director::protocolAndHost(), $token);
     $email->populateTemplate($template_data);
     $email->send();
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:14,代码来源:DupeMemberActionRequestEmailNotificationSender.php

示例9: Breadcrumbs

	/**
	 * Generate breadcrumb links to the URL path being displayed
	 *
	 * @return string
	 */
	public function Breadcrumbs() {
		$basePath = str_replace(Director::protocolAndHost(), '', Director::absoluteBaseURL());
		$relPath = parse_url(substr($_SERVER['REQUEST_URI'], strlen($basePath), strlen($_SERVER['REQUEST_URI'])), PHP_URL_PATH);
		$parts = explode('/', $relPath);
		$base = Director::absoluteBaseURL();
		$pathPart = "";
		$pathLinks = array();
		foreach($parts as $part) {
			if ($part != '') {
				$pathPart .= "$part/";
				$pathLinks[] = "<a href=\"$base$pathPart\">$part</a>";
			}
		}
		return implode('&rarr;&nbsp;', $pathLinks);
	}	
开发者ID:neopba,项目名称:silverstripe-book,代码行数:20,代码来源:DebugView.php

示例10: _getTablePages

 private function _getTablePages()
 {
     $tablePages = '<table class="widgetify-related">';
     $tablePages .= '<tr class="table-header"><td>Page Title</td><td>Page Link</td><td>CMS Link</td></tr>';
     $pages = $this->WidgetifyPages();
     if ($pages && $pages->count()) {
         foreach ($pages as $page) {
             $absLink = Controller::join_links(Director::protocolAndHost(), $page->Link());
             $absCMSLink = Controller::join_links(Director::protocolAndHost(), '/admin/pages/edit/show/', $page->ID);
             $tablePages .= '<tr><td>' . $page->MenuTitle . '</td><td><a href="' . $absLink . '" target="_blank">' . $absLink . '</a></td><td><a href="' . $absCMSLink . '" target="_blank">' . $absCMSLink . '</a></td></tr>';
         }
     }
     $tablePages .= '</table>';
     return $tablePages;
 }
开发者ID:helpfulrobot,项目名称:nzaa-widgetify,代码行数:15,代码来源:WidgetifyTemplate.php

示例11: fifth

 public function fifth()
 {
     $this->Title = 'The OpenStack Fifth Anniversary';
     $this->FBImage = 'http://www.openstack.org/themes/openstack/images/anniversary/5/img/bot-facebook.jpg';
     $this->FBImageW = '200';
     $this->FBImageH = '284';
     $this->FBDesc = 'Happy 5th OpenStack! Come celebrate at one of 40 global events.';
     $this->FBUrl = Director::protocolAndHost() . $this->Link('fifth');
     $this->CurrentDomain = Director::protocolAndHost();
     Requirements::set_write_js_to_body(false);
     Requirements::combine_files('5.css', array());
     Requirements::css($this->ThemeDir() . '/images/anniversary/5/css/bootstrap.css');
     Requirements::css($this->ThemeDir() . '/images/anniversary/5/css/styles.css');
     Requirements::combine_files('5.js', array($this->ThemeDir() . '/images/anniversary/5/js/jquery.js', $this->ThemeDir() . '/images/anniversary/5/js/scripts.js', $this->ThemeDir() . '/images/anniversary/5/js/jquery.easing.min.js'));
     return $this->getViewer('fifth')->process($this, array('ImgPath' => '/themes/openstack/images/anniversary/5/img', 'BadgeImgUrl' => 'http://841038e5aa7ad2e38487-650bfe6158d7143a3437ef4c83572bc4.r48.cf1.rackcdn.com/5/openstack-5th-anniversary.png', 'SlideDeckUrl' => '//www.dropbox.com/s/8bvbo2dzp9jd61o/OpenStack%205th%20Birthday%20slide%20deck.pptx?dl=0', 'LocalEventUrl' => '//www.openstack.org/blog/2015/06/openstack-turns-5-its-time-to-celebrate-the-community/', 'SummitUrl' => '//www.openstack.org/summit/tokyo-2015/', 'FBSharerUrl' => 'http://www.openstack.org/birthday/fifth', 'FBSharerImg' => 'http://www.openstack.org/themes/openstack/images/anniversary/5/img/bot-facebook.jpg'));
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:16,代码来源:AnniversaryPage.php

示例12: ContactForm

 /**
  * Post a contact form
  *
  * @return Form
  */
 public function ContactForm()
 {
     $form = new ContactForm($this, 'ContactForm');
     // we do not want to read a new URL when the form has already been submitted
     // which in here, it hasn't been.
     $url = isset($_SERVER['REQUEST_URI']) ? Director::protocolAndHost() . '' . $_SERVER['REQUEST_URI'] : false;
     $form->loadDataFrom(array('ReturnURL' => $url));
     $member = Member::currentUser();
     if ($member) {
         $form->loadDataFrom($member);
     }
     if ($form->hasExtension('FormSpamProtectionExtension')) {
         $form->enableSpamProtection();
     }
     // hook to allow further extensions to alter the comments form
     //$this->extend('alterContactForm', $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:thomaspaulson-sliverstripe-contactform,代码行数:23,代码来源:ContactController.php

示例13: testAlternativeBaseURL

 public function testAlternativeBaseURL()
 {
     // relative base URLs - you should end them in a /
     Director::setBaseURL('/relativebase/');
     $this->assertEquals('/relativebase/', Director::baseURL());
     $this->assertEquals(Director::protocolAndHost() . '/relativebase/', Director::absoluteBaseURL());
     $this->assertEquals(Director::protocolAndHost() . '/relativebase/subfolder/test', Director::absoluteURL('subfolder/test'));
     // absolute base URLs - you should end them in a /
     Director::setBaseURL('http://www.example.org/');
     $this->assertEquals('http://www.example.org/', Director::baseURL());
     $this->assertEquals('http://www.example.org/', Director::absoluteBaseURL());
     $this->assertEquals('http://www.example.org/subfolder/test', Director::absoluteURL('subfolder/test'));
     // Setting it to false restores functionality
     Director::setBaseURL(false);
     $this->assertEquals(BASE_URL . '/', Director::baseURL());
     $this->assertEquals(Director::protocolAndHost() . BASE_URL . '/', Director::absoluteBaseURL(BASE_URL));
     $this->assertEquals(Director::protocolAndHost() . BASE_URL . '/subfolder/test', Director::absoluteURL('subfolder/test'));
 }
开发者ID:normann,项目名称:sapphire,代码行数:18,代码来源:DirectorTest.php

示例14: getConfig

 public function getConfig($page = null)
 {
     $themeDir = $this->owner->ThemeDir();
     $baseDir = Director::baseURL();
     $baseHref = Director::protocolAndHost() . $baseDir;
     $editHref = $page ? $baseHref . $page->CMSEditLink() : null;
     $pageHierarchy = array();
     //        if ($page) {
     //            $pageHierarchy = array($page->ID);
     //            $parent        = $page->Parent();
     //            while ($parent && $parent->exists()) {
     //                $pageHierarchy[] = $parent->ID;
     //                $parent          = $parent->Parent();
     //            }
     //        }
     $jsConfig = array('linkURL' => Controller::join_links(FrontEndEditorToolbar::create()->Link(), "LinkForm"), 'mediaURL' => Controller::join_links(FrontEndEditorToolbar::create()->Link(), "MediaForm"), 'themeDir' => $themeDir, 'baseDir' => $baseDir, 'baseHref' => $baseHref, 'editHref' => $editHref, 'pageHierarchy' => Convert::raw2json(array_reverse($pageHierarchy)));
     return $jsConfig;
 }
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-frontend-admin,代码行数:18,代码来源:FrontendEditingControllerExtension.php

示例15: canIncludeInGoogleSitemap

 /**
  * @return boolean
  */
 public function canIncludeInGoogleSitemap()
 {
     $can = true;
     if ($this->owner->hasMethod('AbsoluteLink')) {
         $hostHttp = parse_url(Director::protocolAndHost(), PHP_URL_HOST);
         $objHttp = parse_url($this->owner->AbsoluteLink(), PHP_URL_HOST);
         if ($objHttp != $hostHttp) {
             $can = false;
         }
     }
     if ($can) {
         $can = $this->owner->canView();
     }
     if ($can) {
         $can = $this->owner->getGooglePriority();
     }
     $this->owner->invokeWithExtensions('alterCanIncludeInGoogleSitemap', $can);
     return $can;
 }
开发者ID:designcity,项目名称:silverstripe-googlesitemaps,代码行数:22,代码来源:GoogleSitemapExtension.php


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