Locates object inside proxy.

@return void
546643
protected function locateObject()
	{
		if ( $this->locatorUsed ) {
			return;
		}

		// NodeElement + TargetElement = Proxy.
		$this->locatorUsed = true;

		/** @var AbstractTypifiedElementCollection $object */
		$object = call_user_func(
			array($this->className, 'fromNodeElements'),
			$this->locateElements(),
			null,
			$this->pageFactory
		);
		$object->setName($this->getName());

		AbstractElementCollection::offsetSet(null, $object);

		$iterator = $this->getIterator();

		/** @var ITypifiedElement $element */
		foreach ( $iterator as $element ) {
			$element->setName($this->getName());
		}
	}
417606
function getProxy()
    {
        $r       = rand();
        $evalStr = $this->_getProxyClassCode($r);
        //$this->debug("proxy class: $evalStr");
        if ($this->getError()) {
            $this->debug("Error from _getProxyClassCode, so return null");

            return NULL;
        }
        // eval the class
        eval($evalStr);
        // instantiate proxy object
        eval("\$proxy = new nusoap_proxy_$r('');");
        // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
        $proxy->endpointType     = 'wsdl';
        $proxy->wsdlFile         = $this->wsdlFile;
        $proxy->wsdl             = $this->wsdl;
        $proxy->operations       = $this->operations;
        $proxy->defaultRpcParams = $this->defaultRpcParams;
        // transfer other state
        $proxy->soap_defencoding     = $this->soap_defencoding;
        $proxy->username             = $this->username;
        $proxy->password             = $this->password;
        $proxy->authtype             = $this->authtype;
        $proxy->certRequest          = $this->certRequest;
        $proxy->requestHeaders       = $this->requestHeaders;
        $proxy->endpoint             = $this->endpoint;
        $proxy->forceEndpoint        = $this->forceEndpoint;
        $proxy->proxyhost            = $this->proxyhost;
        $proxy->proxyport            = $this->proxyport;
        $proxy->proxyusername        = $this->proxyusername;
        $proxy->proxypassword        = $this->proxypassword;
        $proxy->http_encoding        = $this->http_encoding;
        $proxy->timeout              = $this->timeout;
        $proxy->response_timeout     = $this->response_timeout;
        $proxy->persistentConnection = &$this->persistentConnection;
        $proxy->decode_utf8          = $this->decode_utf8;
        $proxy->curl_options         = $this->curl_options;
        $proxy->bindingType          = $this->bindingType;
        $proxy->use_curl             = $this->use_curl;

        return $proxy;
    }
769241
protected function proxy() {
        if (!$this->context) {
            $this->context = new RecordingSettingsContext($this->version);
        }

        return $this->context;
    }
243115
private function find_proxy_id($data) {
        global $DB;
        $newtoolproxyid = 0;
        $oldtoolproxyguid = $data->guid;
        $oldtoolproxyvendor = $data->vendorcode;

        $dbtoolproxyjsonparams = array('guid' => $oldtoolproxyguid, 'vendorcode' => $oldtoolproxyvendor);
        $dbtoolproxy = $DB->get_field('lti_tool_proxies', 'id', $dbtoolproxyjsonparams, IGNORE_MISSING);
        if ($dbtoolproxy) {
            $newtoolproxyid = $dbtoolproxy;
        }
        return $newtoolproxyid;
    }
