function z_path() { global $a; $base = $a->get_baseurl(); if (!clean_urls()) { $base .= '/?q='; } return $base; }
function clean_urls_in_file($site_url, $filepath) { $contents = file_get_contents($filepath); $clean_contents = clean_urls($site_url, $contents); file_put_contents($filepath, $clean_contents); }
public function processItem() { $id = clean_urls(to7bits($_POST['post-title'], "UTF-8")); $file = ITEMDATA . $id . '.xml'; $title = $_POST['post-title']; $category = $_POST['category']; $content = safe_slash_htmll($_POST['post-content']); if (!file_exists($file)) { $date = date('j M Y'); } else { $data = @getXML($file); $date = $data->date; } $xml = @new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>'); $xml->addChild('title', empty($title) ? '(no title)' : $title); $xml->addChild('slug', $id); $xml->addChild('visible', true); $xml->addChild('date', $date); $xml->addChild('category', $category); $note = $xml->addChild('content'); $note->addCData($content); $newse = im_customfield_def(); foreach ($newse as $thes) { $keys = $thes['key']; if (isset($_POST['post-' . $keys])) { if ($keys != "content" && $keys != "excerpt") { $tmp = $xml->addChild($keys); $tmp->addCData($_POST['post-' . $keys]); } } } XMLsave($xml, $file); if (!is_writable($file)) { echo '<div class="error">Unable to write ' . IMTITLE . ' data to file</div>'; } else { echo '<div class="updated">The ' . IMTITLE . ' has been succesfully saved</div>'; } $this->showItemsAdmin(); }
function z_path() { $base = z_root(); if (!clean_urls()) { $base .= '/?q='; } return $base; }
$slack->load_channels(); if (empty($slack->channels[$channel])) { die("Channel not found.\r\n"); } $json = $slack->get_channel_history($slack->channels[$channel]['id']); $json->messages = array_reverse($json->messages); foreach ($json->messages as $m) { $message = $m->text; // mute the hubot somewhat if ($slack->users[$m->user]['name'] == 'hubot') { $items = explode(" ", $message); $items = array_slice($items, 0, 10); $message = implode(" ", $items); } $message = clean_message($message, $slack); $message = clean_urls($message); $sound->add_sentence($slack->users[$m->user]['name'] . ' says ' . $message); } $sound->generate($outputfile); function clean_message($text, $slack) { // user mentions $message = preg_replace_callback('~<@(.*?)>~', function ($matches) use($slack) { return $sound->users[$matches[1]]['name']; }, $text); // emotes $message = preg_replace_callback('~:(.*?):~', function ($matches) { return ' emote ' . $matches[1]; }, $message); return $message; }