Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hubzilla
core
Commits
47f40079
Commit
47f40079
authored
Mar 15, 2017
by
Zot
Committed by
Mario
Mar 29, 2017
Browse files
more widgets
parent
74f58818
Changes
4
Hide whitespace changes
Inline
Side-by-side
Zotlabs/Widget/Archive.php
0 → 100644
View file @
47f40079
<?php
namespace
Zotlabs\Widget
;
class
Archive
{
function
widget
(
$arr
)
{
$o
=
''
;
if
(
!
\
App
::
$profile_uid
)
{
return
''
;
}
$uid
=
\
App
::
$profile_uid
;
if
(
!
feature_enabled
(
$uid
,
'archives'
))
return
''
;
if
(
!
perm_is_allowed
(
$uid
,
get_observer_hash
(),
'view_stream'
))
return
''
;
$wall
=
((
array_key_exists
(
'wall'
,
$arr
))
?
intval
(
$arr
[
'wall'
])
:
0
);
$style
=
((
array_key_exists
(
'style'
,
$arr
))
?
$arr
[
'style'
]
:
'select'
);
$showend
=
((
get_pconfig
(
$uid
,
'system'
,
'archive_show_end_date'
))
?
true
:
false
);
$mindate
=
get_pconfig
(
$uid
,
'system'
,
'archive_mindate'
);
$visible_years
=
get_pconfig
(
$uid
,
'system'
,
'archive_visible_years'
);
if
(
!
$visible_years
)
$visible_years
=
5
;
$url
=
z_root
()
.
'/'
.
\
App
::
$cmd
;
$ret
=
list_post_dates
(
$uid
,
$wall
,
$mindate
);
if
(
!
count
(
$ret
))
return
''
;
$cutoff_year
=
intval
(
datetime_convert
(
''
,
date_default_timezone_get
(),
'now'
,
'Y'
))
-
$visible_years
;
$cutoff
=
((
array_key_exists
(
$cutoff_year
,
$ret
))
?
true
:
false
);
$o
=
replace_macros
(
get_markup_template
(
'posted_date_widget.tpl'
),
array
(
'$title'
=>
t
(
'Archives'
),
'$size'
=>
$visible_years
,
'$cutoff_year'
=>
$cutoff_year
,
'$cutoff'
=>
$cutoff
,
'$url'
=>
$url
,
'$style'
=>
$style
,
'$showend'
=>
$showend
,
'$dates'
=>
$ret
));
return
$o
;
}
}
Zotlabs/Widget/Filer.php
0 → 100644
View file @
47f40079
<?php
namespace
Zotlabs\Widget
;
class
Filer
{
function
widget
(
$arr
)
{
if
(
!
local_channel
())
return
''
;
$selected
=
((
x
(
$_REQUEST
,
'file'
))
?
$_REQUEST
[
'file'
]
:
''
);
$terms
=
array
();
$r
=
q
(
"select distinct term from term where uid = %d and ttype = %d order by term asc"
,
intval
(
local_channel
()),
intval
(
TERM_FILE
)
);
if
(
!
$r
)
return
;
foreach
(
$r
as
$rr
)
$terms
[]
=
array
(
'name'
=>
$rr
[
'term'
],
'selected'
=>
((
$selected
==
$rr
[
'term'
])
?
'selected'
:
''
));
return
replace_macros
(
get_markup_template
(
'fileas_widget.tpl'
),
array
(
'$title'
=>
t
(
'Saved Folders'
),
'$desc'
=>
''
,
'$sel_all'
=>
((
$selected
==
''
)
?
'selected'
:
''
),
'$all'
=>
t
(
'Everything'
),
'$terms'
=>
$terms
,
'$base'
=>
z_root
()
.
'/'
.
\
App
::
$cmd
));
}
}
Zotlabs/Widget/Fullprofile.php
0 → 100644
View file @
47f40079
<?php
namespace
Zotlabs\Widget
;
class
Fullprofile
{
function
widget
(
$arr
)
{
if
(
!
\
App
::
$profile
[
'profile_uid'
])
return
;
$block
=
observer_prohibited
();
return
profile_sidebar
(
\
App
::
$profile
,
$block
);
}
}
include/widgets.php
View file @
47f40079
...
...
@@ -10,91 +10,8 @@ require_once('include/contact_widgets.php');
require_once
(
'include/attach.php'
);
function
widget_filer
(
$arr
)
{
if
(
!
local_channel
())
return
''
;
$selected
=
((
x
(
$_REQUEST
,
'file'
))
?
$_REQUEST
[
'file'
]
:
''
);
$terms
=
array
();
$r
=
q
(
"select distinct term from term where uid = %d and ttype = %d order by term asc"
,
intval
(
local_channel
()),
intval
(
TERM_FILE
)
);
if
(
!
$r
)
return
;
foreach
(
$r
as
$rr
)
$terms
[]
=
array
(
'name'
=>
$rr
[
'term'
],
'selected'
=>
((
$selected
==
$rr
[
'term'
])
?
'selected'
:
''
));
return
replace_macros
(
get_markup_template
(
'fileas_widget.tpl'
),
array
(
'$title'
=>
t
(
'Saved Folders'
),
'$desc'
=>
''
,
'$sel_all'
=>
((
$selected
==
''
)
?
'selected'
:
''
),
'$all'
=>
t
(
'Everything'
),
'$terms'
=>
$terms
,
'$base'
=>
z_root
()
.
'/'
.
App
::
$cmd
));
}
function
widget_archive
(
$arr
)
{
$o
=
''
;
if
(
!
App
::
$profile_uid
)
{
return
''
;
}
$uid
=
App
::
$profile_uid
;
if
(
!
feature_enabled
(
$uid
,
'archives'
))
return
''
;
if
(
!
perm_is_allowed
(
$uid
,
get_observer_hash
(),
'view_stream'
))
return
''
;
$wall
=
((
array_key_exists
(
'wall'
,
$arr
))
?
intval
(
$arr
[
'wall'
])
:
0
);
$style
=
((
array_key_exists
(
'style'
,
$arr
))
?
$arr
[
'style'
]
:
'select'
);
$showend
=
((
get_pconfig
(
$uid
,
'system'
,
'archive_show_end_date'
))
?
true
:
false
);
$mindate
=
get_pconfig
(
$uid
,
'system'
,
'archive_mindate'
);
$visible_years
=
get_pconfig
(
$uid
,
'system'
,
'archive_visible_years'
);
if
(
!
$visible_years
)
$visible_years
=
5
;
$url
=
z_root
()
.
'/'
.
App
::
$cmd
;
$ret
=
list_post_dates
(
$uid
,
$wall
,
$mindate
);
if
(
!
count
(
$ret
))
return
''
;
$cutoff_year
=
intval
(
datetime_convert
(
''
,
date_default_timezone_get
(),
'now'
,
'Y'
))
-
$visible_years
;
$cutoff
=
((
array_key_exists
(
$cutoff_year
,
$ret
))
?
true
:
false
);
$o
=
replace_macros
(
get_markup_template
(
'posted_date_widget.tpl'
),
array
(
'$title'
=>
t
(
'Archives'
),
'$size'
=>
$visible_years
,
'$cutoff_year'
=>
$cutoff_year
,
'$cutoff'
=>
$cutoff
,
'$url'
=>
$url
,
'$style'
=>
$style
,
'$showend'
=>
$showend
,
'$dates'
=>
$ret
));
return
$o
;
}
function
widget_fullprofile
(
$arr
)
{
if
(
!
App
::
$profile
[
'profile_uid'
])
return
;
$block
=
observer_prohibited
();
return
profile_sidebar
(
App
::
$profile
,
$block
);
}
function
widget_shortprofile
(
$arr
)
{
...
...
Write
Preview
Supports
Markdown
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