1110045
protected function locate() {

		// Don't return a link if embeds don't work. Need media or nothing at all.
		add_filter( 'embed_maybe_make_link', '__return_false' );

		// Get the media if the post type is an attachment.
		if ( 'attachment' === get_post_type( $this->post_id ) ) {
			$this->media = $this->locateSelfMedia();
		}

		// Find media in the post content based on WordPress' media-related shortcodes.
		if ( ! $this->media && $this->shortcodes ) {
			$this->media = $this->locateShortcodeMedia();
		}

		// If no media is found and autoembeds are enabled, check for autoembeds.
		if ( ! $this->media && get_option( 'embed_autourls' ) && $this->autoembeds ) {
			$this->media = $this->locateAutoembedMedia();
		}

		// If no media is found, check for media HTML within the post content.
		if ( ! $this->media && $this->embedded ) {
			$this->media = $this->locatedEmbeddedMedia();
		}

		// If no media is found, check for media attached to the post.
		if ( ! $this->media && $this->attached ) {
			$this->media = $this->locateAttachedMedia();
		}

		// If media is found, let's run a few things.
		if ( $this->media ) {

			// Split the media from the content.
			if ( true === $this->split && ! empty( $this->original_media ) ) {
				add_filter( 'the_content', [ $this, 'split' ], 5 );
			}

			// Filter the media dimensions and add the before/after HTML.
			$this->media = $this->before . $this->filterDimensions( $this->media ) . $this->after;
		}

		// Remove our filter from earlier.
		remove_filter( 'embed_maybe_make_link', '__return_false' );

		return $this->media;
	}
554330
public function initializeObject($obj)
    {
        if ($obj instanceof Proxy) {
            $obj->__load();
        } elseif ($obj instanceof PersistentCollectionInterface) {
            $obj->initialize();
        }
    }
