本文整理汇总了PHP中check_plain函数的典型用法代码示例。如果您正苦于以下问题:PHP check_plain函数的具体用法?PHP check_plain怎么用?PHP check_plain使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_plain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: iflychat_get_current_guest_id
function iflychat_get_current_guest_id()
{
if (isset($_SESSION) && isset($_SESSION['iflychat_guest_id'])) {
//if(!isset($_COOKIE) || !isset($_COOKIE['drupalchat_guest_id'])) {
setrawcookie('iflychat_guest_id', rawurlencode($_SESSION['iflychat_guest_id']), time() + 60 * 60 * 24 * 365);
setrawcookie('iflychat_guest_session', rawurlencode($_SESSION['iflychat_guest_session']), time() + 60 * 60 * 24 * 365);
//}
} else {
if (isset($_COOKIE) && isset($_COOKIE['iflychat_guest_id']) && isset($_COOKIE['iflychat_guest_session']) && $_COOKIE['iflychat_guest_session'] == iflychat_compute_guest_session($_COOKIE['iflychat_guest_id'])) {
$_SESSION['iflychat_guest_id'] = check_plain($_COOKIE['iflychat_guest_id']);
$_SESSION['iflychat_guest_session'] = check_plain($_COOKIE['iflychat_guest_session']);
} else {
$characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
$iflychatId = time();
for ($i = 0; $i < 5; $i++) {
$iflychatId .= $characters[rand(0, strlen($characters) - 1)];
}
$_SESSION['iflychat_guest_id'] = $iflychatId;
$_SESSION['iflychat_guest_session'] = iflychat_compute_guest_session($_SESSION['iflychat_guest_id']);
setrawcookie('iflychat_guest_id', rawurlencode($_SESSION['iflychat_guest_id']), time() + 60 * 60 * 24 * 365);
setrawcookie('iflychat_guest_session', rawurlencode($_SESSION['iflychat_guest_session']), time() + 60 * 60 * 24 * 365);
}
}
return $_SESSION['iflychat_guest_id'];
}
示例2: bootstrap_material_menu_local_action
/**
* Overrides theme_menu_local_action().
*
* Overrides Bootstrap module's override. All we're doing is making the action
* link buttons bigger by removing the 'btn-xs' class.
*
* @see bootstrap_menu_local_action()
*/
function bootstrap_material_menu_local_action($variables)
{
$link = $variables['element']['#link'];
$options = isset($link['localized_options']) ? $link['localized_options'] : array();
// If the title is not HTML, sanitize it.
if (empty($options['html'])) {
$link['title'] = check_plain($link['title']);
}
$icon = _bootstrap_iconize_text($link['title']);
// Format the action link.
$output = '';
if (isset($link['href'])) {
// Turn link into a mini-button and colorize based on title.
if ($class = _bootstrap_colorize_text($link['title'])) {
if (!isset($options['attributes']['class'])) {
$options['attributes']['class'] = array();
}
$string = is_string($options['attributes']['class']);
if ($string) {
$options['attributes']['class'] = explode(' ', $options['attributes']['class']);
}
$options['attributes']['class'][] = 'btn';
$options['attributes']['class'][] = 'btn-' . $class;
if ($string) {
$options['attributes']['class'] = implode(' ', $options['attributes']['class']);
}
}
// Force HTML so we can render any icon that may have been added.
$options['html'] = !empty($options['html']) || !empty($icon) ? TRUE : FALSE;
$output .= l($icon . $link['title'], $link['href'], $options);
} else {
$output .= $icon . $link['title'];
}
return $output;
}
示例3: isPaymentValid
public static function isPaymentValid($oplataSettings, $response)
{
list($orderId, ) = explode(self::ORDER_SEPARATOR, $response['order_id']);
$order = uc_order_load($orderId);
if ($order === FALSE || uc_order_status_data($order->order_status, 'state') != 'in_checkout') {
return t('An error has occurred during payment. Please contact us to ensure your order has submitted.');
}
if ($oplataSettings->merchant_id != $response['merchant_id']) {
return t('An error has occurred during payment. Merchant data is incorrect.');
}
$originalResponse = $response;
foreach ($response as $k => $v) {
if (!in_array($k, self::$responseFields)) {
unset($response[$k]);
}
}
if (self::getSignature($response, $oplataSettings->secret_key) != $originalResponse['signature']) {
return t('An error has occurred during payment. Signature is not valid.');
}
if (drupal_strtolower($originalResponse['sender_email']) !== drupal_strtolower($order->primary_email)) {
uc_order_comment_save($order->order_id, 0, t('Customer used a different e-mail address during payment: !email', array('!email' => check_plain($originalResponse['sender_email']))), 'admin');
}
uc_order_comment_save($order->order_id, 0, "Order status: {$response['order_status']}", 'admin');
return true;
}
示例4: garland_preprocess_page
/**
* Override or insert variables into the page template.
*/
function garland_preprocess_page(&$vars)
{
$vars['tabs2'] = menu_secondary_local_tasks();
if (isset($vars['main_menu'])) {
$vars['primary_nav'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['primary_nav'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_nav'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['secondary_nav'] = FALSE;
}
// Prepare header.
$site_fields = array();
if (!empty($vars['site_name'])) {
$site_fields[] = check_plain($vars['site_name']);
}
if (!empty($vars['site_slogan'])) {
$site_fields[] = check_plain($vars['site_slogan']);
}
$vars['site_title'] = implode(' ', $site_fields);
if (!empty($site_fields)) {
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
}
$vars['site_html'] = implode(' ', $site_fields);
// Set a variable for the site name title and logo alt attributes text.
$slogan_text = filter_xss_admin(variable_get('site_slogan', ''));
$site_name_text = filter_xss_admin(variable_get('site_name', 'Drupal'));
$vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
}
示例5: theme_bootstrap_btn_dropdown
/**
* Implements theme_bootstrap_btn_dropdown().
*/
function theme_bootstrap_btn_dropdown($variables)
{
$type_class = '';
$sub_links = '';
$variables['attributes']['class'][] = 'btn-group';
// Type class.
if (isset($variables['type'])) {
$type_class .= ' btn-' . $variables['type'];
} else {
$type_class .= ' btn-default';
}
// Start markup.
$output = '<div' . drupal_attributes($variables['attributes']) . '>';
// Add as string if its not a link.
if (is_array($variables['label'])) {
$output .= l($variables['label']['title'], ${$variables}['label']['href'], $variables['label']);
}
$output .= '<a class="btn' . $type_class . ' dropdown-toggle" data-toggle="dropdown" href="#">';
// It is a link, create one.
if (is_string($variables['label'])) {
$output .= check_plain($variables['label']);
}
if (is_array($variables['links'])) {
$sub_links = theme('links', array('links' => $variables['links'], 'attributes' => array('class' => array('dropdown-menu'))));
}
// Finish markup.
$output .= '<span class="caret"></span></a>' . $sub_links . '</div>';
return $output;
}
示例6: list_build_row
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$item->name] = empty($item->disabled) . $item->admin_title;
break;
case 'title':
$this->sorts[$item->name] = $item->admin_title;
break;
case 'name':
$this->sorts[$item->name] = $item->name;
break;
case 'category':
$this->sorts[$item->name] = ($item->category ? $item->category : t('Mini panels')) . $item->admin_title;
break;
case 'layout':
$this->sorts[$item->name] = $item->display->layout . $item->admin_title;
break;
case 'storage':
$this->sorts[$item->name] = $item->type . $item->admin_title;
break;
}
$layout = !empty($this->layouts[$item->display->layout]) ? $this->layouts[$item->display->layout]['title'] : t('Missing layout');
$category = $item->category ? check_plain($item->category) : t('Mini panels');
$this->rows[$item->name] = array('data' => array(array('data' => check_plain($item->admin_title), 'class' => 'ctools-export-ui-title'), array('data' => check_plain($item->name), 'class' => 'ctools-export-ui-name'), array('data' => $category, 'class' => 'ctools-export-ui-category'), array('data' => $layout, 'class' => 'ctools-export-ui-layout'), array('data' => $item->type, 'class' => 'ctools-export-ui-storage'), array('data' => theme('links', $operations), 'class' => 'ctools-export-ui-operations')), 'title' => !empty($item->admin_description) ? check_plain($item->admin_description) : '', 'class' => !empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled');
}
示例7: quickdrupal_username
/**
* Override theme_username() function.
* Removes the text '(not verified)' for anonymous users.
*/
function quickdrupal_username($object)
{
if ($object->uid && $object->name) {
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) . '...';
} else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/' . $object->uid, array('attributes' => array('title' => t('View user profile.'))));
} else {
$output = check_plain($name);
}
} else {
if ($object->name) {
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
} else {
$output = check_plain($object->name);
}
} else {
$output = check_plain(variable_get('anonymous', t('Anonymous')));
}
}
return $output;
}
示例8: render
/**
* Builds inner content, then hands off to layout-specified theme function for
* final render step.
*
* This is the outermost method in the Panels render pipeline. It calls the
* inner methods, which return a content array, which is in turn passed to the
* theme function specified in the layout plugin.
*
* @return string
* Themed & rendered HTML output.
*/
function render()
{
if (!empty($this->plugins['layout']['css'])) {
if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) {
drupal_add_css(path_to_theme() . '/' . $this->plugins['layout']['css']);
} else {
drupal_add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['css']);
}
}
// This now comes after the CSS is added, because panels-within-panels must
// have their CSS added in the right order; inner content before outer content.
if (empty($this->display->cache['method']) || !empty($this->display->skip_cache)) {
$content = $this->render_regions();
} else {
$cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context);
if ($cache === FALSE) {
$cache = new panels_cache_object();
$cache->set_content($this->render_regions());
panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context);
}
$content = $cache->content;
}
$output = theme($this->plugins['layout']['theme'], check_plain($this->display->css_id), $content, $this->display->layout_settings, $this->display, $this->plugins['layout'], $this);
return $output;
}
示例9: build
public function build($form, &$form_state)
{
$relationships = ablecore_menu_get_path_relationships();
$form['#tree'] = true;
if (count($relationships) <= 0) {
$form['#no-results'] = true;
return $form;
}
foreach ($relationships as $id => $relationship) {
$form['relationships'][$id]['pid'] = array('#type' => 'hidden', '#value' => $relationship->get('pid'));
$form['relationships'][$id]['path'] = array('#markup' => check_plain($relationship->get('path')));
$menu_link = $relationship->menuLink();
if (!$menu_link) {
continue;
}
$form['relationships'][$id]['menu_link'] = array('#type' => 'link', '#title' => $menu_link['link_title'], '#href' => 'admin/structure/menu/item/' . $menu_link['mlid'] . '/edit');
$form['relationships'][$id]['type'] = array('#markup' => ucfirst(check_plain($relationship->get('type'))));
$form['relationships'][$id]['edit'] = array('#type' => 'link', '#title' => t('edit'), '#href' => 'admin/config/ablecore/menu-relationships/' . $relationship->get('pid') . '/edit');
$form['relationships'][$id]['delete'] = array('#type' => 'link', '#title' => t('delete'), '#href' => 'admin/config/ablecore/menu-relationships/' . $relationship->get('pid') . '/delete');
$form['relationships'][$id]['weight'] = array('#type' => 'weight', '#title' => t('Weight for @title', array('@title' => $relationship->get('path'))), '#title_display' => 'invisible', '#default_value' => $relationship->get('weight'));
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
return $form;
}
示例10: preBuild
/**
* {@inheritdoc}
*/
public function preBuild(array &$build, \Drupal\openlayers\Types\ObjectInterface $context = NULL)
{
$map_id = $context->getId();
$layers = $this->getOption('layers', array());
$items = array();
$map_layers = $context->getObjects('layer');
$element_type = $this->getOption('multiselect', FALSE) ? 'checkbox' : 'radio';
// Only handle layers available in the map and configured in the control.
// @TODO: use Form API (with form_process_* and stuff)
$labels = $this->getOption('layer_labels', array());
foreach ($map_layers as $i => $map_layer) {
if (isset($layers[$map_layer->machine_name])) {
$classes = array(drupal_html_class($map_layer->machine_name));
$checked = '';
if ($element_type == 'checkbox') {
if ($map_layer->getOption('visible', 1)) {
$checked = 'checked ';
$classes[] = 'active';
}
}
$label = check_plain($map_layer->name);
if (isset($labels[$map_layer->machine_name])) {
$label = openlayers_i18n_string('openlayers:layerswitcher:' . $this->machine_name . ':' . $map_layer->machine_name . ':label', $labels[$map_layer->machine_name], array('sanitize' => TRUE));
}
$items[] = array('data' => '<label><input type="' . $element_type . '" name="layer" ' . $checked . 'value="' . $map_layer->machine_name . '">' . $label . '</label>', 'id' => drupal_html_id($map_id . '-' . $map_layer->machine_name), 'class' => $classes);
}
}
$title = openlayers_i18n_string('openlayers:layerswitcher:' . $this->machine_name . ':title', $this->getOption('label', 'Layers'), array('sanitize' => TRUE));
$layerswitcher = array('#theme' => 'item_list', '#type' => 'ul', '#title' => $title, '#items' => $items, '#attributes' => array('id' => drupal_html_id($this->machine_name . '-items')));
$this->setOption('element', '<div id="' . drupal_html_id($this->machine_name) . '" class="' . drupal_html_class($this->machine_name) . ' layerswitcher">' . drupal_render($layerswitcher) . '</div>');
}
示例11: garland_preprocess_page
/**
* Override or insert variables into the page template.
*/
function garland_preprocess_page(&$vars)
{
$vars['tabs2'] = menu_secondary_local_tasks();
if (isset($vars['main_menu'])) {
$vars['primary_nav'] = theme('links', $vars['main_menu'], array('class' => array('links', 'main-menu')), array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible')));
} else {
$vars['primary_nav'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_nav'] = theme('links', $vars['secondary_menu'], array('class' => array('links', 'secondary-menu')), array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible')));
} else {
$vars['secondary_nav'] = FALSE;
}
$vars['ie_styles'] = garland_get_ie_styles();
// Prepare header
$site_fields = array();
if (!empty($vars['site_name'])) {
$site_fields[] = check_plain($vars['site_name']);
}
if (!empty($vars['site_slogan'])) {
$site_fields[] = check_plain($vars['site_slogan']);
}
$vars['site_title'] = implode(' ', $site_fields);
if (!empty($site_fields)) {
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
}
$vars['site_html'] = implode(' ', $site_fields);
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
}
示例12: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Warn users if network id has no value. This can happen immediatly after
// the module is installed.
if (variable_get('dfp_network_id', '') == '') {
drupal_set_message(t('DFP ad tags will not work until you have <a href="/admin/structure/dfp_ads/settings">set your network id</a> as provided by Google.'), 'warning', FALSE);
}
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
$this->rows[$name]['data'][] = array('data' => check_plain($item->slot), 'class' => array('ctools-export-ui-slot'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->size), 'class' => array('ctools-export-ui-size'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->block) ? t('Yes') : t('No'), 'class' => array('ctools-export-ui-block'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
}
示例13: testNode
/**
* Tests node type links.
*/
function testNode()
{
$type = $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
// Create a content-type with special characters.
$type = $this->drupalCreateContentType(array('type' => 'special', 'name' => 'Cool & Special'));
$permissions = $this->basePermissions + array('administer content types', 'access content', 'create article content', 'create special content');
$this->admin_user = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->admin_user);
// Verify that dynamic links are displayed.
$this->drupalGet('');
$this->assertElementByXPath('//div[@id="admin-menu"]', array(), t('Administration menu found.'));
$this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path)]', array(':path' => 'admin/structure/types'), "Structure » Content types link found.");
// Verify link title output escaping.
$this->assertNoRaw('Cool & Special');
$this->assertRaw(check_plain('Cool & Special'));
// Verify Manage content type links.
$links = array('admin/structure/types/manage/article' => 'Article', 'admin/structure/types/manage/special' => 'Cool & Special');
foreach ($links as $path => $title) {
$this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path) and text()=:title]', array(':path' => $path, ':title' => $title), "Structure » Content types » {$title} link found.");
}
// Verify Add content links.
// @todo Fix expansion of node/add.
return;
$links = array('node/add/article' => 'Article', 'node/add/special' => 'Cool & Special');
foreach ($links as $path => $title) {
$this->assertElementByXPath('//div[@id="admin-menu"]//a[contains(@href, :path) and text()=:title]', array(':path' => $path, ':title' => $title), "Add content » {$title} link found.");
}
}
示例14: messaging_token_values
/**
* Implementation of hook_token_values()
*/
function messaging_token_values($type, $object = NULL, $options = array())
{
$language = isset($options['language']) ? $options['language'] : $GLOBALS['language'];
switch ($type) {
case 'message':
if ($message = messaging_check_object($object, 'Messaging_Message')) {
$values['message-subject'] = check_plain($message->get_subject());
$values['message-body'] = filter_xss($message->get_body());
$values['message-author-name'] = check_plain($message->get_sender_name());
$values['message-method'] = messaging_method_info($message->method, 'name');
$timezone = isset($options['timezone']) ? $options['timezone'] : variable_get('date_default_timezone', 0);
$values['message-date'] = format_date($message->sent, 'medium', '', $timezone, $language->language);
return $values;
}
break;
case 'destination':
// Messaging destinations
if ($destination = messaging_check_object($object, 'Messaging_Destination')) {
$values['destination-address'] = $destination->format_address(FALSE);
$values['destination-type'] = $destination->address_name();
return $values;
}
break;
}
}
示例15: phptemplate_username
function phptemplate_username($object)
{
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (arg(0) == 'user' or 'groups') {
$name = $object->name;
} else {
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) . '...';
} else {
$name = $object->name;
}
}
if (user_access('access user profiles')) {
$output = l($name, 'user/' . $object->uid, array('title' => t('View user profile.')));
} else {
$output = check_plain($name);
}
} else {
if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if ($object->homepage) {
$output = l($object->name, $object->homepage, array('class' => 'anonymous', 'title' => t('not verified')));
} else {
$output = '<span class="anonymous" title="' . t('not verified') . '">' . check_plain($object->name) . '</span>';
}
} else {
$output = variable_get('anonymous', t('Anonymous'));
}
}
return $output;
}