本文整理汇总了PHP中files::replace方法的典型用法代码示例。如果您正苦于以下问题:PHP files::replace方法的具体用法?PHP files::replace怎么用?PHP files::replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类files
的用法示例。
在下文中一共展示了files::replace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
// Make views
$files = new files($this->files->getClass());
$files->setFeature("photo");
$files->makeFile("crud/view.images", $this->directory . "/views/images.blade.php");
// Change mainFoto input on read
$analyzeFile = new analyzeFile($this->directory . "/views/create.blade.php");
$analyzeFile->waitForFunctions();
$search = 'name = \'{{$mainFoto}}\'';
$search = $files->replace($search);
$line = $analyzeFile->getLineWhere($search);
$analyzeFile->changeLine($line, "");
// Remove line
$analyzeFile->changeLine($line + 1, "");
$analyzeFile->changeLine($line - 1, "");
$analyzeFile->changeLine($line - 2, "");
$res = $analyzeFile->finishWait();
$analyzeFile = new analyzeFile($this->directory . "/controllers/" . ucfirst($this->files->getClass()->id) . "Controller.php");
$analyzeFile->waitForFunctions();
$search = 'Input::get(\'{{$mainFoto}}\')';
$search = $files->replace($search);
$analyzeFile->replaceLineWhere($search, "");
$res = $analyzeFile->finishWait();
$analyzeFile = new analyzeFile($this->directory . "/views/edit.blade.php");
$analyzeFile->waitForFunctions();
$search = '{{$data->{{$mainFoto}}}}';
$search = $files->replace($search);
$line = $analyzeFile->getLineWhere($search);
$analyzeFile->changeLine($line, "");
// Remove line
$analyzeFile->changeLine($line + 1, "");
$analyzeFile->changeLine($line - 1, "");
$analyzeFile->changeLine($line - 2, "");
$res = $analyzeFile->finishWait();
// add in Menu
$analyzeFile = new analyzeFile("result/theme/views/layouts/master.blade.php");
$analyzeFile->waitForFunctions();
$search = '@if(Request::is(\'{{$id}}/*\') && isset($id))';
$search = $files->replace($search);
$add = ' <a href="{{url(\'{{$id}}/images\'.\'/\'.$id)}}">Images</a>';
$add = $files->replace($add);
$analyzeFile->addAfterLine($search, $add);
$res = $analyzeFile->finishWait();
}
示例2: execute
function execute()
{
// Make files
$files = new files($this->files->getClass());
$files->setFeature("user");
$files->makeFile("crud/filters.user", $this->directory . "/filters.php");
$files->makeFile("crud/view.login", $this->directory . "/views/login.blade.php");
// replace texts
$analyzeFile = new analyzeFile($this->directory . "/models/" . ucfirst($this->files->getClass()->id) . ".php");
$analyzeFile->waitForFunctions();
// Change models text
$replace = 'class {{$name}} extends Eloquent {';
$replace = $files->replace($replace);
$for = "use Illuminate\\Auth\\UserInterface;\nuse Illuminate\\Auth\\Reminders\\RemindableInterface;\n\nclass User extends Eloquent implements UserInterface, RemindableInterface {";
$analyzeFile->replace($replace, $for);
$res = $analyzeFile->finishWait();
// Change controllers text
$analyzeFile = new analyzeFile($this->directory . "/controllers/" . ucfirst($this->files->getClass()->id) . "Controller.php");
$analyzeFile->waitForFunctions();
$replace = '{{$name}}::';
$replace = $files->replace($replace);
$for = 'User::';
$for = $files->replace($for);
$analyzeFile->replace($replace, $for);
$replace = 'new {{$name}}';
$replace = $files->replace($replace);
$for = 'new User';
$for = $files->replace($for);
$analyzeFile->replace($replace, $for);
$res = $analyzeFile->finishWait();
// Change password input on read
$analyzeFile = new analyzeFile($this->directory . "/views/read.blade.php");
$analyzeFile->waitForFunctions();
$search = '{{$data->{{$password}}}}';
$search = $files->replace($search);
$line = $analyzeFile->getLineWhere($search);
$analyzeFile->changeLine($line, "");
// Remove line
$analyzeFile->changeLine($line + 1, "");
$analyzeFile->changeLine($line - 1, "");
$analyzeFile->changeLine($line - 2, "");
$res = $analyzeFile->finishWait();
// Change password input on update
$analyzeFile = new analyzeFile($this->directory . "/views/edit.blade.php");
$analyzeFile->waitForFunctions();
$search = 'value = \'{{$data->{{$password}}}}\'';
$search = $files->replace($search);
$analyzeFile->replace($search, "");
$res = $analyzeFile->finishWait();
// add in Menu
$analyzeFile = new analyzeFile("result/theme/views/layouts/master.blade.php");
$analyzeFile->waitForFunctions();
$search = '<a href="#">{{$title}}</a>';
$search = $files->replace($search);
$line = $analyzeFile->getLineWhere($search);
$add = ' <div class="w3-dropdown-content w3-card-4">
@if(Auth::check())
<a href="{{url(\'{{$id}}/logout\')}}">Logout</a>
@else
<a href="{{url(\'{{$id}}/login\')}}">Login</a>
@endif
';
$add = $files->replace($add);
$analyzeFile->changeLine($line + 1, $add);
$res = $analyzeFile->finishWait();
}