Static constructor
431166
public static function __static()
	{
		SequenceTypes::$Void = SequenceType::WithTypeCode( XmlTypeCode::None );
		SequenceTypes::$Item = SequenceType::WithTypeCode( XmlTypeCode::Item );
		SequenceTypes::$ItemS = SequenceType::WithTypeCodeAndCardinality( XmlTypeCode::Item, XmlTypeCardinality::ZeroOrMore );
		SequenceTypes::$Node = SequenceType::WithTypeCode( XmlTypeCode::Node );
		SequenceTypes::$ProcessingInstruction = SequenceType::WithTypeCode( XmlTypeCode::ProcessingInstruction );
		SequenceTypes::$Text = SequenceType::WithTypeCode( XmlTypeCode::Text );
		SequenceTypes::$Comment = SequenceType::WithTypeCode( XmlTypeCode::Comment );
		SequenceTypes::$Element = SequenceType::WithTypeCode( XmlTypeCode::Element );
		SequenceTypes::$Attribute = SequenceType::WithTypeCode( XmlTypeCode::Attribute );
		SequenceTypes::$Document = SequenceType::WithTypeCode( XmlTypeCode::Document );
		SequenceTypes::$Boolean = SequenceType::WithTypeCode( XmlTypeCode::Boolean );
		SequenceTypes::$AnyAtomicType = SequenceType::WithTypeCode( XmlTypeCode::AnyAtomicType );
		SequenceTypes::$AnyAtomicTypeO = SequenceType::WithTypeCodeAndCardinality( XmlTypeCode::AnyAtomicType, XmlTypeCardinality::ZeroOrOne );
		SequenceTypes::$Double = SequenceType::WithTypeCode( XmlTypeCode::Double );
		SequenceTypes::$Float = SequenceType::WithTypeCode( XmlTypeCode::Float );
		SequenceTypes::$Date = SequenceType::WithTypeCode( XmlTypeCode::Date );
		SequenceTypes::$Time = SequenceType::WithTypeCode( XmlTypeCode::Time );
		SequenceTypes::$DateTime = SequenceType::WithTypeCode( XmlTypeCode::DateTime );
		SequenceTypes::$StringX = SequenceType::WithTypeCodeAndCardinality (XmlTypeCode::String, XmlTypeCardinality::ZeroOrOne );
		SequenceTypes::$Int = SequenceType::WithTypeCode( XmlTypeCode::Int );
		SequenceTypes::$AnyUri = SequenceType::WithTypeCode( XmlTypeCode::AnyUri );
	}
573405
private static synchronized void init() {
        LOGGER.trace("Reads static resources definition from [static-resources.xml]");

        final File staticResources = Latkes.getWebFile("/WEB-INF/static-resources.xml");
        if (null == staticResources || !staticResources.exists()) {
            throw new IllegalStateException("Not found static resources definition from [static-resources.xml]");
        }

        final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();

        try {
            final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            final Document document = documentBuilder.parse(staticResources);
            final Element root = document.getDocumentElement();

            root.normalize();

            final StringBuilder logBuilder = new StringBuilder("Reading static files: [").append(Strings.LINE_SEPARATOR);
            final NodeList includes = root.getElementsByTagName("include");
            for (int i = 0; i < includes.getLength(); i++) {
                final Element include = (Element) includes.item(i);
                String path = include.getAttribute("path");
                final URI uri = new URI("http", "b3log.org", path, null);
                final String s = uri.toASCIIString();
                path = StringUtils.substringAfter(s, "b3log.org");

                STATIC_RESOURCE_PATHS.add(path);

                logBuilder.append("    ").append("path pattern [").append(path).append("]");
                if (i < includes.getLength() - 1) {
                    logBuilder.append(",");
                }
                logBuilder.append(Strings.LINE_SEPARATOR);
            }

            logBuilder.append("]");

            if (LOGGER.isTraceEnabled()) {
                LOGGER.debug(logBuilder.toString());
            }
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Reads [" + staticResources.getName() + "] failed", e);
            throw new RuntimeException(e);
        }

        final StringBuilder logBuilder = new StringBuilder("Static files: [").append(Strings.LINE_SEPARATOR);
        final Iterator<String> iterator = STATIC_RESOURCE_PATHS.iterator();
        while (iterator.hasNext()) {
            final String pattern = iterator.next();

            logBuilder.append("    ").append(pattern);
            if (iterator.hasNext()) {
                logBuilder.append(',');
            }
            logBuilder.append(Strings.LINE_SEPARATOR);
        }
        logBuilder.append("], ").append('[').append(STATIC_RESOURCE_PATHS.size()).append("] path patterns");

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace(logBuilder.toString());
        }

        inited = true;
    }
263173
static Class<?> loadClass(ClassLoader cl, String classTypeName) throws InvocationException {
        try {
            return cl.loadClass(classTypeName);
        } catch (ClassNotFoundException e) {
            throw new InvocationException(e, "Unable to load class {0} with class loader {1}", classTypeName, cl);
        }
    }
444485
void defineStaticFields(ClassVisitor writer) {
    if (staticFields.isEmpty()) {
      return;
    }
    List<Statement> statements = new ArrayList<>();
    for (StaticFieldVariable staticField : staticFields) {
      staticField.field().defineField(writer);
      statements.add(staticField.field().putStaticField(staticField.initializer()));
    }
    statements.add(Statement.RETURN);
    Statement.concat(statements).writeMethod(Opcodes.ACC_STATIC, BytecodeUtils.CLASS_INIT, writer);
  }
989480
@Override
    public void visitCode(Code obj) {
        if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) {
            state = State.SAW_NOTHING;
            super.visitCode(obj);
        }
    }
