|
|
|
|
@@ -31,7 +31,7 @@ class Widget
|
|
|
|
|
*/
|
|
|
|
|
public static function follow($value = "")
|
|
|
|
|
{
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('follow.tpl'), array(
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/follow.tpl'), array(
|
|
|
|
|
'$connect' => L10n::t('Add New Contact'),
|
|
|
|
|
'$desc' => L10n::t('Enter address or web location'),
|
|
|
|
|
'$hint' => L10n::t('Example: bob@example.com, http://example.com/barbara'),
|
|
|
|
|
@@ -74,7 +74,7 @@ class Widget
|
|
|
|
|
$aside = [];
|
|
|
|
|
$aside['$nv'] = $nv;
|
|
|
|
|
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('peoplefind.tpl'), $aside);
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/peoplefind.tpl'), $aside);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -120,6 +120,46 @@ class Widget
|
|
|
|
|
return $network_filter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $type
|
|
|
|
|
* @param string $title
|
|
|
|
|
* @param string $desc
|
|
|
|
|
* @param string $all
|
|
|
|
|
* @param string $baseUrl
|
|
|
|
|
* @param array $options
|
|
|
|
|
* @param string $selected
|
|
|
|
|
* @return string
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*/
|
|
|
|
|
public static function filter($type, $title, $desc, $all, $baseUrl, array $options, $selected = null)
|
|
|
|
|
{
|
|
|
|
|
$queryString = parse_url($baseUrl, PHP_URL_QUERY);
|
|
|
|
|
$queryArray = [];
|
|
|
|
|
|
|
|
|
|
if ($queryString) {
|
|
|
|
|
parse_str($queryString, $queryArray);
|
|
|
|
|
unset($queryArray[$type]);
|
|
|
|
|
|
|
|
|
|
if (count($queryArray)) {
|
|
|
|
|
$baseUrl = substr($baseUrl, 0, strpos($baseUrl, '?')) . '?' . http_build_query($queryArray) . '&';
|
|
|
|
|
} else {
|
|
|
|
|
$baseUrl = substr($baseUrl, 0, strpos($baseUrl, '?')) . '?';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$baseUrl = trim($baseUrl, '?') . '?';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/filter.tpl'), [
|
|
|
|
|
'$type' => $type,
|
|
|
|
|
'$title' => $title,
|
|
|
|
|
'$desc' => $desc,
|
|
|
|
|
'$selected' => $selected,
|
|
|
|
|
'$all_label' => $all,
|
|
|
|
|
'$options' => $options,
|
|
|
|
|
'$base' => $baseUrl,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return networks widget
|
|
|
|
|
*
|
|
|
|
|
@@ -146,7 +186,7 @@ class Widget
|
|
|
|
|
|
|
|
|
|
$nets = array();
|
|
|
|
|
while ($rr = DBA::fetch($r)) {
|
|
|
|
|
$nets[] = array('ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
|
|
|
|
|
$nets[] = ['ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network'])];
|
|
|
|
|
}
|
|
|
|
|
DBA::close($r);
|
|
|
|
|
|
|
|
|
|
@@ -154,14 +194,15 @@ class Widget
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('nets.tpl'), array(
|
|
|
|
|
'$title' => L10n::t('Protocols'),
|
|
|
|
|
'$desc' => '',
|
|
|
|
|
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
|
|
|
|
'$all' => L10n::t('All Protocols'),
|
|
|
|
|
'$nets' => $nets,
|
|
|
|
|
'$base' => $baseurl,
|
|
|
|
|
));
|
|
|
|
|
return self::filter(
|
|
|
|
|
'nets',
|
|
|
|
|
L10n::t('Protocols'),
|
|
|
|
|
'',
|
|
|
|
|
L10n::t('All Protocols'),
|
|
|
|
|
$baseurl,
|
|
|
|
|
$nets,
|
|
|
|
|
$selected
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -183,25 +224,26 @@ class Widget
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$matches = false;
|
|
|
|
|
$matches = [];
|
|
|
|
|
$terms = array();
|
|
|
|
|
$cnt = preg_match_all('/\[(.*?)\]/', $saved, $matches, PREG_SET_ORDER);
|
|
|
|
|
if ($cnt) {
|
|
|
|
|
foreach ($matches as $mtch)
|
|
|
|
|
{
|
|
|
|
|
$unescaped = XML::escape(FileTag::decode($mtch[1]));
|
|
|
|
|
$terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
|
|
|
|
$terms[] = ['ref' => $unescaped, 'name' => $unescaped];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('fileas_widget.tpl'), array(
|
|
|
|
|
'$title' => L10n::t('Saved Folders'),
|
|
|
|
|
'$desc' => '',
|
|
|
|
|
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
|
|
|
|
'$all' => L10n::t('Everything'),
|
|
|
|
|
'$terms' => $terms,
|
|
|
|
|
'$base' => $baseurl,
|
|
|
|
|
));
|
|
|
|
|
return self::filter(
|
|
|
|
|
'file',
|
|
|
|
|
L10n::t('Saved Folders'),
|
|
|
|
|
'',
|
|
|
|
|
L10n::t('Everything'),
|
|
|
|
|
$baseurl,
|
|
|
|
|
$terms,
|
|
|
|
|
$selected
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -225,25 +267,26 @@ class Widget
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$matches = false;
|
|
|
|
|
$matches = [];
|
|
|
|
|
$terms = array();
|
|
|
|
|
$cnt = preg_match_all('/<(.*?)>/', $saved, $matches, PREG_SET_ORDER);
|
|
|
|
|
|
|
|
|
|
if ($cnt) {
|
|
|
|
|
foreach ($matches as $mtch) {
|
|
|
|
|
$unescaped = XML::escape(FileTag::decode($mtch[1]));
|
|
|
|
|
$terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
|
|
|
|
$terms[] = ['ref' => $unescaped, 'name' => $unescaped];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('categories_widget.tpl'), array(
|
|
|
|
|
'$title' => L10n::t('Categories'),
|
|
|
|
|
'$desc' => '',
|
|
|
|
|
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
|
|
|
|
'$all' => L10n::t('Everything'),
|
|
|
|
|
'$terms' => $terms,
|
|
|
|
|
'$base' => $baseurl,
|
|
|
|
|
));
|
|
|
|
|
return self::filter(
|
|
|
|
|
'category',
|
|
|
|
|
L10n::t('Categories'),
|
|
|
|
|
'',
|
|
|
|
|
L10n::t('Everything'),
|
|
|
|
|
$baseurl,
|
|
|
|
|
$terms,
|
|
|
|
|
$selected
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -319,7 +362,7 @@ class Widget
|
|
|
|
|
$entries[] = $entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tpl = Renderer::getMarkupTemplate('remote_friends_common.tpl');
|
|
|
|
|
$tpl = Renderer::getMarkupTemplate('widget/remote_friends_common.tpl');
|
|
|
|
|
return Renderer::replaceMacros($tpl, [
|
|
|
|
|
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
|
|
|
|
|
'$base' => System::baseUrl(),
|
|
|
|
|
|