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


PHP check_markup函数代码示例

本文整理汇总了PHP中check_markup函数的典型用法代码示例。如果您正苦于以下问题:PHP check_markup函数的具体用法?PHP check_markup怎么用?PHP check_markup使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: format

 /**
  * {@inheritdoc}
  */
 public function format(array $message)
 {
     if (is_array($message['body'])) {
         $message['body'] = implode("\n\n", $message['body']);
     }
     if (preg_match('/plain/', $message['headers']['Content-Type'])) {
         if (!($format = \Drupal::config('mimemail.settings')->get('format'))) {
             $format = filter_fallback_format();
         }
         $message['body'] = check_markup($message['body'], $format);
     }
     /*$engine = variable_get('mimemail_engine', 'mimemail');
         //$mailengine = $engine . '_mailengine';
         $engine_prepare_message = $engine . '_prepare_message';
     
         if (function_exists($engine_prepare_message)) {
           $message = $engine_prepare_message($message);
         }
         else {
           $message = mimemail_prepare_message($message);
         }*/
     // @TODO set mimemail_engine. For the moment let's prepare the message.
     $message = $this->prepareMessage($message);
     return $message;
 }
开发者ID:augustpascual-mse,项目名称:job-searching-network,代码行数:28,代码来源:MimeMail.php