590405
public static function create($value)
    {
        $class = static::class;
        if (!array_key_exists($class, self::$instances)) {
            self::$instances[$class] = [];
        }
        if (!array_key_exists($value, self::$instances[$class])) {
            self::$instances[$class][$value] = new static($value);
        }

        return self::$instances[$class][$value];
    }
495649
public static function initialize() {
		if( static::isInitialized() ) { return; }
		static::$initialized = true;

		$routes = array();

		// TODO: Add cache, but what kind of ?

		static::loadRoutes($routes);

		// Register routes
		foreach( $routes as $type => $typeRoutes ) {
			$routeClass = RequestHandler::getRouteClass($type);
			if( !class_exists($routeClass, true) || !in_array(get_class(), class_parents($routeClass)) ) {
				continue;
			}
			foreach( $typeRoutes as $routeName => $routeConfig ) {
				$routeClass::registerConfig($routeName, $routeConfig);
			}
		}
	}
52271
function construct (constructor, args) {
  function Factory () {
    return constructor.apply(this, args);
  }

  Factory.prototype = constructor.prototype;

  return new Factory();
}
116672
static function init()
    {
        $dic = new Container();

        $dic['utc_offset'] = 0;

        $dic['datetimenow'] = function () {
            $now = Carbon::now('UTC');

            return $now->toDateTimeString();
        };

        $dic['phpmailer'] = function () {
            $phpmailer = new PHPMailer();
            $phpmailer->isHTML(true);
            $phpmailer->CharSet = 'windows-1251';
            $phpmailer->From = SettingsMail::APP_EMAIL;
            $phpmailer->FromName = iconv('utf-8', 'windows-1251', SettingsGeneral::APP_NAME);

            if (SettingsMail::SMTP) {
                $phpmailer->isSMTP();
                $phpmailer->SMTPDebug = 0;
                $phpmailer->SMTPAuth = true;
                $phpmailer->SMTPSecure = SettingsMail::SMTP_SECURITY;
                $phpmailer->Host = SettingsMail::SMTP_HOST;
                $phpmailer->Port = SettingsMail::SMTP_PORT;
                $phpmailer->Username = SettingsMail::SMTP_USERNAME;
                $phpmailer->Password = SettingsMail::SMTP_PASSWORD;
            }

            return $phpmailer;
        };

        $dic['mailer'] = function ($c) {
            return new Mailer($c);
        };

        $dic['sms'] = function () {
            return new SMS();
        };

        $dic['datachangelog'] = function ($c) {
            return new DataChangeLog($c);
        };

        $dic['log'] = function () {
            return LoggerFactory::create('Main');
        };

        $dic['checker'] = function ($c) {
            return new Checker($c);
        };

        return $dic;
    }
1295272
function addStatics(statics, Subclass) {

  // static method inheritance (including `extend`)
  Object.keys(statics).forEach(function(key) {
    var descriptor = Object.getOwnPropertyDescriptor(statics, key);
    if (!descriptor.configurable) return;

    Object.defineProperty(Subclass, key, descriptor);
  });
}
929225
public function init(Application $application)
    {
        $application->addService('staticController', new StaticControllerService());
        $application->any(':all', $application->getService('staticController'));
    }
548479
def static(self, uri, file_or_directory, *args, **kwargs):
        
        static = FutureStatic(uri, file_or_directory, args, kwargs)
        self.statics.append(static)
1096964
public void importStatic(String name) throws ELException {
        int i = name.lastIndexOf('.');
        if (i <= 0) {
            throw new ELException(
                "The name " + name + " is not a full static member name");
        }
        String memberName = name.substring(i+1);
        String className = name.substring(0, i);
        staticNameMap.put(memberName, className);
    }
659522
static function init()
  {
    if (self::$initialized) return;

    self::$initialized = TRUE;

    self::$COFFEE_KEYWORDS  = array_merge(self::$COFFEE_KEYWORDS, array_keys(self::$COFFEE_ALIASES));
    self::$COFFEE_RESERVED  = array_merge(self::$JS_RESERVED, self::$JS_KEYWORDS, self::$COFFEE_KEYWORDS, self::$STRICT_PROSCRIBED);
    self::$JS_FORBIDDEN     = array_merge(self::$JS_KEYWORDS, self::$JS_RESERVED, self::$STRICT_PROSCRIBED);
    self::$INDEXABLE        = array_merge(self::$CALLABLE, self::$INDEXABLE);
    self::$NOT_SPACED_REGEX = array_merge(self::$NOT_REGEX, self::$NOT_SPACED_REGEX);

    Rewriter::init();

    self::$INVERSES         = Rewriter::$INVERSES;
  }
1209135
public function setStatic($static)
    {
        if ($static === true) {
            $this->addModifier(Modifiers::MODIFIER_STATIC);
        } else {
            $this->removeModifier(Modifiers::MODIFIER_STATIC);
        }
    }
790720
function buildViewStatics( def, code ) {
    try {
        let statics = def[ "view.statics" ];

        if ( typeof statics === 'undefined' ) return;
        if ( typeof statics === 'string' ) statics = [ statics ];
        else if ( !Array.isArray( statics ) ) {
            throw Error( "view.statics must be a string or an array of strings!" );
        }

        statics.forEach( function ( name ) {
            code.addNeededBehindFunction( name );
            code.section.statics.push(
                "ViewClass" + keySyntax( name ) + " = CODE_BEHIND" + keySyntax( name ) + ".bind(ViewClass);"
            );
        } );
    } catch ( ex ) {
        throw ex + "\n...in view.statics: " + JSON.stringify( statics );
    }
}
786808
function add_static($js, $condition = null, $no_build = false) {
        $js = Helper::static_url($js);
        return $this->add($js, $condition, $no_build);
    }