function package($pattern, $destination, $recurse = false, $exclude = false) { global $root, $stage_path; $search = $root . '/' . $pattern; echo "Packaging " . $search . "\n"; foreach (glob($search, GLOB_BRACE | GLOB_NOSORT) as $file) { if (is_file($file)) { if ($exclude && exclude($exclude, $file)) { continue; } if (!is_dir("{$stage_path}/{$destination}")) { mkdir("{$stage_path}/{$destination}", 0777, true); } copy($file, $stage_path . '/' . $destination . '/' . basename($file)); } } if ($recurse) { foreach (glob(dirname($search) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { if ($exclude && exclude($exclude, $dir)) { continue; } package(dirname($pattern) . '/' . basename($dir) . '/' . basename($pattern), $destination . '/' . basename($dir), $recurse - 1, $exclude); } } }
function find_apt_link($para, $new_link_pos) { do { $old_link_pos = $new_link_pos; // location of the target link $new_link_pos = strpos($para, "href=\"/wiki/", $old_link_pos) + 12; if ($new_link_pos === false || $new_link_pos == 12) { return false; } } while (filter($para, "(", ")", $old_link_pos, $new_link_pos) || filter($para, "<i>", "</i>", $old_link_pos, $new_link_pos) || filter($para, "<table>", "</table>", $old_link_pos, $new_link_pos) || exclude($para, $new_link_pos)); return substr($para, $new_link_pos, strpos($para, "\"", $new_link_pos) - $new_link_pos); }
} } } $request->setBody($body); } $resp = $request->send(); $headers = $resp->getHeader(); if ($Config['Log-Mode']) { $log[] = '--------------------------'; $log[] = '<<||<< ' . date('Y-m-d H:i:s'); $log[] = '--------------------------'; foreach ($headers as $name => $value) { $log[] = $name . ': ' . $value; } } $headers = exclude($headers, $Config['Head-Out-Exclude']); foreach ($headers as $name => $value) { header("{$name}: {$value}"); } $res = $resp->getBody(); if ($Config['Log-Mode'] >= 2 && $Config['Log-Path']) { for ($i = 1; $i <= 200; ++$i) { $fname = date('Ymd-His') . '-O-' . $i . '.html'; if (!file_exists($fname)) { $fp = fopen($Config['Log-Path'] . '/' . $fname, 'w'); fwrite($fp, $res); fclose($fp); break; } } }
/** * Makes full html depending on 'arefiles', if 'javascript', 'css' are files they are included * if it is a content then they are included inline * * @param array $options - to scale for the future needs this is made an array - individual items are explained below * @param sting $options['html'] this is the content that is inside <body></body> tag * @param sting $options['css'] this can be css content or a file path to a css file * @param sting $options['javascript'] this can be javascript content or a file path to a javascript file * @param sting $options['arefiles'] - tells if $javascript and $css are file contents or path to files * @return all integrated html content */ function Zip($source, $destination, $exclude = array("html_part.html")) { if (!extension_loaded('zip') || !file_exists($source)) { return false; } $zip = new ZipArchive(); if (!$zip->open($destination, ZIPARCHIVE::CREATE)) { return false; } $source = str_replace('\\', '/', realpath($source)); if (is_dir($source) === true) { $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST); foreach ($files as $file) { $file = str_replace('\\', '/', realpath($file)); if (is_dir($file) === true) { $zip->addEmptyDir(str_replace($source . '/', '', $file . '/')); } else if (is_file($file) === true && exclude($exclude, $file) === false) { $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file)); } } } else if (is_file($source) === true) { $zip->addFromString(basename($source), file_get_contents($source)); } return $zip->close(); }
/** * platform_launch_listicon_lists: Display HTML output for listings * @param string $path The path to list * @param string $exclusion A collection of paths to exclude from listings * * @return void */ function platform_launch_listicon_lists($path, $exclusion = null) { $request = $_SERVER['QUERY_STRING']; $pages = platform_launch_list_path($path, true); $pages = exclude($pages, $exclusion); ?> <ul> <?php if (!is_null($pages) && is_array($pages)) { foreach ($pages as $page) { ?> <li><a class="listicon_link" href="http://<?php e($_SERVER['SERVER_NAME']); ?> /<?php e($request); ?> /<?php e(strtolower($page)); ?> "><span class="listicon_<?php e($request); ?> _icon"> </span><?php e(strtolower($page)); ?> </a></li> <?php } } ?> </ul> <?php }