Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

108 lines
2.6 KiB

  1. <?php
  2. function follow_widget() {
  3. return replace_macros(get_markup_template('follow.tpl'),array(
  4. '$connect' => t('Add New Contact'),
  5. '$desc' => t('Enter address or web location'),
  6. '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
  7. '$follow' => t('Connect')
  8. ));
  9. }
  10. function findpeople_widget() {
  11. $a = get_app();
  12. $inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : '');
  13. if(get_config('system','invitation_only')) {
  14. $x = get_pconfig(local_user(),'system','invites_remaining');
  15. if($x || is_site_admin()) {
  16. $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
  17. . sprintf( tt('%d invitation available','%d invitations available',$x), $x)
  18. . '</div>' . $inv;
  19. }
  20. }
  21. return replace_macros(get_markup_template('peoplefind.tpl'),array(
  22. '$findpeople' => t('Find People'),
  23. '$desc' => t('Enter name or interest'),
  24. '$label' => t('Connect/Follow'),
  25. '$hint' => t('Examples: Robert Morgenstein, Fishing'),
  26. '$findthem' => t('Find'),
  27. '$suggest' => t('Friend Suggestions'),
  28. '$similar' => t('Similar Interests'),
  29. '$inv' => $inv
  30. ));
  31. }
  32. function networks_widget($baseurl,$selected = '') {
  33. $a = get_app();
  34. if(! local_user())
  35. return '';
  36. $r = q("select distinct(network) from contact where uid = %d",
  37. intval(local_user())
  38. );
  39. $nets = array();
  40. if(count($r)) {
  41. require_once('include/contact_selectors.php');
  42. foreach($r as $rr) {
  43. if($rr['network'])
  44. $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
  45. }
  46. }
  47. if(count($nets) < 2)
  48. return '';
  49. return replace_macros(get_markup_template('nets.tpl'),array(
  50. '$title' => t('Networks'),
  51. '$desc' => '',
  52. '$sel_all' => (($selected == '') ? 'selected' : ''),
  53. '$all' => t('All Networks'),
  54. '$nets' => $nets,
  55. '$base' => $baseurl,
  56. ));
  57. }
  58. function fileas_widget($baseurl,$selected = '') {
  59. $a = get_app();
  60. if(! local_user())
  61. return '';
  62. $saved = get_pconfig(local_user(),'system','filetags');
  63. if(! strlen($saved))
  64. return;
  65. $matches = false;
  66. $terms = array();
  67. $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
  68. if($cnt) {
  69. foreach($matches as $mtch) {
  70. $unescaped = file_tag_decode($mtch[1]);
  71. $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
  72. }
  73. }
  74. return replace_macros(get_markup_template('fileas_widget.tpl'),array(
  75. '$title' => t('File Selections'),
  76. '$desc' => '',
  77. '$sel_all' => (($selected == '') ? 'selected' : ''),
  78. '$all' => t('Everything'),
  79. '$terms' => $terms,
  80. '$base' => $baseurl,
  81. ));
  82. }