<commit_before><?php
/**
 * @file src/Content/Widget.php
 */
namespace Friendica\Content;

use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Profile;

require_once 'boot.php';
require_once 'include/dba.php';

class Widget
{
	/**
	 * Return the follow widget
	 *
	 * @param string $value optional, default empty
	 */
	public static function follow($value = "")
	{
		return replace_macros(get_markup_template('follow.tpl'), array(
			'$connect' => L10n::t('Add New Contact'),
			'$desc' => L10n::t('Enter address or web location'),
			'$hint' => L10n::t('Example: <EMAIL>, http://example.com/barbara'),
			'$value' => $value,
			'$follow' => L10n::t('Connect')
		));
	}

	/**
	 * Return Find People widget
	 */
	public static function findPeople()
	{
		$a = get_app();
		$global_dir = Config::get('system', 'directory');

		if (Config::get('system', 'invitation_only')) {
			$x = PConfig::get(local_user(), 'system', 'invites_remaining');
			if ($x || is_site_admin()) {
				$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
					. L10n::tt('%d invitation available', '%d invitations available', $x)
					. '</div>';
			}
		}

		$nv = [];
		$nv['findpeople'] = L10n::t('Find People');
		$nv['desc'] = L10n::t('Enter name or interest');
		$nv['label'] = L10n::t('Connect/Follow');
		$nv['hint'] = L10n::t('Examples: <NAME>, Fishing');
		$nv['findthem'] = L10n::t('Find');
		$nv['suggest'] = L10n::t('Friend Suggestions');
		$nv['similar'] = L10n::t('Similar Interests');
		$nv['random'] = L10n::t('Random Profile');
		$nv['inv'] = L10n::t('Invite Friends');
		$nv['directory'] = L10n::t('Global Directory');
		$nv['global_dir'] = $global_dir;
		$nv['local_directory'] = L10n::t('Local Directory');

		$aside = [];
		$aside['$nv'] = $nv;

		return replace_macros(get_markup_template('peoplefind.tpl'), $aside);
	}

	/**
	 * Return unavailable networks
	 */
	public static function unavailableNetworks()
	{
		$networks = array();

		if (!Addon::isEnabled("statusnet")) {
			$networks[] = NETWORK_STATUSNET;
		}
<commit_msg>Hide deprecated networks<commit_after><?php
/**
 * @file src/Content/Widget.php
 */
namespace Friendica\Content;

use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Profile;

require_once 'boot.php';
require_once 'include/dba.php';

class Widget
{
	/**
	 * Return the follow widget
	 *
	 * @param string $value optional, default empty
	 */
	public static function follow($value = "")
	{
		return replace_macros(get_markup_template('follow.tpl'), array(
			'$connect' => L10n::t('Add New Contact'),
			'$desc' => L10n::t('Enter address or web location'),
			'$hint' => L10n::t('Example: <EMAIL>, http://example.com/barbara'),
			'$value' => $value,
			'$follow' => L10n::t('Connect')
		));
	}

	/**
	 * Return Find People widget
	 */
	public static function findPeople()
	{
		$a = get_app();
		$global_dir = Config::get('system', 'directory');

		if (Config::get('system', 'invitation_only')) {
			$x = PConfig::get(local_user(), 'system', 'invites_remaining');
			if ($x || is_site_admin()) {
				$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
					. L10n::tt('%d invitation available', '%d invitations available', $x)
					. '</div>';
			}
		}

		$nv = [];
		$nv['findpeople'] = L10n::t('Find People');
		$nv['desc'] = L10n::t('Enter name or interest');
		$nv['label'] = L10n::t('Connect/Follow');
		$nv['hint'] = L10n::t('Examples: <NAME>, Fishing');
		$nv['findthem'] = L10n::t('Find');
		$nv['suggest'] = L10n::t('Friend Suggestions');
		$nv['similar'] = L10n::t('Similar Interests');
		$nv['random'] = L10n::t('Random Profile');
		$nv['inv'] = L10n::t('Invite Friends');
		$nv['directory'] = L10n::t('Global Directory');
		$nv['global_dir'] = $global_dir;
		$nv['local_directory'] = L10n::t('Local Directory');

		$aside = [];
		$aside['$nv'] = $nv;

		return replace_macros(get_markup_template('peoplefind.tpl'), $aside);
	}

	/**
	 * Return unavailable networks
	 */
	public static function unavailableNetworks()
	{
		// Always hide content from these networks
		$networks = ['face', 'apdn'];

		if (!Addon::isEnabled("statusnet")) {
			$networks[] = NETWORK_STATUSNET;
		}

{'fraction_non_alphanumeric': 0.20523268282221746, 'fraction_numerical': 0.01458288655372078, 'mean_word_length': 4.708690330477356, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4501890', 'n_tokens_mistral': 1831, 'n_tokens_neox': 1636, 'n_words': 327}