highlight() public static method

Highlights a string.
public static highlight ( string $string ) : string
$string string
return string
Beispiel #1
0
 protected function getOutput()
 {
     $id = $this->getArg('id', 0, true);
     if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
         return false;
     }
     $value = $this->getContextData()->getValue('value' . $id);
     if ($this->hasArg('isset') && $this->getArg('isset')) {
         return $value ? 'true' : 'false';
     }
     $output = $this->getArg('output');
     if ($output == 'php') {
         if ($this->environmentIs(self::ENV_BACKEND)) {
             $value = rex_string::highlight($value);
         } else {
             return 'rex_var::nothing(require rex_stream::factory(substr(__FILE__, 6) . \'/REX_VALUE/' . $id . '\', ' . self::quote($value) . '))';
         }
     } elseif ($output == 'html') {
         $value = str_replace(['<?', '?>'], ['&lt;?', '?&gt;'], $value);
     } else {
         $value = htmlspecialchars($value);
         if (!$this->environmentIs(self::ENV_INPUT)) {
             $value = nl2br($value);
         }
     }
     return self::quote($value);
 }
 protected function getOutput()
 {
     $id = $this->getArg('id', 0, true);
     if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
         return false;
     }
     $value = $this->getContextData()->getValue('value' . $id);
     if ($this->hasArg('isset') && $this->getArg('isset')) {
         return $value ? 'true' : 'false';
     }
     $classes = [];
     if ($this->hasArg('class') && $this->getArg('class')) {
         $classes[] = $this->getArg('class');
     }
     if ($this->hasArg('widget') && $this->getArg('widget')) {
         $value = htmlspecialchars($value);
         if (!$this->environmentIs(self::ENV_INPUT)) {
             $value = nl2br($value);
         }
         $classes[] = 'form-control';
         $class = ' class="' . implode(' ', $classes) . '"';
         $type = $this->getArg('type', 'text', true);
         switch ($type) {
             case 'textarea':
                 $widget = '<textarea' . $class . ' name="REX_INPUT_VALUE[' . $id . ']" rows="10">' . $value . '</textarea>';
                 break;
             default:
                 $widget = '<input' . $class . ' type="' . $type . '" name="REX_INPUT_VALUE[' . $id . ']" value="' . $value . '" />';
                 break;
         }
         if ($this->hasArg('output') && $this->getArg('output')) {
             $label = $this->hasArg('label') ? $this->getArg('label') : '';
             $widget = Dao::getForm($widget, $label, $this->getArg('output'));
         }
         return self::quote($widget);
     }
     $output = $this->getArg('output');
     if ($output == 'php') {
         if ($this->environmentIs(self::ENV_BACKEND)) {
             $value = rex_string::highlight($value);
         } else {
             return 'rex_var::nothing(require rex_stream::factory(substr(__FILE__, 6) . \'/REX_VALUE/' . $id . '\', ' . self::quote($value) . '))';
         }
     } elseif ($output == 'html') {
         $value = str_replace(['<?', '?>'], ['&lt;?', '?&gt;'], $value);
     } else {
         $value = htmlspecialchars($value);
         if (!$this->environmentIs(self::ENV_INPUT)) {
             $value = nl2br($value);
         }
     }
     return self::quote($value);
 }
Beispiel #3
0
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', 'Prüfen ob der aktuelle Browser Chrome ist', false);
//todo: translate
$fragment->setVar('body', rex_string::highlight($code), false);
echo $fragment->parse('core/page/section.php');
///
$code = "";
$code .= "<?php" . PHP_EOL;
$code .= "\tif (useragent::isBrowserInternetExplorer()) {" . PHP_EOL;
$code .= "\t\t//..." . PHP_EOL;
$code .= "\t}" . PHP_EOL;
$code .= "?>";
$fragment = new rex_fragment();
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', 'Prüfen ob der aktuelle Browser Internet Explorer ist', false);
//todo: translate
$fragment->setVar('body', rex_string::highlight($code), false);
echo $fragment->parse('core/page/section.php');
///
$code = "";
$code .= "<?php" . PHP_EOL;
$code .= "\tif (useragent::isBrowserEdge()) {" . PHP_EOL;
$code .= "\t\t//..." . PHP_EOL;
$code .= "\t}" . PHP_EOL;
$code .= "?>";
$fragment = new rex_fragment();
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', 'Prüfen ob der aktuelle Browser Edge ist', false);
//todo: translate
$fragment->setVar('body', rex_string::highlight($code), false);
echo $fragment->parse('core/page/section.php');
Beispiel #4
0
    // HTML body
    $body  = "Hello <font size=\\"4\\">" . $row->getValue("full_name") . "</font>, <p>";
    $body .= "<i>Your</i> personal photograph to this message.<p>";
    $body .= "Sincerely, <br />";
    $body .= "phpmailer List manager";

    // Plain text body (for mail clients that cannot read HTML)
    $text_body  = "Hello " . $row->getValue("full_name") . ", \\n\\n";
    $text_body .= "Your personal photograph to this message.\\n\\n";
    $text_body .= "Sincerely, \\n";
    $text_body .= "phpmailer List manager";

    $mail->Body    = $body;
    $mail->AltBody = $text_body;
    $mail->AddAddress($row->getValue("email"), $row->getValue("full_name"));
    $mail->AddStringAttachment($sql->getValue("photo"), "YourPhoto.jpg");

    if(!$mail->Send())
        echo "There has been a mail error sending to " . $row->getValue("email") . "<br>";

    // Clear all addresses and attachments for next loop
    $mail->ClearAddresses();
    $mail->ClearAttachments();
}

?>';
$fragment = new rex_fragment();
$fragment->setVar('title', $this->i18n('example_headline'));
$fragment->setVar('body', rex_string::highlight($mdl_ex), false);
$content = $fragment->parse('core/page/section.php');
echo $content;
Beispiel #5
0
<?php

$fragment = new rex_fragment();
$content = '
<p>Folgendes im Template einfügen:</p>
';
$content .= rex_string::highlight(rex_file::get(rex_path::addon('focuspoint', 'pages/info_template.inc')));
$content .= '
<p>Bei der Installation wurde ein Effekt beim Media Manager AddOn hinzugefügt. Sollte dieser fehlen, bitte ein reinstall durchführen</p>
<p>Diese Ausgabe dient als Beispiel für ein Modul:</p>

';
$content .= rex_string::highlight(rex_file::get(rex_path::addon('focuspoint', 'pages/info_modul.inc')));
$fragment = new rex_fragment();
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', $this->i18n('help'), false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');