166866
protected function proxy() {
        if (!$this->context) {
            $this->context = new FieldContext(
                $this->version,
                $this->solution['assistantSid'],
                $this->solution['taskSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
1082637
protected function proxy() {
        if (!$this->context) {
            $this->context = new SampleContext(
                $this->version,
                $this->solution['assistantSid'],
                $this->solution['taskSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
995439
function proxy()
    {
        if (!UserRights(EDITOR))
            die;

        $filename = Eresus_CMS::getLegacyKernel()->request['path'] .
            Eresus_CMS::getLegacyKernel()->request['file'];
        $filename = Eresus_CMS::getLegacyKernel()->froot . substr($filename,
                strlen(Eresus_CMS::getLegacyKernel()->root));

        if (is_dir($filename))
        {
            $filename = Eresus_FS_Tool::normalize($filename . '/index.php');
        }

        if (!is_file($filename))
        {
            header('Not found', true, 404);
            die('<h1>Not found.</h1>');
        }

        $ext = strtolower(substr($filename, strrpos($filename, '.') + 1));

        switch (true)
        {
            case in_array($ext, array('png', 'jpg', 'jpeg', 'gif')):
                $info = getimagesize($filename);
                header('Content-type: '.$info['mime']);
                echo file_get_contents($filename);
                break;

            case $ext == 'js':
                header('Content-type: text/javascript');
                $s = file_get_contents($filename);
                $s = $this->replaceMacros($s);
                echo $s;
                break;

            case $ext == 'css':
                header('Content-type: text/css');
                $s = file_get_contents($filename);
                $s = $this->replaceMacros($s);
                echo $s;
                break;

            case $ext == 'html':
            case $ext == 'htm':
                header('Content-type: text/html');
                $s = file_get_contents($filename);
                $s = $this->replaceMacros($s);
                echo $s;
                break;

            case $ext == 'php':
                Eresus_CMS::getLegacyKernel()->conf['debug']['enable'] = false;
                restore_error_handler();
                chdir(dirname($filename));
                require $filename;
                break;
        }
    }
878192
protected function replaceProxy($offset)
    {
        $object = $this->getObject();

        /**
         * 0: LazyProxy::replaceProxy()
         * 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)
         *    2: Frame that accesses $name
         * 1: LazyProxy::__call($method, $arguments)
         * 2: LazyProxy::$method()
         *    3: Frame that invokes $method
         */
        $trace = debug_backtrace();

        if (isset($trace[$offset]['object'])) {
            $reflector = new \ReflectionObject($trace[$offset]['object']);

            foreach ($reflector->getProperties() as $property) {
                $property->setAccessible(true);

                if ($property->getValue($trace[$offset]['object']) === $this) {
                    $property->setValue($trace[$offset]['object'], $object);
                    break;
                }
            }
        }

        return $object;
    }
723653
protected function _place_objects()
    {

        foreach ($this->_objs as $obj => $props) {
            $start = $props["start_page"];
            $where = $props["where"];

            // Place the object on this page if required
            if ($this->_page_number >= $start &&
                (($this->_page_number % 2 == 0 && $where === "even") ||
                    ($this->_page_number % 2 == 1 && $where === "odd") ||
                    ($where === "all"))
            ) {
                $this->_pdf->fit_image($obj, 0, 0, "");
            }
        }

    }
1313160
private function prepareLocateDataObject()
    {
        $fragment = new CNabuPHPMethodBuilder(
            $this, 'locateDataObject', CNabuPHPMethodBuilder::METHOD_PROTECTED,
            false, false, false, true, 'bool'
        );
        $fragment->addComment("Locate a Data Object.");
        $fragment->addComment("@return bool Returns true if the Data Object found or false if not.");

        $fragment->addParam(
            'element', 'SimpleXMLElement', false, null, 'SimpleXMLElement', 'Element to locate the Data Object.'
        );
        $fragment->addParam(
            'data_parent', 'CNabuDataObject', true, null, 'CNabuDataObject', 'Data Parent object.'
        );

        $fragment->addFragment(array(
            '$retval = false;',
            '',
            "if (isset(\$element['GUID'])) {",
            "    \$guid = (string)\$element['GUID'];",
            "    if (!(\$this->nb_data_object instanceof $this->class_data_name)) {",
            "        \$this->nb_data_object = $this->class_data_name::findByHash(\$guid);",
            '    } else {',
            '        $this->nb_data_object = null;',
            '    }',
            '',
            "    if (!(\$this->nb_data_object instanceof $this->class_data_name)) {",
            "        \$this->nb_data_object = new $this->class_data_name();",
            "        \$this->nb_data_object->setHash(\$guid);",
            '    }',
            '    $retval = true;',
            '}',
            '',
            'return $retval;'
        ));

        $this->getDocument()->addUse('\nabu\data\CNabuDataObject');
        $this->getDocument()->addUse("\\$this->class_data_namespace\\$this->class_data_name");
        $this->getDocument()->addUse('\SimpleXMLElement');

        $this->addFragment($fragment);
    }
1097058
protected function proxy() {
        if (!$this->context) {
            $this->context = new InstalledAddOnContext($this->version, $this->solution['sid']);
        }

        return $this->context;
    }
154904
protected function proxy() {
        if (!$this->context) {
            $this->context = new CompositionHookContext($this->version, $this->solution['sid']);
        }

        return $this->context;
    }
646877
protected function _place_objects() {
		//Helpers::dompdf_debug("trace", "()");

		foreach ($this->_objs as $obj=>$props) {
			//var_dump($props);

			$start = $props["start_page"];
			$where = $props["where"];

			// Place the object on this page if required
			$page_number = $this->_pdf->PageNo();
			if ($page_number >= $start &&
			(($page_number % 2 == 0 && $where == "even") ||
			($page_number % 2 == 1 && $where == "odd") ||
			($where == "all"))) {
				$data = $this->_pdf->getObject($obj);
				//Helpers::dompdf_debug("trace", "object data = " . $data['c']);
				$this->_pdf->setPageBuffer($page_number, $data['c'], true);
			}
		}

	}
615265
private function loadLocation(): ?Location
    {
        if (!$this->context->has('ez_location_id')) {
            return null;
        }

        return $this->locationService->loadLocation(
            (int) $this->context->get('ez_location_id')
        );
    }
340287
protected function proxy() {
        if (!$this->context) {
            $this->context = new AvailableAddOnContext($this->version, $this->solution['sid']);
        }

        return $this->context;
    }