Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
f4fa179d
Commit
f4fa179d
authored
Sep 01, 2007
by
jepso
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We don't need these files anymore
parent
ebc7d8d3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
312 deletions
+0
-312
Cache.php
manual/new/lib/Cache.php
+0
-81
DocTool.php
manual/new/lib/DocTool.php
+0
-231
No files found.
manual/new/lib/Cache.php
deleted
100644 → 0
View file @
ebc7d8d3
<?php
class
Cache
{
protected
$_dir
;
protected
$_ext
;
protected
$_page
;
protected
$_file
;
public
function
__construct
(
$dir
,
$ext
)
{
$this
->
_dir
=
$dir
;
$this
->
_ext
=
$ext
;
$this
->
_page
=
'http://'
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
$this
->
_file
=
$this
->
_dir
.
md5
(
$this
->
_page
)
.
'.'
.
$this
->
_ext
;
}
/**
* Begins caching the output.
*
* @return A boolean value indicating whether a valid cached version of the
* page was found and echoed (false), or not (true).
*/
public
function
begin
()
{
$showCache
=
(
file_exists
(
$this
->
_file
)
&&
$this
->
isValid
());
clearstatcache
();
if
(
$showCache
)
{
readfile
(
$this
->
_file
);
return
false
;
}
else
{
ob_start
();
return
true
;
}
}
/**
* Ends caching the output and saves it to a cache file.
*
*/
public
function
end
()
{
// Generate a new cache file
$fp
=
@
fopen
(
$this
->
_file
,
'w'
);
// Save the contents of output buffer to the file
@
fwrite
(
$fp
,
ob_get_contents
());
@
fclose
(
$fp
);
ob_end_flush
();
}
/**
* Deletes all files in the cache directory.
*/
public
function
clear
()
{
if
(
$handle
=
@
opendir
(
$this
->
_dir
))
{
while
(
$file
=
readdir
(
$handle
))
{
if
(
$file
!==
'.'
&&
$file
!==
'..'
)
{
@
unlink
(
$this
->
_dir
.
'/'
.
$file
);
}
}
closedir
(
$handle
);
}
}
/**
* This method is used to check whether the cache file is valid to use.
*
* Currently it assumes that the cache file is always valid.
*
* @return True, if cache file is valid; false otherwise.
*/
protected
function
isValid
()
{
return
true
;
}
}
\ No newline at end of file
manual/new/lib/DocTool.php
deleted
100644 → 0
View file @
ebc7d8d3
<?php
require_once
(
"highlight.php"
);
require_once
(
'Text/Wiki.php'
);
class
DocTool
{
private
$_wiki
;
private
$_toc
;
private
$_options
=
array
(
'max-level'
=>
1
,
'one-page'
=>
false
,
'section'
=>
null
,
'clean-url'
=>
false
,
'base-url'
=>
''
);
private
$_lang
=
array
();
public
function
__construct
(
$filename
)
{
$this
->
_toc
=
new
Sensei_Doc_Toc
(
$filename
);
$this
->
_wiki
=
Text_Wiki
::
singleton
(
'Doc'
);
$this
->
_wiki
->
setParseConf
(
'Doclink'
,
'toc'
,
$this
->
_toc
);
$this
->
_wiki
->
setRenderConf
(
'xhtml'
,
'Doclink'
,
'url_callback'
,
array
(
&
$this
,
'makeUrl'
));
}
public
function
getOption
(
$option
)
{
return
$this
->
_options
[
$option
];
}
public
function
setOption
(
$option
,
$value
)
{
switch
(
$option
)
{
case
'max-level'
:
$value
=
(
int
)
$value
;
break
;
case
'one-page'
:
case
'clean-url'
:
$value
=
(
bool
)
$value
;
break
;
case
'base-url'
:
$value
=
(
string
)
$value
;
break
;
case
'section'
:
if
(
!
$value
instanceof
Sensei_Doc_Section
)
{
throw
new
Exception
(
'Value must be an instance of Sensei_Doc_Section.'
);
}
break
;
default
:
throw
new
Exception
(
'Unknown option.'
);
}
$this
->
_wiki
->
setRenderConf
(
'xhtml'
,
'Doclink'
,
'view_url'
,
$this
->
getUrlPrefix
());
$this
->
_options
[
$option
]
=
$value
;
}
public
function
renderToc
(
$toc
=
null
)
{
if
(
!
$toc
)
{
$toc
=
$this
->
_toc
;
}
$classes
=
array
();
if
(
$toc
instanceof
Sensei_Doc_Toc
)
{
$class
=
''
;
if
(
$this
->
getOption
(
'one-page'
))
{
$class
=
' class="one-page"'
;
}
$classes
[]
=
'tree'
;
}
else
{
$isParent
=
false
;
$section
=
$this
->
getOption
(
'section'
);
if
(
$section
!==
null
)
{
$current
=
$section
;
do
{
if
(
$current
===
$toc
)
{
$isParent
=
true
;
break
;
}
}
while
((
$current
=
$current
->
getParent
())
!==
null
);
}
if
(
!
$isParent
)
{
$classes
[]
=
'closed'
;
}
}
$classes
=
implode
(
' '
,
$classes
);
if
(
$classes
===
''
)
{
echo
"<ul>
\n
"
;
}
else
{
echo
"<ul class=
\"
$classes
\"
>
\n
"
;
}
for
(
$i
=
0
;
$i
<
$toc
->
count
();
$i
++
)
{
$child
=
$toc
->
getChild
(
$i
);
if
(
$child
===
$this
->
getOption
(
'section'
))
{
echo
'<li class="current">'
;
}
else
{
echo
'<li>'
;
}
echo
'<a href="'
.
$this
->
makeUrl
(
$child
->
getPath
())
.
'">'
;
echo
$child
->
getIndex
()
.
' '
.
$child
->
getName
()
.
'</a>'
;
if
(
$child
->
count
()
>
0
)
{
echo
"
\n
"
;
$this
->
renderToc
(
$child
);
}
echo
'</li>'
.
"
\n
"
;
}
echo
'</ul>'
.
"
\n
"
;
}
public
function
getUrlPrefix
()
{
$prefix
=
$this
->
getOption
(
'base-url'
);
if
(
!
$this
->
getOption
(
'one-page'
))
{
if
(
$this
->
getOption
(
'clean-url'
))
{
$prefix
.=
'chapter/'
;
}
else
{
$prefix
.=
'?chapter='
;
}
}
return
$prefix
;
}
public
function
makeUrl
(
$path
)
{
$parts
=
explode
(
':'
,
$path
);
$firstPath
=
array_slice
(
$parts
,
0
,
$this
->
getOption
(
'max-level'
));
$href
=
$this
->
getUrlPrefix
()
.
implode
(
':'
,
$firstPath
);
$anchorName
=
$this
->
makeAnchor
(
$path
);
if
(
!
empty
(
$anchorName
))
{
$href
.=
'#'
.
$anchorName
;
}
return
$href
;
}
public
function
makeAnchor
(
$path
)
{
$pathParts
=
explode
(
':'
,
$path
);
$anchorParts
=
array_slice
(
$pathParts
,
$this
->
getOption
(
'max-level'
));
$anchorName
=
implode
(
':'
,
$anchorParts
);
return
$anchorName
;
}
public
function
render
()
{
if
(
$this
->
getOption
(
'one-page'
))
{
for
(
$i
=
0
;
$i
<
count
(
$this
->
_toc
);
$i
++
)
{
$this
->
renderSection
(
$this
->
_toc
->
getChild
(
$i
));
}
}
else
{
$section
=
$this
->
getOption
(
'section'
);
if
(
!
$section
)
{
throw
new
Exception
(
'Section has not been set.'
);
}
else
{
$this
->
renderSection
(
$section
);
}
}
}
protected
function
renderSection
(
$section
)
{
$level
=
$section
->
getLevel
();
$name
=
$section
->
getName
();
$index
=
$section
->
getIndex
();
if
(
$section
->
getLevel
()
==
1
)
{
echo
'<div class="chapter">'
.
"
\n
"
;
echo
"<h
$level
>Chapter
$index
"
;
}
else
{
echo
'<div class="section">'
.
"
\n
"
;
echo
"<h
$level
>
$index
"
;
}
if
(
$section
->
getLevel
()
>
$this
->
getOption
(
'max-level'
))
{
echo
'<a href="#'
.
$this
->
makeAnchor
(
$section
->
getPath
());
echo
'" id="'
.
$this
->
makeAnchor
(
$section
->
getPath
())
.
'">'
;
echo
$name
;
echo
'</a>'
;
}
else
{
echo
$name
;
}
echo
"</h
$level
>
\n
"
;
echo
$this
->
_wiki
->
transform
(
$section
->
getText
());
for
(
$i
=
0
;
$i
<
count
(
$section
);
$i
++
)
{
$this
->
renderSection
(
$section
->
getChild
(
$i
));
}
echo
'</div>'
.
"
\n
"
;
}
public
function
findByPath
(
$path
)
{
return
$this
->
_toc
->
findByPath
(
$path
);
}
public
function
findByIndex
(
$index
)
{
return
$this
->
_toc
->
findByIndex
(
$index
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment