$self_class_name - это костыль из-за отсутствия позднего статического связывания в PHP < 5.3
549337
static function add($target, $property, $value, $type_title, $user, $self_class_name)
	{
		return object_new_instance($self_class_name, array(
			'target_class_name' => $target->class_name(),
			'target_object_id' => $target->id(),
			'target_field' => $property,
			'target_value' => $value,
			'type_title' => $type_title,
			'user_id' => $user->id(),
		));
	}
283529
private function init_request()
	{
		global $request;

		# Значения по умолчанию
		$request = array(
			'method' => $_SERVER['REQUEST_METHOD'],
			'scheme' => isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https' : 'http',
			'host' => strtolower($_SERVER['HTTP_HOST']),
			'port' => '',
			'user' => isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '',
			'pass' => isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '',
			'path' => '',
			'query' => '',
			'fragment' => '',
			'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
		);

		$request['url'] = $request['scheme'] . '://' . $request['host'] . $_SERVER['REQUEST_URI'];

		$request = array_merge($request, parse_url($request['url']));
		$request['file'] = substr($request['path'], strrpos($request['path'], '/')+1);
		if ($request['file'])
		{
			$request['path'] = substr($request['path'], 0, -strlen($request['file']));
		}

		# Создаем заготовку URL для GET-запросов с параметрами
		$request['link'] = $request['url'];
		if (substr($request['link'], -1) == '/')
		{
			$request['link'] .= '?';
		}
		elseif (strpos($request['link'], '?') === false)
		{
			$request['link'] .= '?';
		}
		else
		{
			$request['link'] .= '&';
		}

		if (is_null($this->path))
		{
			$s = $this->froot;
			$s = substr($s,
				strlen(realpath($_SERVER['DOCUMENT_ROOT'])) - (Eresus_Kernel::isWindows() ? 2 : 0));
			if (!strlen($s) || substr($s, -1) != '/')
			{
				$s .= '/';
			}
			$this->path = (substr($s, 0, 1) != '/' ? '/' : '').$s;
		}

		/*
		 * Установка свойств объекта $Eresus
		 * Должна выполняться ДО вызова __clearargs
		 */
		$root = $request['scheme'] . '://' . $request['host'] .
			($request['port'] ? ':'.$request['port'] : '');
		$this->root = $root.$this->path;
		$this->data = $this->root.'data/';
		$this->style = $this->root.'style/';


		# Сбор аргументов вызова
		$request['arg'] = __clearargs(array_merge($_GET, $_POST));
		# Разбивка параметров вызова скрипта
		$s = substr($request['path'], strlen($this->path));
		$request['params'] = $s ? explode('/', substr($s, 0, -1)) : array();

		$request['path'] = $root.$request['path'];

		# Обратная совместимость
		# <= 2.9
		$this->request = &$request;
        /**
         * @deprecated с 3.01
         */
		define('httpPath', $this->path);
        /**
         * @deprecated с 3.01
         */
		define('httpHost', $this->request['host']);
        /**
         * @deprecated с 3.01
         */
        define('httpRoot', $this->root);
        /**
         * @deprecated с 3.01
         */
		define('styleRoot', $this->style);
        /**
         * @deprecated с 3.01
         */
		define('dataRoot', $this->data);
        /**
         * @deprecated с 3.01
         */
		define('cookieHost', $this->request['host']);
        /**
         * @deprecated с 3.01
         */
		define('cookiePath', $this->path);
	}
