本文整理汇总了PHP中getFile函数的典型用法代码示例。如果您正苦于以下问题:PHP getFile函数的具体用法?PHP getFile怎么用?PHP getFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install($rootFolder)
{
out('Installing');
chdir("{$rootFolder}/htdocs");
getFile("{$rootFolder}/htdocs/dashboard.php", "https://raw.github.com/gist/1512137/dashboard.php");
return true;
}
示例2: replaceIncludeCallback
function replaceIncludeCallback($matches)
{
$path = $matches[1];
$contents = getFile($path, true);
$result = $contents;
return $result;
}
示例3: getDirFiles
function getDirFiles($dir)
{
global $quiz;
$files = array();
$i = 0;
$d = dir($dir);
$short_dir = str_replace($quiz->getDir(), "", $dir);
while (false !== ($entry = $d->read())) {
if ($entry[0] != '.') {
$files[$i++] = $entry;
}
}
$tab_fic = array();
sort($files);
foreach ($files as $nb => $file) {
$fic = getFile($short_dir, $file);
$keys = array_keys($fic);
$key = $keys[0];
if (!array_key_exists($key, $tab_fic)) {
$tab_fic[$key] = array();
}
array_push($tab_fic[$key], $fic[$key]);
}
return $tab_fic;
}
示例4: getHTMLinjector
function getHTMLinjector()
{
$path = "widgets/" . $this->id . "/" . $this->html;
if ($this->html == null || $this->html == "") {
return "//Not HTML file includedc in the JSON config file.";
}
if (file_exists($path)) {
$html = str_replace("\n", "", getFile($path, true));
$html = str_replace("'", "\"", $html);
//replacing the tags
if ($this->tags != null) {
foreach ($this->tags as $key => $value) {
$html = str_replace("{" . $key . "}", $value, $html);
}
}
//$htmlT="var htmlTemplate = '".$htmlT."';\n";
//$htmlT .= "var target='".$this->templateTarget."';\n";
$htmlT = "(function (\$) { \n";
$htmlT .= "\t\$(function () { \n";
$htmlT .= "\t\t\$('." . $this->templateTarget . "').append('" . $html . "'); \n";
$htmlT .= "\t}); \n";
$htmlT .= "})(jQuery);\n";
return $htmlT;
}
throw new RuntimeException("HTML file(" . $path . ") couldnt be opened");
}
示例5: introAdk
function introAdk()
{
global $context, $txt;
$context['sub_template'] = 'introAdk';
$context['page_title'] = $txt['adkmod_modules_intro'];
global $sourcedir;
require_once $sourcedir . '/Subs-Package.php';
$context['file'] = getFile('http://www.smfpersonal.net/xml/read_modules.php');
}
示例6: result
function result()
{
$RESULT = getFile($RESULT);
echo '<TABLE width="100%">';
echo '<tr><td>' . count($RESULT) . '</td></tr>';
foreach ($RESULT as $item) {
echo "<tr><td>" . $item . "</td></tr>/n";
}
echo '</TABLE>';
}
示例7: delWords
function delWords($n = NULL)
{
if (!is_null($n) and is_numeric($n)) {
$text = getFile();
foreach ($text as $k => $v) {
if ($n < mb_strlen($text[$k])) {
unset($text[$k]);
}
}
file_put_contents("./words", implode(" ", $text));
}
}
示例8: getFile
function getFile($dir)
{
$dp = opendir($dir);
$fileArr = array();
while (!false == ($curFile = readdir($dp))) {
if ($curFile != "." && $curFile != ".." && $curFile != "") {
if (is_dir($curFile)) {
$fileArr = getFile($dir . "/" . $curFile);
} else {
$fileArr[] = $dir . "/" . $curFile;
}
}
}
return $fileArr;
}
示例9: getInvitationTemplate
function getInvitationTemplate($_requestid, $_internid, $_sessid, $_name, $_groupid)
{
global $CONFIG;
$template = !@file_exists(FILE_INVITATIONLOGO) ? getFile(TEMPLATE_SCRIPT_INVITATION) : getFile(TEMPLATE_SCRIPT_INVITATION_LOGO);
$template = str_replace("<!--request_id-->", $_requestid, $template);
$template = str_replace("<!--site_name-->", $CONFIG["gl_site_name"], $template);
$template = str_replace("<!--sess_id-->", $_sessid, $template);
$template = str_replace("<!--intern_name-->", $_name, $template);
$template = str_replace("<!--group_id-->", base64UrlEncode($_groupid), $template);
$template = str_replace("<!--intern_id-->", base64UrlEncode($_internid), $template);
$template = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $template);
$template = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $template);
$template = str_replace("<!--server-->", LIVEZILLA_URL, $template);
$template = str_replace("<!--intern_image-->", file_exists(PATH_INTERN_IMAGES . md5($_internid) . FILE_EXTENSION_PROFILE_PICTURE) ? md5($_internid) . FILE_EXTENSION_PROFILE_PICTURE . "?acid=" . uniqid(rand()) : "nopic" . FILE_EXTENSION_PROFILE_PICTURE, $template);
return doReplacements($template);
}
示例10: makeArrayFromFile
function makeArrayFromFile($path)
{
$data = getFile($path);
$opt_array = array();
foreach ($data as $key => $val) {
if (!in_array($key, array(0, 31))) {
$data = explode(" ", $val);
foreach ($data as $d => $v) {
$tmp = trim($v);
if (!empty($tmp) && strlen($tmp)) {
$opt_array[$key][] = $tmp;
}
}
}
}
return $opt_array;
}
示例11: __autoload
function __autoload($name)
{
try {
$file = getFile($name);
if ($file !== NULL) {
include $file;
} else {
throw new Exception('Die Klasse <font color="red">' . $name . '</font> wurde nicht gefunden.');
}
if (!class_exists($name)) {
throw new Exception('Die Datei <b>' . $file . '</b> enthält nicht die Klasse <font color="red">' . $name . '</font>');
}
return true;
} catch (Exception $error) {
die($error->getMessage());
}
}
示例12: Generate
function Generate()
{
foreach ($this->InternalGroups as $groupId => $group) {
$this->XMLGroups .= "<v id=\"" . base64_encode($groupId) . "\" desc=\"" . base64_encode($group["gr_desc_array"]) . "\" created=\"" . base64_encode($group["gr_created"]) . "\" email=\"" . base64_encode($group["gr_email"]) . "\" extern=\"" . base64_encode($group["gr_extern"]) . "\" standard=\"" . base64_encode($group["gr_standard"]) . "\" vf=\"" . base64_encode($group["gr_vfilters"]) . "\">\r\n";
foreach ($group["gr_predefined"] as $premes) {
$this->XMLGroups .= $premes->GetXML();
}
$this->XMLGroups .= "</v>\r\n";
}
foreach ($this->InternalUsers as $sysId => $internaluser) {
$b64sysId = base64_encode($sysId);
$sessiontime = getDataSetTime($this->Caller->SessionFile);
if (file_exists($this->InternalUsers[$sysId]->PictureFile)) {
if ($_POST[POST_INTERN_XMLCLIP_HASH_PICTURES_PROFILE] == XML_CLIP_NULL || @filemtime($this->InternalUsers[$sysId]->PictureFile) >= $sessiontime) {
$this->XMLProfilePictures .= "<v os=\"" . $b64sysId . "\" content=\"" . fileToBase64($this->InternalUsers[$sysId]->PictureFile) . "\" />\r\n";
}
} else {
$this->XMLProfilePictures .= "<v os=\"" . $b64sysId . "\" content=\"" . base64_encode("") . "\" />\r\n";
}
if ($sysId != CALLER_SYSTEM_ID && file_exists($this->InternalUsers[$sysId]->WebcamFile)) {
if ($_POST[POST_INTERN_XMLCLIP_HASH_PICTURES_PROFILE] == XML_CLIP_NULL || @filemtime($this->InternalUsers[$sysId]->WebcamFile) >= $sessiontime) {
$this->XMLWebcamPictures .= "<v os=\"" . $b64sysId . "\" content=\"" . fileToBase64($this->InternalUsers[$sysId]->WebcamFile) . "\" />\r\n";
}
} else {
$this->XMLWebcamPictures .= "<v os=\"" . $b64sysId . "\" content=\"" . base64_encode("") . "\" />\r\n";
}
$CPONL = $this->InternalUsers[CALLER_SYSTEM_ID]->Level == USER_LEVEL_ADMIN ? " cponl=\"" . base64_encode($internaluser->IsPasswordChangeNeeded() ? 1 : 0) . "\"" : "";
$PASSWORD = SERVERSETUP ? " pass=\"" . base64_encode($this->InternalUsers[$sysId]->LoadPassword()) . "\"" : "";
$this->XMLInternal .= "<v status=\"" . base64_encode($this->InternalUsers[$sysId]->Status) . "\" id=\"" . $b64sysId . "\" userid=\"" . base64_encode($this->InternalUsers[$sysId]->UserId) . "\" email=\"" . base64_encode($this->InternalUsers[$sysId]->Email) . "\" websp=\"" . base64_encode($this->InternalUsers[$sysId]->Webspace) . "\" name=\"" . base64_encode($this->InternalUsers[$sysId]->Fullname) . "\" desc=\"" . base64_encode($this->InternalUsers[$sysId]->Description) . "\" groups=\"" . base64_encode($this->InternalUsers[$sysId]->GroupsArray) . "\" perms=\"" . base64_encode($this->InternalUsers[$sysId]->PermissionSet) . "\" ip=\"" . base64_encode($this->InternalUsers[$sysId]->IP) . "\" level=\"" . base64_encode($this->InternalUsers[$sysId]->Level) . "\" " . $CPONL . " " . $PASSWORD . ">\r\n";
foreach ($internaluser->PredefinedMessages as $premes) {
$this->XMLInternal .= $premes->GetXML();
}
$this->XMLInternal .= "</v>\r\n";
if ($sysId != $this->Caller->SystemId && $this->InternalUsers[$sysId]->Status != USER_STATUS_OFFLINE) {
$this->XMLTyping .= "<v id=\"" . $b64sysId . "\" tp=\"" . base64_encode($this->Caller->SystemId === $this->InternalUsers[$sysId]->Typing ? 1 : 0) . "\" />\r\n";
}
if (file_exists($internaluser->VisitcardFile)) {
if (isset($_POST[POST_INTERN_XMLCLIP_HASH_VISITCARDS]) && $_POST[POST_INTERN_XMLCLIP_HASH_VISITCARDS] == XML_CLIP_NULL || @filemtime($internaluser->VisitcardFile) >= $sessiontime) {
$this->XMLVisitcards .= "<v os=\"" . $b64sysId . "\" content=\"" . base64_encode(getFile($internaluser->VisitcardFile)) . "\"/>\r\n";
} else {
$this->XMLVisitcards .= "<v os=\"" . $b64sysId . "\"/>\r\n";
}
}
}
}
示例13: getFile
function getFile($dir, $dir2 = "", $fileArray = array())
{
if (false != ($handle = opendir($dir . $dir2))) {
while (false !== ($file = readdir($handle))) {
//去掉"“.”、“..”以及带“.xxx”后缀的文件
if ($file != "." && $file != "..") {
// print_r($file."<br>");
if (is_dir($dir . $file)) {
$fileArray = array_merge($fileArray, getFile($dir, $dir2 . $file . '/'));
} else {
if (substr($file, -5) == ".html") {
$fileArray[] = $dir2 . $file;
}
}
}
}
//关闭句柄
closedir($handle);
}
return $fileArray;
}
示例14: getFile
function getFile($name = 'Mojo.class.php', $path = '.', $level = 0)
{
$target = "";
if (file_exists($path . $name)) {
return $path . $name;
}
//if you have your mojo lib in a diff set of libs set them here
$scan = array('lib', 'vendor', 'src', 'tasks', 'Mojo-Tasks', $name);
$dh = @opendir($path);
while (false !== ($file = @readdir($dh))) {
if (in_array($file, $scan)) {
if (is_dir("{$path}/{$file}")) {
return getFile($name, $path . DIRECTORY_SEPARATOR . $file, $level + 1);
} else {
if ($file == $name) {
$target = $path . DIRECTORY_SEPARATOR . $file;
return realpath($target);
}
}
}
}
@closedir($dh);
return $target;
}
示例15: htmlspecialchars
$class = htmlspecialchars($_GET['class']);
$file = htmlspecialchars($_GET['file']);
/* 获取目录数据 */
if ($class) {
$menus = getFile(__API__ . '/' . $class);
if ($menus) {
asort($menus);
}
$menus = $menus ?: $menus;
} else {
$directory = getDir(__API__);
$menus = array();
if ($directory) {
asort($directory);
foreach ($directory as $k => $v) {
$file = getFile(__API__ . '/' . $v);
$menus[$k]['num'] = count($file);
$menus[$k]['name'] = $v;
}
} else {
$menus = $directory;
}
}
/* 读取解析文档内容 */
if ($file) {
$file_name = __API__ . '/' . $class . '/' . $file;
$content = readFileText($file_name);
$content = $content ? Parsedown::instance()->parse($content) : $content;
} else {
$content = '';
}