本文整理汇总了PHP中Safe::file方法的典型用法代码示例。如果您正苦于以下问题:PHP Safe::file方法的具体用法?PHP Safe::file怎么用?PHP Safe::file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Safe
的用法示例。
在下文中一共展示了Safe::file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
// buttons to display previous and next pages, if any
if ($neighbours) {
$canvas['trailer'] .= Skin::neighbours($neighbours, 'manual');
}
// insert anchor suffix
if (is_object($anchor)) {
$canvas['trailer'] .= $anchor->get_suffix();
}
// reflect content canvas from anchor
if (!isset($item['canvas']) && is_object($anchor)) {
$item['canvas'] = $anchor->get_articles_canvas();
}
// reflect content canvas from anchor
if (empty($item['canvas'])) {
$item['canvas'] = 'standard';
} elseif (!Safe::file('../canvas/' . $item['canvas'] . '.php')) {
$item['canvas'] = 'standard';
}
// get canvas result
$text = '';
require_once '../canvas/' . $item['canvas'] . '.php';
// special layout for digg
if (defined('DIGG')) {
$text = '<div class="digg_content">' . $text . '</div>';
}
// update the main content panel
$context['text'] .= $text;
//
// extra panel
//
// page tools
示例2: merge
/**
* merge two files
*
* @param string a file name of the original content
* @param string a file for the updated content
* @return an ASCII string
*/
public static function merge($original, $updated)
{
global $context;
// read the original file
if (!is_array($original_lines = Safe::file($context['path_to_root'] . $original))) {
echo sprintf(i18n::s('Impossible to read %s.'), $original) . BR . "\n";
return NULL;
}
// read the updated file
if (!is_array($updated_lines = Safe::file($context['path_to_root'] . $updated))) {
echo sprintf(i18n::s('Impossible to read %s.'), $updated) . BR . "\n";
return NULL;
}
// compare the two sequences
$sequence = Scripts::compare($original_lines, $updated_lines);
// echo $original.' vs. '.$updated.BR."\n";
// format the output string
$text = '';
foreach ($sequence as $item) {
list($tag, $left, $right) = $item;
//comment out suppressed lines
if ($tag == '-') {
$text .= '//-' . $left . "\n";
} else {
$text .= $right . "\n";
}
}
// return the result of the whole comparison
return $text;
}