1142637
function field_prep(&$item)
    {
        $item['type'] = strtolower($item['type']);
        # Метка
        if (!isset($item['label'])) $item['label'] = '';
        # Подсказка
        if (isset($item['hint'])) $item['label'] = '<span class="hint" title="'.$item['hint'].'">'.$item['label'].'</span>';
        # Маска значения
        if (isset($item['pattern']) && isset($item['name']))
            $this->validator .= "
				if (!form.".$item['name'].".value.match(".$item['pattern'].")) {
					alert('".(isset($item['errormsg'])?$item['errormsg']:sprintf(errFormPatternError, $item['name'], $item['pattern']))."');
					result = false;
					form.".$item['name'].".select();
				} else ";
        # Значение
        $item['value'] = isset($item['value']) ? $item['value']
            : (isset($item['name']) && isset($this->values[$item['name']]) ? $this->values[$item['name']]
                : (isset($item['default']) ? $item['default']
                    : '' )
            );
        # ID
        if (!isset($item['id'])) $item['id'] = '';
        # Элемент отключен
        if (!isset($item['disabled'])) $item['disabled'] = '';
        # Комментарий
        $item['comment'] = isset($item['comment']) ? ' '.$item['comment'] : '';
        # Стили
        $item['style'] = isset($item['style']) ? explode(';', $item['style']) : array();
        # Классы
        $item['class'] = isset($item['class']) ? explode(' ', $item['class']) : array();
        # Дополнительно
        if (!isset($item['extra'])) $item['extra'] = '';
    }
1069410
function load($object)
	{
		$set    = popval($where, '*set');
		$must_be_configured = $object->get('must_be_configured');
		$select = array();
		$post_functions = array();

		$table_prefix = '`'.$object->table_name().'`.';

//		if(Cfg::get('is_developer')) { bors_use('debug/print_dd'); echo "<b>Load: {$object->class_name()}</b><br/>"; print_dd($where); print_dd(bors_lib_orm::main_fields($object)); }
		foreach(bors_lib_orm::main_fields($object) as $f)
		{
			if(preg_match('/^\w+$/', $sql_name = $f['sql_name']))
				$x = $table_prefix.'`'.$sql_name.'`'; // убирать апострофы нельзя, иначе тупо не работабт поля с некорректными именами
			elseif(preg_match('/^(\w+)\+(\w+)$/', $f['sql_name'], $m)) // id => forum_id+group_id
				// http://forums.airbase.ru/2008/06/t62054,12--poslednij-pokhod-unikalnogo-korablya.html
				$x = "CONCAT({$m[1]},':',{$m[2]})";
			elseif(preg_match('/^`\w+`$/', $sql_name))
				$x = $table_prefix.$sql_name;
			else
				$x = $sql_name;

			if($f['sql_name'] != ($property = $f['property']))
				$x .= " AS `{$property}`";

			$select[] = $x;

			if(!empty($f['post_function']))
				$post_functions[$f['property']] = $f['post_function'];
		}

		$where = array('`'.$object->table_name().'`.`'.$object->id_field().'`=' => $object->id());

		$dummy = array();
		self::__join('inner', $object, $select, $where, $post_functions, $dummy);
		self::__join('left',  $object, $select, $where, $post_functions, $dummy);

		// формат: array(..., '*set' => 'MAX(create_time) AS max_create_time, ...')
		if($set)
			foreach(preg_split('/,\s*/', $set) as $s)
				$select[] = $s;

		$dbh = new driver_mysql($object->db_name());

		$data = $dbh->select($object->table_name(), join(',', $select), $where);

		if(!$data)
			return $object->set_is_loaded(false);

		$object->data = $data;

		if($must_be_configured)
			$object->b2_configure();

		if(!empty($post_functions))
			self::post_functions_do($object, $post_functions);

		$object->set_is_loaded(true);
		save_cached_object($object);

		return true;
	}
1013148
protected function initConf()
    {
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');

        /*
         * Переменную $Eresus приходится делать глобальной, чтобы файл конфигурации
         * мог записывать в неё свои значения.
         * TODO Избавиться от глобальной переменной
         */
        /** @noinspection PhpUnusedLocalVariableInspection */
        global $Eresus;

        $filename = $this->getFsRoot() . '/cfg/main.php';
        if (file_exists($filename))
        {
            /** @noinspection PhpIncludeInspection */
            include $filename;
            // TODO: Сделать проверку успешного подключения файла
        }
        else
        {
            $this->fatalError("Main config file '$filename' not found!");
        }
    }
