コード例 #1
0
 /**
  * Return the admin page.
  * External text should be checked: = array('#markup' => check_plain($format->name));
  */
 function form($form, &$form_state)
 {
     $defaults = $this->parent->defaults();
     $test_text = $this->test_text;
     if (isset($form_state['storage'][$this->test_field])) {
         $test_text = $form_state['storage'][$this->test_field];
     }
     $default_list = array();
     foreach ($defaults as $name => $value) {
         if ($value === TRUE) {
             $value = 'TRUE';
         } elseif ($value === FALSE) {
             $value = 'FALSE';
         }
         $default_list[] = $name . ': <strong>' . htmlentities($value) . '</strong>';
     }
     $form['configure'] = array('#markup' => t('<p>The @dn module obfuscates email addresses to help prevent spambots from collecting them.' . ' It will produce clickable links if JavaScript is enabled,' . ' and will show the email address as <code>example [at] example [dot] com</code> if the browser does not support JavaScript.</p>' . '<p>To configure the module:<ol>' . '<li>Read the list of text formats at <a href="/admin/config/content/formats">Text formats</a>.</li>' . '<li>Select <strong>configure</strong> for the format requiring email addresses.</li>' . '<li>In <strong>Enable filters</strong>, select <em>@dn email address encoding filter</em>.</li>' . '<li>In <strong>Filter processing order </strong>, move @dn below <em>Convert line breaks into HTML</em> and above <em>Convert URLs into links</em>.</li>' . '<li>If you use the <strong>Limit allowed HTML tags</strong> filter, make sure that &lt;span&gt; is one of the allowed tags.</li>' . '<li>Select <strong>@dn email address encoding filter</strong> to configure @dn for the text format.</li>' . '<li>Select <strong>Save configuration</strong> to save your changes.</li>' . '</ol></p>' . '<h2>Defaults</h2>' . '<p>The following defaults are used for new filters and for spamspan() when there is no filter specified.</p>' . '<ul><li>' . implode('</li><li>', $default_list) . '</li></ul>' . '<h2>Test spamspan()</h2>' . '<p>Test the @dn <code>spamspan()</code> function using the following <strong>Test text</strong> field.' . ' Enter text containing an email address then hit the Test button. We set up a default example to get you started.</p>', array('@dn' => $this->parent->display_name())));
     $form[$this->test_field] = array('#type' => 'textfield', '#title' => t('Test text'), '#size' => 80, '#maxlength' => 200, '#default_value' => $test_text);
     $filter = (object) array('settings' => array());
     $settings_form = $this->parent->filter_settings(array(), array(), $filter, '', $defaults, array());
     foreach ($defaults as $field => $value) {
         if (isset($settings_form['use_form'][$field])) {
             $form[$field] = $settings_form['use_form'][$field];
         } else {
             $form[$field] = $settings_form[$field];
         }
         if (isset($form_state['storage'][$field])) {
             $form[$field]['#default_value'] = $form_state['storage'][$field];
             $defaults[$field] = $form_state['storage'][$field];
         }
     }
     $test_result = spamspan($test_text, $defaults);
     $form['test_js'] = array('#markup' => '<p>The result passed through spamspan()' . ' and processed by Javasript:</p><div style="background-color: #ccffcc;">' . $test_result . '</div>');
     $form['test_result'] = array('#markup' => '<p>The result passed through spamspan() but not processed by Javascript:</p>' . '<div style="background-color: #ccccff;">' . str_replace('class="spamspan"', '', $test_result) . '</div>');
     $form['test_as_html'] = array('#markup' => '<p>The HTML in the result:</p>' . '<div style="background-color: #ffcccc;">' . nl2br(htmlentities($test_result)) . '</div>');
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Test'));
     return $form;
 }
<?php

$email = $senator->field_email[0]['email'];
if (module_exists('spamspan')) {
    $formatted_email = spamspan($email);
} else {
    $formatted_email = '<a href="mailto:' . $email . '">' . check_plain($email) . '</a>';
}
$extra_contact_info = $senator->field_extra_contact_information[0]['value'];
?>
<div class="senator-contact-page">
  <p>
    <?php 
echo theme('locations', $senator->locations, array('latitude', 'longitude'));
?>
    <div class="senator-contact-extra-information"><?php 
print $extra_contact_info;
?>
</div>
    <br />
    <strong>Email address:</strong> <?php 
print $formatted_email;
?>
  </p>
  <div class="block" style="margin-top: 2em;">
    <h2 class="title block_title">Send an Email to Your Senator</h2>
    <?php 
print drupal_get_form('nyss_contact_mail_senator', $senator);
?>
  </div>
</div>
コード例 #3
0
</span> <?php 
    print $node->location['fax'];
    ?>
      </div>
      <?php 
}
?>
      <?php 
if ($node->field_email['0']['email']) {
    ?>
      <div class="email">
            <span class="type"><?php 
    print t('E-mail');
    ?>
:</span> <span><?php 
    print spamspan(l($node->field_email['0']['email'], 'mailto:' . $node->field_email['0']['email']));
    ?>
</span>
      </div>
      <?php 
}
?>

    </div>

    <?php 
print $library_links;
?>
  </div>

  <div class="library-map">