示例2: testSkipSecurityFilters

 /**
  * Tests that security filters are enforced even when marked to be skipped.
  */
 function testSkipSecurityFilters()
 {
     $text = "Text with some disallowed tags: <script />, <p><object>unicorn</object></p>, <i><table></i>.";
     $expected_filtered_text = "Text with some disallowed tags: , <p>unicorn</p>, .";
     $this->assertEqual(check_markup($text, 'filtered_html', '', array()), $expected_filtered_text, 'Expected filter result.');
     $this->assertEqual(check_markup($text, 'filtered_html', '', array(FilterInterface::TYPE_HTML_RESTRICTOR)), $expected_filtered_text, 'Expected filter result, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:FilterSecurityTest.php

示例3: gettysw_preprocess_field

/**
 * Add link to view full-sized image in colorbox and add caption
 */
function gettysw_preprocess_field(&$vars, $hook)
{
    foreach ($vars['element']['#items'] as $delta => $item) {
        if (!empty($vars['element'][$delta])) {
            if (module_exists('image_field_caption') && isset($item['image_field_caption'])) {
                $vars['items'][$delta]['caption'] = check_markup($item['image_field_caption']['value'], $item['image_field_caption']['format']);
            }
            if ($vars['element']['#field_name'] == 'field_image' && isset($item['uri']) && module_exists('colorbox') && empty($vars['element']['#object']->is_export)) {
                $vars['items'][$delta]['colorbox_link'] = '<a class="colorbox" href="' . file_create_url($item['uri']) . '">Expand Image</a>';
            }
            if ($vars['element']['#field_name'] == 'field_image_reference_info' && $vars['element']['#view_mode'] == 'full') {
                drupal_add_css(drupal_get_path('module', 'lighttable') . '/lighttable.css');
                $vars['content_attributes_array'] = array('id' => 'lighttable');
                foreach ($vars['items'] as $delta => $item) {
                    $fc_item = reset($vars['items'][$delta]['entity']['field_collection_item']);
                    $image_entity = $fc_item['#entity']->field_image_reference[LANGUAGE_NONE][0]['entity'];
                    $file_nodes = file_usage_list($image_entity);
                    $image_node = node_load(key($file_nodes['file']['node']));
                    $vars['items'][$delta]['entity']['field_collection_item']['title'] = array('#markup' => '<span class="field-title">' . $image_node->title . '</span>', '#weight' => -1);
                    $left = $fc_item['#entity']->field_x_pos[LANGUAGE_NONE][0]['value'];
                    $top = $fc_item['#entity']->field_y_pos[LANGUAGE_NONE][0]['value'];
                    $width = $fc_item['#entity']->field_width[LANGUAGE_NONE][0]['value'];
                    $height = $fc_item['#entity']->field_height[LANGUAGE_NONE][0]['value'];
                    $vars['items'][$delta]['#attributes']['style'] = "position: absolute; top: {$top}px; left: {$left}px; width: {$width}px; height: {$height}px;";
                    $vars['items'][$delta]['#attributes']['class'][] = 'lighttable-image-container';
                }
            }
        }
    }
}
开发者ID:GettyScholarsWorkspace,项目名称:GettyScholarsWorkspace,代码行数:33,代码来源:template.php

示例4: bollaert_preprocess_htmlmail

/**
 * Process variables to format email messages.
 *
 * @see htmlmail.tpl.php
 */
function bollaert_preprocess_htmlmail(&$variables)
{
    // Run the default preprocess function.
    template_preprocess_htmlmail($variables);
    // Use the 'HTML Email' text format for the message body.
    $variables['body'] = check_markup($variables['body'], 'html_email');
}
开发者ID:akapivo,项目名称:www.bollaertbvba.be,代码行数:12,代码来源:template.php

示例5: commons_origins_preprocess_page

function commons_origins_preprocess_page(&$variables)
{
    $variables['pre_header_top'] = theme('grid_row', $variables['header_top'], 'header-top', 'full-width', $variables['grid_width']);
    $variables['pre_secondary_links'] = theme('grid_block', theme('links', $variables['secondary_links']), 'secondary-menu');
    $variables['pre_search_box'] = theme('grid_block', $variables['search_box'], 'search-box');
    $variables['pre_primary_links_tree'] = theme('grid_block', $variables['primary_links_tree'], 'primary-menu');
    $variables['pre_breadcrumb'] = theme('grid_block', $variables['breadcrumb'], 'breadcrumbs');
    $variables['pre_preface_top'] = theme('grid_row', $variables['preface_top'], 'preface-top', 'full-width', $variables['grid_width']);
    $variables['pre_sidebar_first'] = theme('grid_row', $variables['sidebar_first'], 'sidebar-first', 'nested', $variables['sidebar_first_width']);
    $variables['pre_preface_bottom'] = theme('grid_row', $variables['preface_bottom'], 'preface-bottom', 'nested');
    $variables['pre_help'] = theme('grid_block', $variables['help'], 'content-help');
    $variables['pre_messages'] = theme('grid_block', $variables['messages'], 'content-messages');
    $variables['pre_tabs'] = theme('grid_block', $variables['tabs'], 'content-tabs');
    $variables['pre_content_bottom'] = theme('grid_row', $variables['content_bottom'], 'content-bottom', 'nested');
    $variables['pre_sidebar_last'] = theme('grid_row', $variables['sidebar_last'], 'sidebar-last', 'nested', $variables['sidebar_last_width']);
    $variables['pre_postscript_top'] = theme('grid_row', $variables['postscript_top'], 'postscript-top', 'nested');
    $variables['pre_postscript_bottom'] = theme('grid_row', $variables['postscript_bottom'], 'postscript-bottom', 'full-width', $variables['grid_width']);
    $variables['pre_footer'] = theme('grid_row', $variables['footer'] . $variables['footer_message'], 'footer', 'full-width', $variables['grid_width']);
    //show group description if group node present
    if (isset($variables['node'])) {
        $node = $variables['node'];
        if (og_is_group_type($node->type)) {
            $variables['group_header_image'] = content_format('field_group_image', $node->field_group_image[0], 'user_picture_meta_default');
            if (!empty($node->body)) {
                $variables['group_header_text'] = check_markup($node->body, $node->format);
            } else {
                $variables['group_header_text'] = check_plain($node->og_description);
            }
        }
    }
}
开发者ID:nickflyer,项目名称:OU,代码行数:31,代码来源:template.php

示例6: HOOK_builder_content_view

/**
 * HOOK_builder_content_view()
 */
function HOOK_builder_content_view($delta = '', $content = array())
{
    $content = '';
    switch ($delta) {
        case 'node':
            $node_content = '';
            if (!empty($content['settings']['nid'])) {
                $nid = $content['settings']['nid'];
                if ($node = node_load($nid)) {
                    if (isset($content['settings']['hide_node_title']) && $content['settings']['hide_node_title']) {
                        // hide node title.
                        $node->title = FALSE;
                    }
                    $node_view = node_view($node, $content['settings']['view_mode']);
                    $node_content = render($node_view);
                }
            }
            $content['content'] = $node_content;
            break;
        case 'custom_text':
            $custom_text_value = isset($content['settings']['custom_text']['value']) ? $content['settings']['custom_text']['value'] : '';
            if (isset($content['settings']['custom_text']['format'])) {
                $custom_text_value = check_markup($custom_text_value, $content['settings']['custom_text']['format']);
            }
            $content['content'] = $custom_text_value;
            break;
            return $content;
    }
}
开发者ID:vitkuz,项目名称:superfield,代码行数:32,代码来源:builder.api.php

示例7: asf_preprocess_page

/**
 * Implements template_preprocess_page().
 */
function asf_preprocess_page(&$variables)
{
    // Add copyright to theme.
    if ($copyright = theme_get_setting('copyright')) {
        $variables['copyright'] = check_markup($copyright['value'], $copyright['format']);
    }
}
开发者ID:kenef,项目名称:dasf,代码行数:10,代码来源:template.php

示例8: testVideoFilter

 /**
  * Test the video ouput.
  *
  * @dataProvider videoFilterTestCases
  */
 public function testVideoFilter($content, $expected)
 {
     if ($expected === FALSE) {
         $expected = $content;
     }
     $filtered_markup = $this->stripWhitespace(check_markup($content, 'test_format'));
     $this->assertEquals($expected, $filtered_markup);
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:13,代码来源:FilterTest.php

示例9: testPathologic

 function testPathologic()
 {
     global $script_path;
     // Start by testing our function to build protocol-relative URLs
     $this->assertEqual(_pathologic_url_to_protocol_relative('http://example.com/foo/bar'), '//example.com/foo/bar', t('Protocol-relative URL creation with http:// URL'));
     $this->assertEqual(_pathologic_url_to_protocol_relative('https://example.org/baz'), '//example.org/baz', t('Protocol-relative URL creation with https:// URL'));
     // Build some paths to check against
     $test_paths = array('foo' => array('path' => 'foo', 'opts' => array()), 'foo/bar' => array('path' => 'foo/bar', 'opts' => array()), 'foo/bar?baz' => array('path' => 'foo/bar', 'opts' => array('query' => array('baz' => NULL))), 'foo/bar?baz=qux' => array('path' => 'foo/bar', 'opts' => array('query' => array('baz' => 'qux'))), 'foo/bar#baz' => array('path' => 'foo/bar', 'opts' => array('fragment' => 'baz')), 'foo/bar?baz=qux&amp;quux=quuux#quuuux' => array('path' => 'foo/bar', 'opts' => array('query' => array('baz' => 'qux', 'quux' => 'quuux'), 'fragment' => 'quuuux')), 'foo%20bar?baz=qux%26quux' => array('path' => 'foo bar', 'opts' => array('query' => array('baz' => 'qux&quux'))), '/' => array('path' => '<front>', 'opts' => array()));
     foreach (array('full', 'proto-rel', 'path') as $protocol_style) {
         $format_id = _pathologic_build_format(['settings_source' => 'local', 'local_settings' => ['protocol_style' => $protocol_style]]);
         $paths = array();
         foreach ($test_paths as $path => $args) {
             $args['opts']['absolute'] = $protocol_style !== 'path';
             $paths[$path] = _pathologic_content_url($args['path'], $args['opts']);
             if ($protocol_style === 'proto-rel') {
                 $paths[$path] = _pathologic_url_to_protocol_relative($paths[$path]);
             }
         }
         $t10ns = array('@clean' => empty($script_path) ? t('Yes') : t('No'), '@ps' => $protocol_style);
         $this->assertEqual(check_markup('<a href="foo"><img src="foo/bar" /></a>', $format_id), '<a href="' . $paths['foo'] . '"><img src="' . $paths['foo/bar'] . '" /></a>', t('Simple paths. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="index.php?q=foo"></a><a href="index.php?q=foo/bar&baz=qux"></a>', $format_id), '<a href="' . $paths['foo'] . '"></a><a href="' . $paths['foo/bar?baz=qux'] . '"></a>', t('D7 and earlier-style non-clean URLs. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="index.php/foo"></a><a href="index.php/foo/bar?baz=qux"></a>', $format_id), '<a href="' . $paths['foo'] . '"></a><a href="' . $paths['foo/bar?baz=qux'] . '"></a>', t('D8-style non-clean URLs. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<form action="foo/bar?baz"><IMG LONGDESC="foo/bar?baz=qux" /></a>', $format_id), '<form action="' . $paths['foo/bar?baz'] . '"><IMG LONGDESC="' . $paths['foo/bar?baz=qux'] . '" /></a>', t('Paths with query string. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="foo/bar#baz">', $format_id), '<a href="' . $paths['foo/bar#baz'] . '">', t('Path with fragment. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="#foo">', $format_id), '<a href="#foo">', t('Fragment-only href. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         // @see https://drupal.org/node/2208223
         $this->assertEqual(check_markup('<a href="#">', $format_id), '<a href="#">', t('Hash-only href. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="foo/bar?baz=qux&amp;quux=quuux#quuuux">', $format_id), '<a href="' . $paths['foo/bar?baz=qux&amp;quux=quuux#quuuux'] . '">', t('Path with query string and fragment. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="foo%20bar?baz=qux%26quux">', $format_id), '<a href="' . $paths['foo%20bar?baz=qux%26quux'] . '">', t('Path with URL encoded parts. Clean URLs: @clean; protocol style: @ps.', $t10ns));
         $this->assertEqual(check_markup('<a href="/"></a>', $format_id), '<a href="' . $paths['/'] . '"></a>', t('Path with just slash. Clean URLs: @clean; protocol style: @ps', $t10ns));
     }
     global $base_path;
     $this->assertEqual(check_markup('<a href="' . $base_path . 'foo">bar</a>', $format_id), '<a href="' . _pathologic_content_url('foo', array('absolute' => FALSE)) . '">bar</a>', t('Paths beginning with $base_path (like WYSIWYG editors like to make)'));
     global $base_url;
     $this->assertEqual(check_markup('<a href="' . $base_url . '/foo">bar</a>', $format_id), '<a href="' . _pathologic_content_url('foo', array('absolute' => FALSE)) . '">bar</a>', t('Paths beginning with $base_url'));
     // @see http://drupal.org/node/1617944
     $this->assertEqual(check_markup('<a href="//example.com/foo">bar</a>', $format_id), '<a href="//example.com/foo">bar</a>', t('Off-site schemeless URLs (//example.com/foo) ignored'));
     // Test internal: and all base paths
     $format_id = _pathologic_build_format(['settings_source' => 'local', 'local_settings' => ['local_paths' => "http://example.com/qux\nhttp://example.org\n/bananas", 'protocol_style' => 'full']]);
     // @see https://drupal.org/node/2030789
     $this->assertEqual(check_markup('<a href="//example.org/foo">bar</a>', $format_id), '<a href="' . _pathologic_content_url('foo', array('absolute' => TRUE)) . '">bar</a>', t('On-site schemeless URLs processed'));
     $this->assertEqual(check_markup('<a href="internal:foo">', $format_id), '<a href="' . _pathologic_content_url('foo', array('absolute' => TRUE)) . '">', t('Path Filter compatibility (internal:)'));
     $this->assertEqual(check_markup('<a href="files:image.jpeg">look</a>', $format_id), '<a href="' . _pathologic_content_url(file_create_url(file_default_scheme() . '://image.jpeg'), array('absolute' => TRUE)) . '">look</a>', t('Path Filter compatibility (files:)'));
     $this->assertEqual(check_markup('<a href="http://example.com/qux/foo"><img src="http://example.org/bar.jpeg" longdesc="/bananas/baz" /></a>', $format_id), '<a href="' . _pathologic_content_url('foo', array('absolute' => TRUE)) . '"><img src="' . _pathologic_content_url('bar.jpeg', array('absolute' => TRUE)) . '" longdesc="' . _pathologic_content_url('baz', array('absolute' => TRUE)) . '" /></a>', t('"All base paths for this site" functionality'));
     $this->assertEqual(check_markup('<a href="webcal:foo">bar</a>', $format_id), '<a href="webcal:foo">bar</a>', t('URLs with likely protocols are ignored'));
     // Test hook_pathologic_alter() implementation.
     $this->assertEqual(check_markup('<a href="foo?test=add_foo_qpart">', $format_id), '<a href="' . _pathologic_content_url('foo', array('absolute' => TRUE, 'query' => array('test' => 'add_foo_qpart', 'foo' => 'bar'))) . '">', t('hook_pathologic_alter(): Alter $url_params'));
     $this->assertEqual(check_markup('<a href="bar?test=use_original">', $format_id), '<a href="bar?test=use_original">', t('hook_pathologic_alter(): Passthrough with use_original option'));
     // Test paths to existing files when clean URLs are disabled.
     // @see http://drupal.org/node/1672430
     $script_path = '';
     $filtered_tag = check_markup('<img src="misc/druplicon.png" />', $format_id);
     $this->assertTrue(strpos($filtered_tag, 'q=') === FALSE, t('Paths to files don\'t have ?q= when clean URLs are off'));
     $format_id = _pathologic_build_format(['settings_source' => 'global', 'local_settings' => ['protocol_style' => 'rel']]);
     $this->config('pathologic.settings')->set('protocol_style', 'proto-rel')->set('local_paths', 'http://example.com/')->save();
     $this->assertEqual(check_markup('<img src="http://example.com/foo.jpeg" />', $format_id), '<img src="' . _pathologic_url_to_protocol_relative(_pathologic_content_url('foo.jpeg', array('absolute' => TRUE))) . '" />', t('Use global settings when so configured on the format'));
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:57,代码来源:PathologicTest.php

示例10: pirateparty_preprocess_node

function pirateparty_preprocess_node(&$vars, $hook)
{
    $account = user_load($vars['uid']);
    $vars['user_signature'] = '';
    if (isset($account->signature, $account->signature_format)) {
        $vars['user_signature'] = check_markup($account->signature, $account->signature_format);
        $vars['submitted'] = t('Written by !username on !datetime', array('!username' => $vars['name'], '!datetime' => $vars['date']));
    }
}
开发者ID:ppuk,项目名称:ppuk-drupal-theme,代码行数:9,代码来源:template.php

示例11: getUntransformedText

 /**
  * Returns an Ajax response to render a text field without transformation filters.
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *   The entity of which a formatted text field is being rerendered.
  * @param string $field_name
  *   The name of the (formatted text) field that that is being rerendered
  * @param string $langcode
  *   The name of the language for which the formatted text field is being
  *   rerendered.
  * @param string $view_mode_id
  *   The view mode the formatted text field should be rerendered in.
  *
  * @return \Drupal\Core\Ajax\AjaxResponse
  *   The Ajax response.
  */
 public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode_id)
 {
     $response = new AjaxResponse();
     // Direct text editing is only supported for single-valued fields.
     $field = $entity->getTranslation($langcode)->{$field_name};
     $editable_text = check_markup($field->value, $field->format, $langcode, array(FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE));
     $response->addCommand(new GetUntransformedTextCommand($editable_text));
     return $response;
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:25,代码来源:EditorController.php

示例12: testCheckMarkupNoFormat

 /**
  * Tests text without format.
  *
  * Tests if text with no format is filtered the same way as text in the
  * fallback format.
  */
 function testCheckMarkupNoFormat()
 {
     // Create some text. Include some HTML and line breaks, so we get a good
     // test of the filtering that is applied to it.
     $text = "<strong>" . $this->randomMachineName(32) . "</strong>\n\n<div>" . $this->randomMachineName(32) . "</div>";
     // Make sure that when this text is run through check_markup() with no text
     // format, it is filtered as though it is in the fallback format.
     $this->assertEqual(check_markup($text), check_markup($text, filter_fallback_format()), 'Text with no format is filtered the same as text in the fallback format.');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:15,代码来源:FilterNoFormatTest.php

示例13: smc_base_preprocess_flexslider

/**
 * Implements hook_preprocess_flexslider().
 */
function smc_base_preprocess_flexslider(&$variables)
{
    if (!empty($variables['items'])) {
        foreach ($variables['items'] as $index => &$item) {
            if (!empty($item['item']['image_field_caption'])) {
                $item['caption'] = check_markup($item['item']['image_field_caption']['value'], $item['item']['image_field_caption']['format']);
            }
        }
    }
}
开发者ID:anselmbradford,项目名称:OpenSanMateo,代码行数:13,代码来源:template.php

示例14: nbadraft_preprocess_page

/**
 * Implements template_preprocess_page().
 */
function nbadraft_preprocess_page(&$variables)
{
    // Add copyright to theme.
    if ($copyright = theme_get_setting('copyright')) {
        $variables['copyright'] = check_markup($copyright['value'], $copyright['format']);
    }
    if (drupal_is_front_page()) {
        $variables['main_form'] = drupal_render(drupal_get_form('nbadraft_main_form'));
    }
}
开发者ID:eganr,项目名称:nba-draft-lookup,代码行数:13,代码来源:template.php

示例15: renderTemplate

 /**
  * Converts a template into rendered content.
  *
  * @param array $template
  *   Array of template sections.
  *
  * @return array
  *   Array of template content indexed by section ID.
  */
 private function renderTemplate($template)
 {
     $content = array();
     foreach ($template as $key => $part) {
         if (isset($part['format'])) {
             $content[$key] = check_markup($part['value'], $part['format']);
         }
     }
     return $content;
 }
开发者ID:rafavergara,项目名称:ddv8,代码行数:19,代码来源:MailchimpCampaignViewBuilder.php


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