468310
public static function validateClass() {
        $moufManager = MoufManager::getMoufManager();

        $instancesList = $moufManager->getInstancesList();
        $selfedit = isset($_GET['selfedit'])?$_GET['selfedit']:"";

        $errors = array();
        $instancesToDelete = array();
        foreach ($instancesList as $instanceName=>$className) {
            $instanceDescriptor = $moufManager->getInstanceDescriptor($instanceName);
            if ($instanceDescriptor->getType() == MoufInstanceDescriptor::TYPE_DECLARATIVE && !class_exists($className)) {
                $errors[] = "<li>".$instanceName." - Unable to find class: <strong>".$className."</strong> : <a href='".MOUF_URL."mouf/deleteInstance?instanceName=".urlencode($instanceName)."&selfedit=".$selfedit."&returnurl=".urlencode(MOUF_URL."validate/?selfedit=".$selfedit)."' class='btn btn-danger'><i class='icon-remove icon-white'></i> Delete</a></li>";
                $instancesToDelete[] = $instanceName;
            } elseif ($instanceDescriptor->getType() == MoufInstanceDescriptor::TYPE_PHP && $className != null && !class_exists($className)) {
                $errors[] = "<li>".$instanceName." - Unable to find class '<strong>".$className."</strong>' in instance defined by PHP code : <a href='".MOUF_URL."mouf/deleteInstance?instanceName=".urlencode($instanceName)."&selfedit=".$selfedit."&returnurl=".urlencode(MOUF_URL."validate/?selfedit=".$selfedit)."' class='btn btn-danger'><i class='icon-remove icon-white'></i> Delete</a></li>";
                $instancesToDelete[] = $instanceName;
            } else {
                // Let's check the constructor arguments.
                $additionalErrors = $instanceDescriptor->validate();
                $errors = array_merge($errors, array_map(function($text) use ($instanceName) {
                    return '<li>'.$text.'</li>';
                }, $additionalErrors));
            }
        }

        if ($errors) {
            $msg = "";
            if(!empty($instancesToDelete)) {
                $deleteAllAction = MOUF_URL."mouf/deleteInstances";
                $msg .= '<form action="'.$deleteAllAction.'" method="POST">';
                $msg .= '<input type="hidden" name="selfedit" value="'.$instanceName.'" />';
                $msg .= '<input type="hidden" name="returnurl" value="'.MOUF_URL."validate/?selfedit=".$selfedit.'" />';
                foreach($instancesToDelete as $instanceName) {
                    $msg .= '<input type="hidden" name="instancesNames[]" value="'.$instanceName.'" />';
                }
                $msg .= 'Click <button type="submit" class="btn btn-danger">here</button> to delete all instances !<br />';
                $msg .= '</form>';
            }
            $msg .= "The following instances are erroneous:<br/><ul>";
            $msg .= implode("\n", $errors);
            $msg .= "</ul>";
            return new MoufValidatorResult(MoufValidatorResult::ERROR, $msg);
        } else {
            return new MoufValidatorResult(MoufValidatorResult::SUCCESS, "All your instances are associated with existing classes.");
        }

    }
423614
static function load($class_name, $object_id, $version)
	{
		static $cache = array();
		$hash = '__load:'.$class_name.'-'.$object_id.'-'.$version;
		if(!empty($cache[$hash]))
			return $cache[$hash];

		$object = bors_load($class_name, $object_id);
//		echo $object;
		foreach(bors_find_all(__CLASS__, array(
			'target_class_name' => $class_name,
			'target_id' => $object_id,
			'target_version' => $version,
		)) as $x)
		{
//			echo "{$x->property_name()} = {$x->value()}<br/>\n";
			$object->set_attr('versioning_properties',
				array_merge(
					$object->attr('versioning_properties', array()),
					array($x->property_name() => $object->get($x->property_name()))
				)
			);

			$object->set($x->property_name(), $x->value(), false);
//			$object->set_attr('versioning_property', $x->property_name());
		}

		return $cache[$hash] = $object;
	}
