FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
-remove-phpquery/phpQuery/phpQuery/plugins/Scripts.php at master · cmprecycle/-remove-phpquery · GitHub
cmprecycle
-remove-phpquery
Repository navigation
Code
Issues
160
(160)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
-remove-phpquery
/
phpQuery
/
phpQuery
/
plugins
/
Scripts.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
72 lines (72 loc) · 1.9 KB
Breadcrumbs
-remove-phpquery
/
phpQuery
/
phpQuery
/
plugins
/
Scripts.php
Copy path
File metadata and controls
72 lines (72 loc) · 1.9 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* phpQuery plugin class extending phpQuery object.
* Methods from this class are callable on every phpQuery object.
*
* Class name prefix 'phpQueryObjectPlugin_' must be preserved.
*/
abstract
class
phpQueryObjectPlugin_Scripts {
/**
* Limit binded methods.
*
* null means all public.
* array means only specified ones.
*
* @var array|null
*/
public
static
$
phpQueryMethods
=
null
;
public
static
$
config
=
array
();
/**
* Enter description here...
*
* @param phpQueryObject $self
*/
public
static
function
script
(
$
self
,
$
arg1
) {
$
params
=
func_get_args
();
$
params
=
array_slice
(
$
params
,
2
);
$
return
=
null
;
$
config
=
self
::
$
config
;
if
(phpQueryPlugin_Scripts::
$
scriptMethods
[
$
arg1
]) {
phpQuery::
callbackRun
(
phpQueryPlugin_Scripts::
$
scriptMethods
[
$
arg1
],
array
(
$
self
,
$
params
, &
$
return
,
$
config
)
);
}
else
if
(
$
arg1
!=
'
__config
'
&&
file_exists
(
dirname
(
__FILE__
).
"
/Scripts/
$
arg1
.php
"
)) {
phpQuery::
debug
(
"
Loading script '
$
arg1
'
"
);
require
dirname
(
__FILE__
).
"
/Scripts/
$
arg1
.php
"
;
}
else
{
phpQuery::
debug
(
"
Requested script '
$
arg1
' doesn't exist
"
);
}
return
$
return
?
$
return
:
$
self
;
}
}
abstract
class
phpQueryPlugin_Scripts {
public
static
$
scriptMethods
=
array
();
public
static
function
__initialize
() {
if
(
file_exists
(
dirname
(
__FILE__
).
"
/Scripts/__config.php
"
)) {
include
dirname
(
__FILE__
).
"
/Scripts/__config.php
"
;
phpQueryObjectPlugin_Scripts::
$
config
=
$
config
;
}
}
/**
* Extend scripts' namespace with $name related with $callback.
*
* Callback parameter order looks like this:
* - $this
* - $params
* - &$return
* - $config
*
* @param $name
* @param $callback
* @return bool
*/
public
static
function
script
(
$
name
,
$
callback
) {
if
(phpQueryPlugin_Scripts::
$
scriptMethods
[
$
name
])
throw
new
Exception
(
"
Script name conflict - '
$
name
'
"
);
phpQueryPlugin_Scripts::
$
scriptMethods
[
$
name
] =
$
callback
;
}
}
?>
Back
|
FazBrowse Home
|
New Git URL