Exemplo n.º 1
0
 /**
  * Prepares simple body text with word wrap, censoring, and nl2br.
  * HTML/BB code is not parsed within string.
  *
  * @param string $string
  *
  * @return string
  */
 public static function helperBodyText($string)
 {
     $string = XenForo_Helper_String::censorString($string);
     $string = XenForo_Helper_String::autoLinkPlainText(htmlspecialchars($string));
     return nl2br($string);
 }
Exemplo n.º 2
0
 public function prepareField(array $field, $editMode = true, $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     if (!empty($field)) {
         $field['title'] = XenForo_Helper_String::censorString($field['title']);
         $field['description'] = XenForo_Helper_String::censorString($field['description']);
         $field['isMultiChoice'] = $field['field_type'] === 'checkbox' || $field['field_type'] === 'multiselect';
         if (!empty($field['field_choices']) && !is_array($field['field_choices'])) {
             $field['fieldChoices'] = @unserialize($field['field_choices']);
         }
         if (isset($field['field_value'])) {
             if ($field['isMultiChoice']) {
                 if (is_string($field['field_value'])) {
                     $field['field_value'] = @unserialize($field['field_value']);
                 } else {
                     if (!is_array($field['field_value'])) {
                         $field['field_value'] = array();
                     }
                 }
             }
             if ($field['match_type'] === 'url' && $editMode === false) {
                 $field['field_value'] = XenForo_Helper_String::autoLinkPlainText($field['field_value']);
             }
             $field['hasValue'] = is_string($field['field_value']) && $field['field_value'] !== '' || !is_string($field['field_value']) && $field['field_value'];
         } else {
             $field['hasValue'] = false;
         }
         if (!is_array($field['category'])) {
             $field['category'] = @unserialize($field['category']);
         }
         if (!is_array($field['content'])) {
             $field['content'] = @unserialize($field['content']);
         }
     }
     return $field;
 }
Exemplo n.º 3
0
 public function prepareCamera(array $camera)
 {
     if ($camera) {
         if (!empty($camera['camera_data'])) {
             $camera['camera_data'] = @unserialize($camera['camera_data']);
             foreach ($camera['camera_data'] as $key => &$data) {
                 $data = array('name' => new XenForo_Phrase('sonnb_xengallery_camera_data__' . $key), 'value' => Zend_Uri::check($data) ? XenForo_Helper_String::autoLinkPlainText($data) : $data);
             }
             if (!isset($camera['photo_count'])) {
                 $camera['photo_count'] = $this->countCameras(array('camera_name' => $camera['camera_name']));
             }
             $camera['camera_data']['total_photos'] = array('name' => new XenForo_Phrase('sonnb_xengallery_camera_data__total_photos'), 'value' => $camera['photo_count']);
         }
     }
     return $camera;
 }