437202
function all($limit1=NULL, $limit2=NULL)
	{
		$args = func_get_args();

		require_once BORS_CORE.'/inc/functions/debug/timing_start.php';
		bors_debug::timing_start('bors_find::all()');

		if(count($args) == 1)
			// Формат all($limit)
			$this->_where['*limit'] = $limit1;
		elseif(count($args) == 2)
			// Формат all($page, $items_per_page)
			$this->_where['*limit'] = array(($limit1-1)*$limit2, $limit2);

		$init = new $this->_class_name(NULL);
		$class_file = bors_class_loader::load_file($this->_class_name);
		$init->set_class_file($class_file);

		$s = $init->storage();

		$this->_where['*by_id'] = true;

		$objects = $s->load_array($init, $this->_where);

		config_set('debug.trace_queries', NULL);

		bors_debug::timing_stop('bors_find::all()');

		if(config('debug_objects_create_counting_details'))
		{
			debug_count_inc($this->_class_name.': bors_find::all()_calls');
			debug_count_inc($this->_class_name.': bors_find::all()_total', count($objects));
		}

		if($this->_preload)
		{
			bors_debug::timing_start('bors_find::all()_preload');
			foreach($preload as $x)
				if(preg_match('/^(\w+)\((\w+)\)$/', $x, $m))
					bors_objects_preload($objects, $m[2], $m[1]);
			bors_debug::timing_stop('bors_find::all()_preload');
		}

		return $objects;
	}
381651
function tpl_key_data($attrib)
    {
        $out   = '';
        $table = new html_table(array('cols' => 2));

        // Key user ID
        $table->add('title', $this->enigma->gettext('keyuserid'));
        $table->add(null, rcube::Q($this->data->name));

        // Key ID
        $table->add('title', $this->enigma->gettext('keyid'));
        $table->add(null, $this->data->subkeys[0]->get_short_id());

        // Key type
        $keytype = $this->data->get_type();
        if ($keytype == enigma_key::TYPE_KEYPAIR) {
            $type = $this->enigma->gettext('typekeypair');
        }
        else if ($keytype == enigma_key::TYPE_PUBLIC) {
            $type = $this->enigma->gettext('typepublickey');
        }
        $table->add('title', $this->enigma->gettext('keytype'));
        $table->add(null, $type);

        // Key fingerprint
        $table->add('title', $this->enigma->gettext('fingerprint'));
        $table->add(null, $this->data->subkeys[0]->get_fingerprint());

        $out .= html::tag('fieldset', null,
            html::tag('legend', null,
                $this->enigma->gettext('basicinfo')) . $table->show($attrib));

        // Subkeys
        $table = new html_table(array('cols' => 5, 'id' => 'enigmasubkeytable', 'class' => 'records-table'));

        $table->add_header('id', $this->enigma->gettext('subkeyid'));
        $table->add_header('algo', $this->enigma->gettext('subkeyalgo'));
        $table->add_header('created', $this->enigma->gettext('subkeycreated'));
        $table->add_header('expires', $this->enigma->gettext('subkeyexpires'));
        $table->add_header('usage', $this->enigma->gettext('subkeyusage'));

        $now         = time();
        $date_format = $this->rc->config->get('date_format', 'Y-m-d');
        $usage_map   = array(
            enigma_key::CAN_ENCRYPT      => $this->enigma->gettext('typeencrypt'),
            enigma_key::CAN_SIGN         => $this->enigma->gettext('typesign'),
            enigma_key::CAN_CERTIFY      => $this->enigma->gettext('typecert'),
            enigma_key::CAN_AUTHENTICATE => $this->enigma->gettext('typeauth'),
        );

        foreach ($this->data->subkeys as $subkey) {
            $algo = $subkey->get_algorithm();
            if ($algo && $subkey->length) {
                $algo .= ' (' . $subkey->length . ')';
            }

            $usage = array();
            foreach ($usage_map as $key => $text) {
                if ($subkey->usage & $key) {
                    $usage[] = $text;
                }
            }

            $table->add('id', $subkey->get_short_id());
            $table->add('algo', $algo);
            $table->add('created', $subkey->created ? $this->rc->format_date($subkey->created, $date_format, false) : '');
            $table->add('expires', $subkey->expires ? $this->rc->format_date($subkey->expires, $date_format, false) : $this->enigma->gettext('expiresnever'));
            $table->add('usage', implode(',', $usage));
            $table->set_row_attribs($subkey->revoked || ($subkey->expires && $subkey->expires < $now) ? 'deleted' : '');
        }

        $out .= html::tag('fieldset', null,
            html::tag('legend', null,
                $this->enigma->gettext('subkeys')) . $table->show());

        // Additional user IDs
        $table = new html_table(array('cols' => 2, 'id' => 'enigmausertable', 'class' => 'records-table'));

        $table->add_header('id', $this->enigma->gettext('userid'));
        $table->add_header('valid', $this->enigma->gettext('uservalid'));

        foreach ($this->data->users as $user) {
            $username = $user->name;
            if ($user->comment) {
                $username .= ' (' . $user->comment . ')';
            }
            $username .= ' <' . $user->email . '>';

            $table->add('id', rcube::Q(trim($username)));
            $table->add('valid', $this->enigma->gettext($user->valid ? 'valid' : 'unknown'));
            $table->set_row_attribs($user->revoked || !$user->valid ? 'deleted' : '');
        }

        $out .= html::tag('fieldset', null,
            html::tag('legend', null,
                $this->enigma->gettext('userids')) . $table->show());

        return $out;
    }
