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


PHP HtmlHelper::tag方法代码示例

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


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

示例1: request

 /**
  * Sends HttpSocket requests. Builds your uri and formats the response too.
  *
  * @param Model $model Model object
  * @param mixed $requestData Array of request or string uri
  * @param string $requestMethod read, create, update, delete
  *
  * @return array|false $response
  */
 public function request(Model $model = null, $requestData = null, $requestMethod = HttpSource::METHOD_READ)
 {
     if ($model === null) {
         return parent::request($model, $requestData, $requestMethod);
     }
     $HtmlHelper = new HtmlHelper(new View());
     unset($model->request['uri'], $model->request['virtual']);
     $model->request['body'] = '<?xml version="1.0" encoding="utf-8"?>' . $HtmlHelper->tag('request', $model->request['body']);
     return parent::request($model, $requestData, $requestMethod);
 }
开发者ID:imsamurai,项目名称:cakephp-sms-fly-datasource,代码行数:19,代码来源:SMSFlySource.php

示例2: tag

 /**
  * Extend the default tag function by allowing for arrays of text
  */
 function tag($name, $text = null, $options = array())
 {
     if (is_array($text)) {
         $output = '';
         foreach ($text as $t) {
             $output .= parent::tag($name, $t, $options);
         }
         return $output;
     } else {
         return parent::tag($name, $text, $options);
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:15,代码来源:zuluru_html.php

示例3: breadcrumb

 public function breadcrumb($items, $options = array())
 {
     $default = array('class' => 'breadcrumb');
     $options += $default;
     $count = count($items);
     $li = array();
     for ($i = 0; $i < $count - 1; $i++) {
         $text = $items[$i];
         $text .= '&nbsp;<span class="divider">/</span>';
         $li[] = parent::tag('li', $text);
     }
     $li[] = parent::tag('li', end($items), array('class' => 'active'));
     return parent::tag('ul', implode("\n", $li), $options);
 }
开发者ID:racklin,项目名称:TwitterBootstrap,代码行数:14,代码来源:BootstrapHtmlHelper.php

示例4: scriptsForLayout

 public function scriptsForLayout($type = null)
 {
     $scripts = '';
     $files = $this->Baklava->getCombined();
     foreach ($files as $t => $file) {
         if ($type && $type != $t) {
             continue;
         }
         switch ($t) {
             case 'css':
                 $scripts .= parent::css($file, null, array('inline' => true));
                 break;
             case 'js':
                 $scripts .= parent::script($file, array('inline' => true, 'defer' => true));
                 break;
             case 'style':
                 $scripts .= parent::tag('style', $file, array('type' => 'text/css'));
                 break;
         }
     }
     return $scripts;
 }
开发者ID:0x20h,项目名称:Baklava,代码行数:22,代码来源:BaklavaHtmlHelper.php

示例5: array


//.........这里部分代码省略.........
             $selected_groups = $this->Group->find('all', array('contain' => false, 'conditions' => array('id' => $this->data['Group']['Group'])));
             if ($this->is_manager) {
                 $level = 5;
             } else {
                 $level = 3;
             }
             $invalid_groups = Set::extract("/Group[level>{$level}]", $selected_groups);
             if (!empty($invalid_groups)) {
                 $this->Person->Group->validationErrors['Group'] = __('You have selected an invalid group.', true);
             }
         } else {
             $selected_groups = array();
         }
         if ($this->Auth->authenticate->validates() && $this->Person->validates() && $this->Person->Group->validates() && $this->Person->Affiliate->validates()) {
             // User and person records may be in separate databases, so we need a transaction for each
             $user_transaction = new DatabaseTransaction($this->Auth->authenticate);
             $person_transaction = new DatabaseTransaction($this->Person);
             if ($this->Auth->authenticate->save($this->data)) {
                 // Tweak some data to be saved
                 $this->data['Person'][0]['user_id'] = $this->Auth->authenticate->id;
                 foreach ($this->data['Person'] as $key => $person) {
                     $person['complete'] = true;
                     if ($this->is_admin) {
                         if ($key != 0) {
                             $person['status'] = $this->data['Person'][0]['status'];
                         }
                     } else {
                         if (Configure::read('feature.auto_approve')) {
                             if ($key == 0) {
                                 // Check the requested groups and do not auto-approve above a certain level
                                 $invalid_groups = Set::extract('/Group[level>1]', $selected_groups);
                                 if (empty($invalid_groups)) {
                                     $person['status'] = 'active';
                                 }
                             } else {
                                 $person['status'] = 'active';
                             }
                         }
                     }
                     $save = array('Person' => $person, 'Affiliate' => $this->data['Affiliate']);
                     if (!empty($person['Skill'])) {
                         $save['Skill'] = $person['Skill'];
                         unset($person['Skill']);
                     }
                     if ($key == 0) {
                         $save['Group'] = $this->data['Group'];
                     } else {
                         // Assume any secondary profiles are players
                         $save['Group'] = array('Group' => array(GROUP_PLAYER));
                         if (isset($this->data['Person'][0]['status'])) {
                             $save['Person']['status'] = $this->data['Person'][0]['status'];
                         }
                     }
                     $this->Person->create();
                     if (!$this->Person->saveAll($save)) {
                         return;
                     }
                     if (!isset($parent_id)) {
                         $parent_id = $this->Person->id;
                     } else {
                         $this->Person->PeoplePerson->save(array('person_id' => $parent_id, 'relative_id' => $this->Person->id, 'approved' => true), array('validate' => false));
                     }
                 }
                 App::import('Helper', 'Html');
                 $html = new HtmlHelper();
                 if (Configure::read('feature.auto_approve')) {
                     $msg = $html->tag('h2', __('THANK YOU', true)) . $html->para(null, sprintf(__('for creating an account with %s.', true), Configure::read('organization.name')));
                 } else {
                     $msg = $html->para(null, __('Your account has been created.', true) . ' ' . __('It must be approved by an administrator before you will have full access to the site.', true) . ' ' . __('However, you can log in and start exploring right away.', true));
                 }
                 if (isset($this->params['form']['continue'])) {
                     $msg .= $html->para(null, __('Please proceed with entering your next child\'s details below.', true));
                 }
                 $this->Session->setFlash($msg, 'default', array('class' => 'success'));
                 // There may be callbacks to handle
                 // TODO: How to handle this in conjunction with third-party auth systems?
                 $this->data['Person']['id'] = $this->Person->id;
                 $components = Configure::read('callbacks.user');
                 foreach ($components as $name => $config) {
                     $component = $this->_getComponent('User', $name, $this, false, $config);
                     $component->onAdd($this->data);
                 }
                 $user_transaction->commit();
                 $person_transaction->commit();
                 if (!$this->is_logged_in) {
                     // Automatically log the user in
                     $this->data[$this->Auth->authenticate->alias]['password'] = $this->data[$this->Auth->authenticate->alias]['passwd'];
                     $this->Auth->login($this->Auth->hashPasswords($this->data));
                 }
                 if (isset($this->params['form']['continue'])) {
                     $this->redirect(array('controller' => 'people', 'action' => 'add_relative'));
                 }
                 $this->redirect('/');
             }
         }
     } else {
         // By default, select the first group
         $this->data = array('Group' => array('Group' => array(current(array_keys($groups)))));
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:101,代码来源:users_controller.php

示例6: followMe

 /**
  * create follow me button
  *
  * @param string $screen_name
  * @param string $elementId
  */
 public function followMe($screen_name, $elementId = 'followMe')
 {
     $out = $this->Html->tag('span', '', array('id' => $elementId));
     $out .= $this->Html->scriptBlock("\n        twttr.anywhere(function (T) {\n            T('#{$elementId}').followButton('{$screen_name}');\n        });");
     return $out;
 }
开发者ID:elstc,项目名称:twitter_kit,代码行数:12,代码来源:anywhere.php

示例7: ajaxUrl

 function ajaxUrl()
 {
     if ($this->alreadyPrintedAjaxUrl) {
         return false;
     }
     $attributes = HtmlHelper::attr(array('name' => 'ajax_url', 'type' => 'hidden', 'value' => admin_url('admin-ajax.php')));
     echo HtmlHelper::tag("input/", $attributes, null, null);
     $this->alreadyPrintedAjaxUrl = true;
 }
开发者ID:soska,项目名称:dte,代码行数:9,代码来源:simple_meta_box.php

示例8: import

 function import($type = null, $name = null, $charset = "utf-8")
 {
     switch ($type) {
         case 'style':
             $attribs = HtmlHelper::attr(array('rel' => 'stylesheet', 'href' => DUP_CORE_STYLES_URL . "{$name}.css", 'type' => 'text/css', 'media' => 'screen', 'title' => phraseize($name), 'charset' => $charset));
             return HtmlHelper::tag('link/', $attribs);
             break;
         case 'script':
             $attribs = HtmlHelper::attr(array('src' => DUP_CORE_STYLES_URL . "{$name}.css", 'type' => 'text/javascript', 'charset' => $charset));
             return HtmlHelper::tag('script', $attribs, null, null, null) . HtmlHelper::tag('/script', null, null, null);
             break;
     }
 }
开发者ID:soska,项目名称:dte,代码行数:13,代码来源:controller.class.php

示例9: test_tag

 public function test_tag()
 {
     $h = new HtmlHelper();
     $this->assertEquals('<a href="https://github.com/">github</a>', $h->tag('a')->attr('href', 'https://github.com/')->append('github')->toString());
 }
开发者ID:iakio,项目名称:htmlhelper,代码行数:5,代码来源:HtmlHelperTest.php

示例10: btn

 /**
  * Create a Bootstrap Button or Link
  *
  * @param string $text 	  		text in the button
  * @param string $url 	  		url of the link
  * @param array $options 		'size' => lg, sm or xs, to change the size of the button
  *						        'type' => primary, success, etc, to change the color
  *						        'tag' => to change the tag
  *						        and more... (like 'class')
  * @param array $confirmMessage to add a confirm pop-up
  * @return string
  */
 public function btn($text, $url = array(), $options = array(), $confirmMessage = false)
 {
     $tag = 'a';
     if (!empty($options['tag'])) {
         $tag = $options['tag'];
     }
     $class = 'btn';
     $class .= !empty($options['type']) ? ' btn-' . $options['type'] : '';
     $class .= !empty($options['size']) ? ' btn-' . $options['size'] : '';
     $class .= isset($options['class']) ? ' ' . $options['class'] : '';
     $options['class'] = $class;
     if ($tag != 'a') {
         unset($options['tag']);
         unset($options['type']);
         unset($options['size']);
     }
     if ($tag != 'a') {
         return parent::tag($tag, $text, $options);
     } else {
         return parent::link($text, $url, $options, $confirmMessage);
     }
 }
开发者ID:xhs345,项目名称:CakePHP-BsHelpers,代码行数:34,代码来源:BsHelper.php

示例11: _icon

 /**
  * Returns an icon element followed by a text.
  * This function is used for generating an icon for internal functions inside this
  * helper.
  *
  * @param  string       $title
  * @param  string|array $options
  * @return string
  * todo We need to refactor this function in order to load an array of icon class with no prefix on the class
  */
 protected function _icon($title, array $options = [])
 {
     if (empty($options) || !isset($options['icon'])) {
         return $title;
     }
     $options = $options['icon'];
     if (is_array($options)) {
         if (!isset($options['class']) || empty($options['class'])) {
             return $title;
         }
     }
     if (is_string($options)) {
         if (empty($options)) {
             return $title;
         }
         $icon = $this->iconPrefix;
         $options = ["class" => "{$icon} {$icon}-{$options}"];
     }
     $tag = parent::tag('i', '', $options);
     return trim($tag . ' ' . $title);
 }
开发者ID:cakeoven,项目名称:CakeTwitterBootstrap,代码行数:31,代码来源:BootstrapHtmlHelper.php

示例12: HtmlHelper

$Html = new HtmlHelper(new View());
$config['SMSFlySource']['config_version'] = 2;
$CF = HttpSourceConfigFactory::instance();
$Config = $CF->config();
$Config->add($CF->endpoint()->id(1)->methodCreate()->table('SENDSMS')->path('')->addCondition($CF->condition()->name('startTime')->map(null, 'start_time')->defaults('AUTO'))->addCondition($CF->condition()->name('endTime')->map(null, 'end_time')->defaults('AUTO'))->addCondition($CF->condition()->name('lifetime')->defaults(4))->addCondition($CF->condition()->name('rate')->defaults(120))->addCondition($CF->condition()->name('desc')->defaults(''))->addCondition($CF->condition()->name('source')->required())->addCondition($CF->condition()->name('messages')->required())->queryBuilder(function (Model $model, array $usedConditions, array $queryData) use($Html) {
    $messagesData = $queryData['conditions']['messages'];
    array_walk($messagesData, function (&$phones) {
        $phones = is_array($phones) ? $phones : array($phones);
    });
    $messageOptions = array_intersect_key($queryData['conditions'], array_flip(array('start_time', 'end_time', 'lifetime', 'rate', 'desc', 'source')));
    $messages = '';
    if (count($messagesData) > 1) {
        $messageOptions['type'] = 'individual';
        foreach ($messagesData as $message => $phones) {
            foreach ($phones as $phone) {
                $messages .= $Html->tag('recipient', $phone);
                $messages .= $Html->tag('body', $message);
            }
        }
    } else {
        foreach ($messagesData as $message => $phones) {
            $messages .= $Html->tag('body', $message);
            $phones = is_array($phones) ? $phones : array($phones);
            foreach ($phones as $phone) {
                $messages .= $Html->tag('recipient', $phone);
            }
        }
    }
    $data = $Html->tag('operation', 'SENDSMS');
    $data .= $Html->tag('message', $messages, $messageOptions);
    $model->request['body'] = $data;
开发者ID:imsamurai,项目名称:cakephp-sms-fly-datasource,代码行数:31,代码来源:SMSFlySource.php

示例13: _imageRadio

 /**
  * Image Radio Control
  *
  * Enhanced Javascript Control, that allows an array of images, to act as radio
  *
  * @param string $name 
  * @param string $options 
  * @return void
  * @author Armando Sosa
  */
 function _imageRadio($name, $options)
 {
     $options = set_merge(array('baseDir' => ''), (array) $options);
     $input = HtmlHelper::tag('div.image-radio-group');
     foreach ($options['options'] as $value => $image) {
         $selected = $value == $options['value'] ? '.selected' : '';
         $atts = HtmlHelper::attr(array('title' => $value, 'src' => $options['baseDir'] . $image));
         $input .= HtmlHelper::tag('img.radio' . $selected, $atts);
     }
     $input .= $this->input($name, array('type' => 'hidden', 'value' => $value), false);
     $input .= HtmlHelper::tag('/div.image-radio-group');
     return $input;
 }
开发者ID:soska,项目名称:dte,代码行数:23,代码来源:options.php


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