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


PHP Label::render方法代码示例

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


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

示例1: testRender

 /**
  * @covers Xoops\Form\Label::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
     $this->assertTrue(false !== strpos($value, '<span'));
     $this->assertTrue(false !== strpos($value, 'id="name"'));
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:10,代码来源:LabelTest.php

示例2: renderLabel

 public function renderLabel($name, $attributes = array())
 {
     if ($widget = $this->widgets->get($name)) {
         $label = new Label($widget->label);
         return $label->render($attributes);
     }
 }
开发者ID:corneltek,项目名称:formkit,代码行数:7,代码来源:BaseLayout.php

示例3: render

 public function render(array $item)
 {
     // When no items are set, we act as if this is a normal label.
     // @todo Decide if we should throw an exception instead?
     if (empty($item['child_items'])) {
         return parent::render($item);
     }
     $options = $this->getOptions($item);
     $label = $this->getLabel($options);
     $title = $this->getTitle($options, $label);
     $id = uniqid();
     $boxId = 'dropdown-box-' . $id . '-dropdown';
     $anchorId = 'menu-option-' . $id;
     $anchorAttr = [];
     $anchorAttr['href'] = '';
     $anchorAttr['id'] = $anchorId;
     $anchorAttr['class'] = 'zui-button-dropdown';
     $anchorAttr['aria-haspopup'] = 'true';
     $anchorAttr['aria-controls'] = $boxId;
     $anchorAttr['aria-expanded'] = 'false';
     $anchorAttr['title'] = $title;
     $result = '<li role="presentation">';
     $result .= sprintf('<a %s>%s</a>', $this->createAttribs($anchorAttr), $label);
     $result .= $this->renderBox($anchorId, $boxId, $item);
     return $result . '</li>';
 }
开发者ID:zource,项目名称:zource,代码行数:26,代码来源:Dropdown.php

示例4: Load

 public function Load()
 {
     header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
     parent::$PAGE_TITLE = __(ERROR_PAGE) . " - " . __(SITE_NAME);
     parent::$PAGE_META_ROBOTS = "noindex, nofollow";
     // check if URL is not bad, but could be a good URL
     if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
         $url_to_check = trim($_GET['error-redirect-url']);
     } else {
         $url_to_check = trim($this->getCurrentUrl());
     }
     $base_url_tmp = BASE_URL;
     if ($base_url_tmp[strlen($base_url_tmp) - 1] == "/") {
         $base_url_tmp = substr($base_url_tmp, 0, strlen($base_url_tmp) - 1);
     }
     $url_to_check = str_replace("%22", "\"", str_replace("%5C", "\\", str_replace("%5c", "\\", str_replace("%27", "'", $url_to_check))));
     $redirect_bad_url_to = "";
     if (preg_match("@" . $base_url_tmp . "([^?]*)/'(http://|https://|http:/|https:/)(.+)/'@i", $url_to_check, $matches) == 1) {
         // url detect with /' in the end
         $redirect_bad_url_to = $matches[3];
         $redirect_bad_url_to_http = $matches[2];
     } else {
         if (preg_match("@" . $base_url_tmp . "([^?]*)/'(http://|https://|http:/|https:/)(.+)'@i", $url_to_check, $matches) == 1) {
             // url detect with '
             $redirect_bad_url_to = $matches[3];
             $redirect_bad_url_to_http = $matches[2];
         } else {
             if (preg_match("@" . $base_url_tmp . "([^?]*)/\\\\'(http://|https://|http:/|https:/)(.+)\\\\'@i", $url_to_check, $matches) == 1) {
                 // url detect with \'
                 $redirect_bad_url_to = $matches[3];
                 $redirect_bad_url_to_http = $matches[2];
             } else {
                 if (preg_match("@" . $base_url_tmp . "([^?]*)/\"(http://|https://|http:/|https:/)(.+)\"@i", $url_to_check, $matches) == 1) {
                     // url detect with "
                     $redirect_bad_url_to = $matches[3];
                     $redirect_bad_url_to_http = $matches[2];
                 } else {
                     if (preg_match("@" . $base_url_tmp . "([^?]*)/(http://|https://|http:/|https:/)(.+)@i", $url_to_check, $matches) == 1) {
                         // url detect without no '
                         $redirect_bad_url_to = $matches[3];
                         $redirect_bad_url_to_http = $matches[2];
                     } else {
                         if (preg_match("@" . BASE_URL . "combine-css/'/(.+)'@i", $url_to_check, $matches) == 1) {
                             // combine-css url with '
                             $redirect_bad_url_to = BASE_URL . $matches[1];
                             $redirect_bad_url_to_http = "";
                         }
                     }
                 }
             }
         }
     }
     // check apple icon
     if ($redirect_bad_url_to == "" && find($url_to_check, "apple-touch-icon") > 0) {
         if ($url_to_check == BASE_URL . "apple-touch-icon.png" || $url_to_check == BASE_URL . "apple-touch-icon-precomposed.png") {
             if (defined('SITE_META_IPHONE_IMAGE_114PX')) {
                 $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_114PX;
             } else {
                 if (defined('SITE_META_IPHONE_IMAGE_72PX')) {
                     $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_72PX;
                 } else {
                     if (defined('SITE_META_IPHONE_IMAGE_57PX')) {
                         $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_57PX;
                     }
                 }
             }
         } else {
             if ($url_to_check == BASE_URL . "apple-touch-icon-57x57.png" || $url_to_check == BASE_URL . "apple-touch-icon-57x57-precomposed.png") {
                 if (defined('SITE_META_IPHONE_IMAGE_57PX')) {
                     $redirect_bad_url_to = SITE_META_IPHONE_IMAGE_57PX;
                 }
             }
         }
         if ($redirect_bad_url_to != "") {
             if (strtoupper(substr($redirect_bad_url_to, 0, 7)) != "HTTP://" && strtoupper(substr($redirect_bad_url_to, 0, 8)) != "HTTPS://") {
                 $redirect_bad_url_to = BASE_URL . $redirect_bad_url_to;
             }
         }
     }
     // End check if URL is not bad
     if ($redirect_bad_url_to != "") {
         // if URL is detect as bad but can be redirect to good URL
         if ($redirect_bad_url_to_http != "") {
             $redirect_bad_url_to = str_replace(":/", "", str_replace("://", "", $redirect_bad_url_to_http)) . "://" . $redirect_bad_url_to;
         }
         $this->redirect($redirect_bad_url_to);
         $msg_redirect = new Label(__(REDIRECT_URL_TO, $redirect_bad_url_to, $redirect_bad_url_to));
         $this->render = new ErrorTemplate($msg_redirect, parent::$PAGE_TITLE);
     } else {
         // display the error page if the URL is correct
         $error_msg_title = "";
         $array_code_error = array(401, 403, 404, 500);
         if (in_array($_GET['error-redirect'], $array_code_error)) {
             $_SESSION['calling_page'] = "";
             $error_msg = constant("ERROR_" . $_GET['error-redirect'] . "_MSG");
             parent::$PAGE_TITLE = constant("ERROR_" . $_GET['error-redirect'] . "_MSG") . " - " . __(SITE_NAME);
             $error_msg_title = constant("ERROR_" . $_GET['error-redirect'] . "_MSG");
         } else {
             if ($_SESSION['calling_page'] == "error-page") {
                 if (isset($_GET['error-redirect-url']) && $_GET['error-redirect-url'] != "") {
//.........这里部分代码省略.........
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:101,代码来源:error-page.php

示例5: test__construct

 /**
  * @covers Xoops\Form\Label::__construct
  * @covers Xoops\Form\Label::render
  */
 public function test__construct()
 {
     $oldWay = new Label();
     $newWay = new Label([]);
     $this->assertEquals($oldWay->render(), $newWay->render());
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:10,代码来源:LabelTest.php

示例6: Label

	function render_field ($field) {
		
		$label = new Label($field);
		
		return sprintf($this->field_format, $label->render());
		
	}
开发者ID:ricobl,项目名称:frix,代码行数:7,代码来源:Form.php

示例7: label

 public static function label($text, array $attributes = array())
 {
     $control = new Label($text, $attributes);
     $control->setEscaper(self::$escaper);
     echo $control->render();
 }
开发者ID:joeldavuk,项目名称:framework,代码行数:6,代码来源:Html.php


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