@author Vova Feldman (@svovaf)
@since  1.0.5

@param bool|null $is_localhost

@return FS_Plugin_License[]
11975
function get_available_premium_licenses( $is_localhost = null ) {
            $this->_logger->entrance();

            $licenses = array();
            if ( ! $this->has_paid_plan() ) {
                return $licenses;
            }

            if ( is_array( $this->_licenses ) ) {
                foreach ( $this->_licenses as $license ) {
                    if ( ! $license->can_activate( $is_localhost ) ) {
                        continue;
                    }

                    $licenses[] = $license;
                }
            }

            return $licenses;
        }
1081735
public function isLocal() : bool
   {

      if ( $this->states[ 'LOCAL' ] ) { return true; }
      if ( null === $this->_sld ) { return false; }
      return $this->_sld->isLocal();

   }
668836
public static function getIP($isHeader=false,$default='0.0.0.0')
	{
		if($isHeader)
		{
			if (isset($_SERVER['HTTP_CLIENT_IP']) && Validator::ip($_SERVER['HTTP_CLIENT_IP']))
			{
				return $_SERVER['HTTP_CLIENT_IP'];
			}
			else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && Validator::ip($_SERVER['HTTP_X_FORWARDED_FOR']))
			{
				return $_SERVER['HTTP_X_FORWARDED_FOR'];
			}
		}
		if (isset($_SERVER['REMOTE_ADDR']) && Validator::ip($_SERVER['REMOTE_ADDR']))
		{
			return $_SERVER['REMOTE_ADDR'];
		}
		else
		{
			return $default;
		}
	}
38575
public function getClient($locales = array('en'))
    {
        return new Client(
            $this->config['client']['user_id'],
            $this->config['client']['license_key'],
            $locales,
            $this->config['client']['options'] ?: array()
        );
    }
889834
public static function instanceFromArguments($arguments = []) {
        $arguments = array_values($arguments);
        $argumentsCount = count($arguments);
        for ($i = 0; $i < $argumentsCount; $i++) {
            if (is_object($arguments[$i]) && $arguments[$i] instanceof SharedDataInterface) {
                return $arguments[$i];
            }
        }
        return null;
    }
711603
public static function isSameHost($url1, $url2, $strict = true) {
		return strcasecmp(self::getHost($url1, !$strict), self::getHost($url2, !$strict)) == 0;
	}
699714
public function build(array $userAgentsData, bool $isCore) : array
    {
        $useragents = [];

        foreach ($userAgentsData as $useragent) {
            $children = [];

            if (!$isCore) {
                $children = $useragent['children'];
            }

            $useragents[] = new UserAgent(
                $useragent['userAgent'],
                $useragent['properties'],
                $children,
                isset($useragent['platform']) ? $useragent['platform'] : null,
                isset($useragent['engine']) ? $useragent['engine'] : null,
                isset($useragent['device']) ? $useragent['device'] : null,
                isset($useragent['browser']) ? $useragent['browser'] : null
            );
        }

        return $useragents;
    }
1062605
public function localhost() {
        if ( strpos($this->wwwroot,'://localhost') !== false ) return true;
        if ( strpos($this->wwwroot,'://127.0.0.1') !== false ) return true;
        return false;
    }
642832
protected function lexArguments(bool $isConst = false): ?array
    {
        /**
         * @return ArgumentNode
         */
        $parseFunction = function () use ($isConst): ArgumentNode {
            return $this->lexArgument($isConst);
        };

        return $this->peek(TokenKindEnum::PAREN_L)
            ? $this->many(
                TokenKindEnum::PAREN_L,
                $parseFunction,
                TokenKindEnum::PAREN_R
            )
            : [];
    }
595177
public function isLocal() : bool
    {
        $host = parse_url($this->file, PHP_URL_HOST);

        // If it has not an url host
        if ($host === null) {
            // Is the string a file_id?
            if (preg_match('/^([\w\d]*[-_]*[\w\d]*)*$/', $this->file)) {
                // It is a file_id
                return false;
            }
            // It is local
            return true;
        }
            // It is an url
            return false;
    }
509620
protected function lexArgument(bool $isConst = false): ArgumentNode
    {
        $start = $this->lexer->getToken();

        /**
         * @return NodeInterface|TypeNodeInterface|ValueNodeInterface
         */
        $parseValue = function () use ($isConst): NodeInterface {
            $this->expect(TokenKindEnum::COLON);
            return $this->lexValue($isConst);
        };

        return new ArgumentNode(
            $this->lexName(),
            $parseValue(),
            $this->createLocation($start)
        );
    }
1321084
protected function lexDirectives(bool $isConst = false): array
    {
        $directives = [];

        while ($this->peek(TokenKindEnum::AT)) {
            $directives[] = $this->lexDirective($isConst);
        }

        return $directives;
    }
1366876
public function getHost($locale)
    {
        if (!isset($this->localesConfig[$locale]['host'])) {
            return null;
        }

        return $this->localesConfig[$locale]['host'];
    }
51444
static function build($required=null, $optional=null,
                   $policy_url=null,
                   $sreg_ns_uri=Auth_OpenID_SREG_NS_URI,
                   $cls='Auth_OpenID_SRegRequest')
    {
        /** @var Auth_OpenID_SRegRequest $obj */
        $obj = new $cls();

        $obj->required = array();
        $obj->optional = array();
        $obj->policy_url = $policy_url;
        $obj->ns_uri = $sreg_ns_uri;

        if ($required) {
            if (!$obj->requestFields($required, true, true)) {
                return null;
            }
        }

        if ($optional) {
            if (!$obj->requestFields($optional, false, true)) {
                return null;
            }
        }

        return $obj;
    }
845658
public function all($vhost = null)
    {
        if ($vhost) {
            return $this->client->send(sprintf('/api/bindings/%s', urlencode($vhost)));
        } else {
            return $this->client->send('/api/bindings');
        }
    }
1087977
public static function prototype(?bool $isConsole = false) : array
  {
    return [
      'console' => $isConsole,
      'config' => Application::getConfig(),
      'events' => new Events,
      'route' => new Route,
      'view' => Template::class,
      'variables' => GlobalVariables::class
    ];
  }
458122
function has_any_active_valid_license() {
            if ( ! fs_is_network_admin() ) {
                return $this->has_active_valid_license();
            }

            $installs            = $this->get_blog_install_map();
            $all_plugin_licenses = self::get_all_licenses( $this->_module_id );

            foreach ( $installs as $blog_id => $install ) {
                if ( ! FS_Plugin_License::is_valid_id( $install->license_id ) ) {
                    continue;
                }

                foreach ( $all_plugin_licenses as $license ) {
                    if ( $license->id == $install->license_id ) {
                        if ( self::is_active_valid_license( $license ) ) {
                            return true;
                        }
                    }
                }
            }

            return false;
        }