本文整理汇总了PHP中Project::project方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::project方法的具体用法?PHP Project::project怎么用?PHP Project::project使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::project方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saved
function saved(&$event, $param)
{
global $ID;
global $PROJECTS_REMAKE;
if (auth_quickaclcheck($ID) <= AUTH_READ) {
return;
}
$project = Project::project();
if ($project == NULL) {
return;
}
$file = $event->data['current']['ProjectFile'];
$name = noNS($ID);
if ($file == NULL) {
// check whether the file is deleted
if ($project->file($name) == NULL) {
return;
}
// it was int he project
if (!$project->remove_file($name)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
return;
}
if (!$project->update_file($file)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
}
示例2: deleted
/**
* a namespace has been deleted
*
*/
function deleted(&$event, $param)
{
$wiki_path = $event->data[0];
$project = Project::project($wiki_path);
if ($project != NULL) {
$project->delete();
}
}
示例3: unlock_with_error
function unlock_with_error()
{
$project = Project::project();
if ($project) {
$project->unlock();
}
/*
if(!is_null($e = error_get_last())) {
header('content-type: text/plain');
print "Error occurred:\n\n". print_r($e,true);
}
*/
}
示例4: wrote
/**
* intercept page deletion
*
*/
function wrote(&$event, $param)
{
$content = $event->data[0][1];
if ($content) {
return;
}
$namespace = $event->data[1];
$project = Project::project($namespace);
if ($project == NULL) {
return;
}
$name = $event->data[2];
if ($project->file($name) == NULL) {
return;
}
if (!$project->remove_file($name)) {
msg('Other users are currently updating the project. Please save this page later.');
}
}
示例5: render_xhtml
private function render_xhtml(&$renderer, $data)
{
if (!$data || !isset($data['use'])) {
return;
}
$use = $data['use'];
global $ID;
$name = array_pop(explode(":", $ID));
$project = Project::project();
//use
$renderer->doc .= '<div class="use">';
//header
$renderer->doc .= '<div class="tag_header">Use</div>';
//use_use
$renderer->doc .= '<div class="use_use">';
$range = $data['pos'] . '-' . $data['end'];
if (!$use) {
$choices = array_diff(array_keys($project->files()), array($name));
array_unshift($choices, "");
$renderer->doc .= $this->button_rename_use($range, $choices);
} else {
$use_id = $project->id($use);
if ($use_id) {
$renderer->internallink($project->id($use));
} else {
$renderer->doc .= "{$use}";
}
}
// end use_use
$renderer->doc .= "</div>";
$renderer->doc .= "<div class=\"spacer\"></div>";
// buttons
$renderer->doc .= "<div class=\"use_buttons\">";
$renderer->doc .= button_remove($range, "Use");
// end buttons
$renderer->doc .= "</div>";
if ($project != NULL) {
$errors = $project->error($use);
if ($errors) {
foreach ($errors as $error) {
if ($error == 'undefined') {
$render->doc .= "<div class=\"error\">Do not know how to generate this file.</div>";
}
}
}
$errors = $project->error($name);
if ($errors) {
foreach ($errors as $error) {
if (is_array($error) && isset($error['dependency']) && $error['dependency'] == $use) {
$renderer->doc .= "<div class=\"error\">This file cannot be generated.</div>";
}
}
}
}
$renderer->doc .= "<div class=\"use_content\"></div>";
// closing use
$renderer->doc .= "</div>";
}
示例6: render_xhtml
private function render_xhtml(&$renderer, $file)
{
global $version_file;
global $changelog;
global $ID;
if (auth_quickaclcheck($ID) == AUTH_ADMIN && $this->getConf('check updates')) {
include dirname(__FILE__) . '/../version.php';
$new_version = file_get_contents($version_file);
if (strcmp($new_version, $version) > 0) {
msg('A new version ' . $new_version . ' of the projects plugin is available. See the <a href="' . $changelog . '">change log</a>');
}
if (!$file) {
return;
}
}
$project = Project::project(NULL, true);
$renderer->nocache();
switch ($file->type()) {
case SOURCE:
$layout = new ProjectFileLayout($project, $ID, $file);
break;
case TARGET:
$layout = new TargetLayout($project, $ID, $file);
break;
case CROSSLINK:
$layout = new CrosslinkLayout($project, $ID, $file);
break;
}
$layout->render($renderer);
}
示例7: filter
/**
* an action has been called
*
*/
function filter(&$event, $param)
{
global $ACT;
global $ID;
global $TEXT;
global $PRE;
$perm = auth_quickaclcheck($ID);
if ($event->data == 'manage_files') {
$event->preventDefault();
return;
}
$project = Project::project();
if ($project == NULL) {
return;
}
switch ($event->data) {
case 'change_use':
if ($perm <= AUTH_READ) {
msg('You do not have permission to change this file', -1);
$event->data = 'show';
} else {
$range = $_REQUEST['range'];
$name = $_REQUEST['use'];
$slices = rawWikiSlices($range, $ID);
$TEXT = $slices[0] . '<use name="' . $name . '"/>' . $slices[2];
}
$event->data = 'save';
break;
case 'create':
if ($perm < AUTH_CREATE) {
msg('You do not have permission to create a file', -1);
if ($perm < AUTH_READ) {
$event->data = 'show';
break;
}
$event->data = 'manage_files';
$event->preventDefault();
break;
}
$text = $this->wikitext($_REQUEST['Type']);
$name = $_REQUEST['File_name'];
$ID = $project->name() . ':' . $name;
if ($text == NULL) {
return;
}
$TEXT = $text;
$event->data = 'save';
break;
case 'remake':
if ($perm <= AUTH_READ) {
msg('You do not have permission to change this file', -1);
if ($perm < AUTH_READ) {
$event->data = 'show';
break;
}
$event->data = 'manage_files';
$event->preventDefault();
} else {
set_media_file_revision_limit($this->getConf('media file revision limit'));
global $ID;
$id = $_REQUEST['id'];
if (getNS($name)) {
$ID = $id;
}
$id = noNS($id);
$project->remake(array($id));
$ID = $project->id($id);
$event->data = 'show';
}
$event->preventDefault();
break;
case "create_subproject":
if ($perm < AUTH_CREATE) {
msg('You do not have permission to create a subproject');
if ($perm < AUTH_READ) {
$event->data = 'show';
break;
}
} else {
$name = $_REQUEST['Project_name'];
$project = Project::project($project->name() . ':' . $name, true);
$ID = $project->name() . ':' . $name . ':manage_files';
}
$event->data = 'manage_files';
$event->preventDefault();
break;
case 'clean':
if ($perm <= AUTH_READ) {
msg('You do not have permission to clean this project', -1);
if ($perm < AUTH_READ) {
$event->data = 'show';
break;
}
} else {
$recursive = $_REQUEST['Recursive'];
if (!$project->clean($recursive)) {
//.........这里部分代码省略.........
示例8: crosslink_path
protected function crosslink_path()
{
if (!$this->crosslink) {
return NULL;
}
$path = explode(":", $this->crosslink);
$media = $path[0] == '[media]';
if ($media) {
array_shift($path);
}
if (count($path) > 1 && $path[0] != PROJECTS_NAMESPACE) {
return NULL;
}
$id = implode(':', $path);
$project = Project::project();
if (!getNS($id)) {
$id = $project->id($id);
}
if ($media) {
return mediaFN($id);
}
return $project->path($id);
}