本文整理汇总了PHP中text::auto_p方法的典型用法代码示例。如果您正苦于以下问题:PHP text::auto_p方法的具体用法?PHP text::auto_p怎么用?PHP text::auto_p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类text
的用法示例。
在下文中一共展示了text::auto_p方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auto_p
/**
* Tests the text::auto_p() function.
* @dataProvider auto_p_provider
* @group core.helpers.text.auto_p
* @test
*/
public function auto_p($str, $expected_result)
{
$result = text::auto_p($str);
$this->assertEquals($expected_result, $result);
}
示例2: index
//.........这里部分代码省略.........
// End of New Code
$incidents = $db->query($incident_query);
foreach ($incidents as $incident) {
// ** Pre-Formatting Message ** //
// Convert HTML to Text
$incident_description = $incident->incident_description;
$incident_url = url::site() . 'reports/view/' . $incident->id;
$incident_description = html::clean($incident_description);
// EMAIL MESSAGE
$email_message = $incident_description . "\n\n" . $incident_url;
// SMS MESSAGE
$sms_message = $incident_description;
// Remove line breaks
$sms_message = str_replace("\n", " ", $sms_message);
// Shorten to text message size
if (Kohana::config("settings.sms_alert_url")) {
$sms_message = text::limit_chars($sms_message, 100, "...");
// HT: Decreased sms lenght of sms to add incident_url
$sms_message .= " " . $incident_url;
// HT: Added incident_url to sms
} else {
$sms_message = text::limit_chars($sms_message, 150, "...");
}
$latitude = (double) $incident->latitude;
$longitude = (double) $incident->longitude;
// Find all the catecories including parents
$category_ids = $this->_find_categories($incident->id);
// HT: New Code
$alert_sent = ORM::factory('alert_sent')->where('incident_id', $incident->id)->select_list('id', 'alert_id');
$alertObj = ORM::factory('alert')->where('alert_confirmed', '1');
if (!empty($alert_sent)) {
$alertObj->notin('id', $alert_sent);
}
$alertees = $alertObj->find_all();
// End of new code
foreach ($alertees as $alertee) {
// HT: check same alert_receipent multi subscription does not get multiple alert
if ($this->_multi_subscribe($alertee, $incident->id)) {
continue;
}
// Check the categories
if (!$this->_check_categories($alertee, $category_ids)) {
continue;
}
$alert_radius = (int) $alertee->alert_radius;
$alert_type = (int) $alertee->alert_type;
$latitude2 = (double) $alertee->alert_lat;
$longitude2 = (double) $alertee->alert_lon;
$distance = (string) new Distance($latitude, $longitude, $latitude2, $longitude2);
// If the calculated distance between the incident and the alert fits...
if ($distance <= $alert_radius) {
if ($alert_type == 1) {
// Get SMS Numbers
if (Kohana::config("settings.sms_no3")) {
$sms_from = Kohana::config("settings.sms_no3");
} elseif (Kohana::config("settings.sms_no2")) {
$sms_from = Kohana::config("settings.sms_no2");
} elseif (Kohana::config("settings.sms_no1")) {
$sms_from = Kohana::config("settings.sms_no1");
} else {
$sms_from = "12053705050";
}
// Admin needs to set up an SMS number
if ($response = sms::send($alertee->alert_recipient, $sms_from, $sms_message) === true) {
$alert = ORM::factory('alert_sent');
$alert->alert_id = $alertee->id;
$alert->incident_id = $incident->id;
$alert->alert_date = date("Y-m-d H:i:s");
$alert->save();
} else {
// The gateway couldn't send for some reason
// in future we'll keep a record of this
}
} elseif ($alert_type == 2) {
$to = $alertee->alert_recipient;
$from = array();
$from[] = $alerts_email;
$from[] = $site_name;
$subject = "[{$site_name}] " . $incident->incident_title;
$message = text::auto_p($email_message . "\n\n" . $unsubscribe_message . $alertee->alert_code . "\n");
//if (email::send($to, $from, $subject, $message, FALSE) == 1)
if (email::send($to, $from, $subject, $message, TRUE) == 1) {
$alert = ORM::factory('alert_sent');
$alert->alert_id = $alertee->id;
$alert->incident_id = $incident->id;
$alert->alert_date = date("Y-m-d H:i:s");
$alert->save();
}
}
}
}
// End For Each Loop
// Update Incident - All Alerts Have Been Sent!
$update_incident = ORM::factory('incident', $incident->id);
if ($update_incident->loaded) {
$update_incident->incident_alert_status = 2;
$update_incident->save();
}
}
}
示例3: render
/**
* Return BBCode parsed to HTML
*
* @return string
*/
public function render()
{
if (is_null($this->text)) {
return '';
}
// Convert old system tags to BBCode
$this->text = str_replace(array('[link', '[/link]', '[q]', '[/q]'), array('[url', '[/url]', '[quote]', '[/quote]'), $this->text);
return text::auto_p($this->Parse($this->text));
}
示例4: paragraphs
/**
* Markdown-style paragraph converter
*
* @param string
* @return string
*/
public static function paragraphs($text)
{
return str_replace('<br />', '', text::auto_p($text));
}
示例5: View
?>
<br/>
<label>Uniques:</label> <?php
echo $island->visits();
?>
<br/>
<label>Views:</label> <?php
echo $island->views;
?>
<br/>
</fieldset>
<h2>Message From The Founder</h2>
<div class="post text-post">
<?php
echo text::auto_p(html::specialchars($island->introduction));
?>
</div>
<h2>Subsequent Posts</h2>
<?php
foreach ($island->posts() as $post) {
$view = new View('post/' . $post->type);
$view->post = $post;
echo $view->render();
}
if (Auth::instance()->logged_in()) {
?>
<h2>Leave A Post</h2>
<?php
echo form::open('/island/post/' . $island->code);
示例6:
<div class="post text-post">
<?php
echo text::auto_p(html::specialchars($post->get_post()->content));
?>
<div class="post-attribution">Posted By <?php
echo html::anchor('/user/view/' . html::specialchars($post->user->username), html::specialchars($post->user->username));
?>
</div>
</div>
示例7: edit_profile
private function edit_profile($page_name)
{
if (!$this->account_user->logged_in($this->site_id)) {
return $this->display_login($page_name);
}
$primary = new View('public_account/accounts/edit_profile');
$db = new Database();
$account_user = $this->account_user->get_user();
$primary->account_user = $account_user;
$primary->page_name = $page_name;
if ($_POST) {
if (!empty($_POST['bio'])) {
$db->insert('account_user_meta', array('fk_site' => $this->site_id, 'account_user_id' => $account_user->id, 'key' => 'bio', 'value' => text::auto_p($_POST['bio'])));
} else {
foreach ($_POST as $id => $data) {
$db->update('account_user_meta', array('value' => $data), "id = '{$id}' AND fk_site = {$this->site_id}");
}
}
$primary->status = 'Profile Saved!';
}
$meta = $db->query("\n SELECT *\n FROM account_user_meta\n WHERE account_user_id = '{$account_user->id}'\n AND fk_site = '{$this->site_id}'\n ");
$primary->meta = 0 == $meta->count() ? FALSE : $meta;
return $primary;
}
示例8:
<p><strong><?php
echo $name;
?>
</strong> is interested in <strong><?php
echo $work;
?>
</strong> with a budget of <strong><?php
echo $budget;
?>
</strong>.</p>
<?php
echo text::auto_p(text::auto_link($description));