function query_to_csv($query, $headers = TRUE, $download = "") { if (!is_object($query) or !method_exists($query, 'list_fields')) { show_error('invalid query'); } $array = array(); if ($headers) { $line = array(); foreach ($query->list_fields() as $name) { $line[] = ucwords(str_replace('_', ' ', $name)); } $array[] = $line; } foreach ($query->result_array() as $row) { $line = array(); foreach ($row as $item) { if (dateChecker($item) == true) { $item = date("D jS F Y", strtotime($item)); } $line[] = strip_word_html($item); } $array[] = $line; } echo array_to_csv($array, $download); }
/** * Sets the current entry to the contents of $entry. * * Returns the inserted entry as it got stored in the database with * correct code/id and Word HTML stripped off. * * @param array $entry The entry to be inserted * @return array */ function set_entry($entry) { global $entriescache, $serialize_cache, $loadcount; if (is_word_html($entry['introduction'])) { echo "<p>You pasted text directly from Microsoft Word. Some of the markup might be lost</p>"; $entry['introduction'] = strip_word_html($entry['introduction']); } if (is_word_html($entry['body'])) { echo "<p>You pasted text directly from Microsoft Word. Some of the markup might be lost</p>"; $entry['body'] = strip_word_html($entry['body']); } $entry['introduction'] = strip_scripting($entry['introduction']); $this->entry = $this->db_lowlevel->set_entry($entry); // also, change it in the entry cache //unset($entriescache); //[$entry['code']] = $entry; //unset($serialize_cache); //echo "<pre>"; //print_r($this->db_lowlevel->entry_index); //echo "</pre>"; return $this->entry; }
function postie_strip_tags($post) { $text = $post['post_content']; $text = strip_word_html($text); $sa = new StripAttributes(); $sa->allow = array('href', 'target'); $text = $sa->strip($text); $pattern = '/<a /'; $replace = "<a target='_blank' "; // force target='_blank' for any <a> tags $text = preg_replace($pattern, $replace, $text); //file_put_contents('/home/national/logs/debug.log', print_r($text, true), FILE_APPEND); $post['post_content'] = $text; return $post; }
function word_limiter_strip_html($str, $limit = 100, $end_char = '…') { return strip_word_html(word_limiter($str, $limit)) . $end_char; }
<?php $q = mysql_query("Select * from post_article order by create_date ASC LIMIT 0,8"); while ($r = mysql_fetch_array($q)) { $photo = $base_url . "uploads/images/" . $r['featurephoto']; ?> <div class=""> <img src="<?php echo $photo; ?> " class="scale-with-grid" alt="" width="120" height="80"> <h4><a href="?news=<?php echo _encodeParam($r['post_id']); ?> ">Read more</a></h4> <p> <?php echo limit_200(strip_word_html($r['post_entry'])); ?> </p> </div> <?php }