本文整理汇总了PHP中HtmlHelper::para方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::para方法的具体用法?PHP HtmlHelper::para怎么用?PHP HtmlHelper::para使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper::para方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: para
function para($class, $text, $options = array())
{
$text = preg_replace('/<\\/p>|<br[^<]*?>/', "\n", $text);
# se remplazan los <br> y </p> por \n para que los comentarios viejos sean compatibles
$text = preg_replace("/\\\\|<[^<]+?>/", "", $text);
#se quitan todos las etiquetas html y las \ que se usan para escapar las comillas
$text = preg_replace("/\n\\s*\n/", "</p><p>", $text);
#se remplazan los dos saltos de lineas por una P
$text = preg_replace('/\\n/', "<br />", $text);
#se remplazan los saltos de linea que quedan solos por <br />
#$comment=preg_replace('/[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-]+\.[a-zA-Z0-9_\-\.]+/','[E-mail]',$text);# se quitan los emails que se escriben en el mensaje
#$comment=preg_replace('/www\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9]{2,4}|http:\/\/[a-zA-Z0-9\-_]+\.[a-zA-Z0-9]{2,4}|https:\/\/[a-zA-Z0-9\-_]+\.[a-zA-Z0-9]{2,4}/','[URL]',$comment);
return parent::para($class, $text, $options);
}
示例2: 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)))));
}
}