907174
public function getMethodId($context_self = null)
    {
        if ($this->function instanceof ClassMethod) {
            $function_name = (string)$this->function->name;

            return ($context_self ?: $this->source->getFQCLN()) . '::' . strtolower($function_name);
        }

        if ($this->function instanceof Function_) {
            $namespace = $this->source->getNamespace();

            return ($namespace ? strtolower($namespace) . '\\' : '') . strtolower($this->function->name->name);
        }

        return $this->getFilePath()
            . ':' . $this->function->getLine()
            . ':' . (int)$this->function->getAttribute('startFilePos')
            . ':-:closure';
    }
159545
public function getClass_v2() {
		$class = new StdClass;

		// Name
		$class->Name = new StdClass;
		$class->Name->name1 = $this->getName();
		if($this->getName2() !== null)
			$class->Name->name2 = $this->getName2();
		if($this->getName3() !== null)
			$class->Name->name3 = $this->getName3();

		// Address
		$class->Address = new StdClass;
		$class->Address->streetName = $this->getStreetName();
		$class->Address->streetNumber = $this->getStreetNumber();
		if($this->getAddressAddition() !== null)
			$class->Address->addressAddition = $this->getAddressAddition();
		if($this->getDispatchingInfo() !== null)
			$class->Address->dispatchingInformation = $this->getDispatchingInfo();
		$class->Address->zip = $this->getZip();
		$class->Address->city = $this->getLocation();

		// Origin
		if($this->getCountryISOCode() !== null) {
			$class->Address->Origin = new StdClass;
			if($this->getCountry() !== null)
				$class->Address->Origin->country = $this->getCountry();
			$class->Address->Origin->countryISOCode = $this->getCountryISOCode();
			if($this->getState() !== null)
				$class->Address->Origin->state = $this->getState();
		}

		// Communication
		$class->Communication = new StdClass;
		if($this->getPhone() !== null)
			$class->Communication->phone = $this->getPhone();
		if($this->getEmail() !== null)
			$class->Communication->email = $this->getEmail();
		if($this->getContactPerson() !== null)
			$class->Communication->contactPerson = $this->getContactPerson();

		return $class;
	}
1285047
public function get_static_view_template_name() {
		// @codingStandardsIgnoreStart
		// @todo サニタイズしているのに Detected usage of a non-validated input variable: $_SERVER がでる。バグ？
		$request_uri = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) );
		// @codingStandardsIgnoreEnd
		$request_uri = $this->_get_relative_path( $request_uri );
		$path        = $this->_remove_http_query( $request_uri );
		$path        = $this->_remove_paged_slug( $path );
		$path        = trim( $path, '/' );

		if ( ! $path ) {
			return Helper\locate_template( (array) Helper\config( 'static' ), 'index' );
		}

		$template_name = Helper\locate_template( (array) Helper\config( 'static' ), $path );
		if ( empty( $template_name ) ) {
			$template_name = Helper\locate_template( (array) Helper\config( 'static' ), $path . '/index' );
		}

		return $template_name;
	}
219355
public function build(): self
    {
        $subject = config('app.name').' | '.config('comments.mails_admins.subject', 'Новый комментарий');
        $headers = config('comments.mails_admins.headers', []);

        $to = config('comments.mails_admins.to');

        return $this->from(config('mail.from.address'), config('mail.from.name'))
            ->to($to, '')
            ->subject($subject)
            ->withSwiftMessage(function ($message) use ($headers) {
                $messageHeaders = $message->getHeaders();

                foreach ($headers as $header => $value) {
                    $messageHeaders->addTextHeader($header, $value);
                }
            })
            ->view('admin.module.comments::mails.comment_admins', ['item' => $this->item]);
    }
689683
private function classes(): string
    {
        $classes = '';

        if ($this->style !== null) {
            $classes .= ' btn-' . $this->style;
        }

        if ($this->large === true) {
            $classes .= ' btn-lg';
        }

        if ($this->small === true) {
            $classes .= ' btn-sm';
        }

        if ($this->extra_small === true) {
            $classes .= ' btn-xs';
        }

        if ($this->block === true) {
            $classes .= ' btn-block';
        }

        if ($this->active === true) {
            $classes .= ' active';
        }

        if (count($this->custom_classes) > 0) {
            $classes .= ' ' . implode(' ', $this->custom_classes);
        }

        return $classes;
    }
726568
static function load_multi_array($class_names, $fields, $where)
	{
		$union	= array();
		$post	= array();
		foreach($class_names as $class_name)
		{
			$foo = new $class_name(NULL);
			$db_name = $foo->db_name();
			$dbh = new driver_mysql($db_name);
			$table_name = $foo->table_name();
			$class_file = $foo->class_file();
			$where['*fields'] = $fields;
			list($select, $where, $post_functions) = self::__query_data_prepare($foo, $where);

			if(count($select) != count($fields))
				bors_throw(ec('У класса ').$class_name
					.ec(' не хватает нужных полей. В наличии только ').join(', ', $select)
					.ec(' при необходимых ').join(', ', $fields));

			$select[] = "'$class_name' AS `class_name`";
			$post[$class_name] = $post_functions;
			$union[] = array($table_name, join(',', $select), $where, $class_name);
		}

		$datas = $dbh->union_select_array($union);
		$objects = array();

		foreach($datas as $data)
		{
			$class_name = $data['class_name'];
			$object = new $class_name(NULL);
//			$object->set_class_file($class_file);
			$object->set_id(@$data['id']);
			$object->data = $data;

			$object->set_is_loaded(true);

			if(!empty($post[$class_name]))
				self::post_functions_do($object, $post[$class_name]);

			$objects[] = $object;

			save_cached_object($object);
		}

		return $objects;
	}
1012019
public function updateFileInfo()
    {
        $src = $this->src;

        if ($this->cluster instanceof ClusterLocal) {
            if (!\Yii::$app->request->hostInfo) {
                return $this;
            }

            $src = \Yii::$app->request->hostInfo . $this->src;
        }
        //Елси это изображение
        if ($this->isImage()) {
            if (extension_loaded('gd')) {
                list($width, $height, $type, $attr) = getimagesize($src);
                $this->image_height = $height;
                $this->image_width = $width;
            }
        }

        $this->save();
        return $this;
    }
1097321
function klassNames_() {
  var bKlass = [];

  for (var i = 0; i < arguments.length; i++) {
    var arg = arguments[i];
    if (!arg) continue;

    var argType = typeof arg === 'undefined' ? 'undefined' : _typeof(arg);
    if (argType === 'string' || argType === 'number') bKlass.push(arg);else if (Array.isArray(arg)) bKlass.push(klassNames_.apply(null, arg));else if (argType === 'object') {
      for (var key in arg) {
        if (hasOwn_.call(arg, key) && arg[key]) bKlass.push(key);
      }
    }
  }

  return bKlass.join(' ');
}