/*!
\static
Fetches complete list of RSS Exports.
493108
static function fetchList( $asObject = true )
    {
        return eZPersistentObject::fetchObjectList( eZRSSExport::definition(),
                                                    null, array( 'status' => self::STATUS_VALID ), null, null,
                                                    $asObject );
    }
63338
public function export()
	{
		$result = [];
		foreach ($this->getListBuilder()->getResult() as $item) {
			foreach ($item->getFields() as $field) {
				$value = $field->getValue();

				if (!is_string($value)) {
					$value = $value->toArray();
				}

				$result[$item->getIdentifier()][$field->getName()] = $value;
			}
		}

		$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><response/>');
		$this->arrayToXml($result, $xml);

		return $this->createResponse($xml->asXML());
	}
911397
private function getOpenGraph(): array {
        $results = array();

        $nodes = $this->article()->getDoc()->find('meta[property^="og:"]');

        foreach ($nodes as $node) {
            $property = explode(':', $node->attr('property'));
            array_shift($property);
            $results[implode(':', $property)] = $node->attr('content');
        }

        // Additionally retrieve type values based on provided og:type (http://ogp.me/#types)
        if (isset($results['type'])) {
            $nodes = $this->article()->getDoc()->find('meta[property^="' . $results['type'] .':"]');

            foreach ($nodes as $node) {
                $property = explode(':', $node->attr('property'));
                array_shift($property);
                $results[implode(':', $property)] = $node->attr('content');
            }
        }

        return $results;
    }
373632
private function fetchContentAttributes()
    {
        $returnAttributeArray = array();

        $identifierArray = $this->getIdentifiers( $this->origNamePattern );

        $attributes = $this->contentObject->fetchAttributesByIdentifier( $identifierArray, $this->version, array( $this->translation ) );

        if ( is_array( $attributes ) )
        {
            foreach ( $attributes as $attribute )
            {
                $identifier = $attribute->contentClassAttributeIdentifier();
                $returnAttributeArray[$identifier] = $attribute->title();
            }
        }
        else
        {
            $returnAttributeArray = array();
        }
        $this->attributeArray = $returnAttributeArray;
    }
39727
public static function getAssets(){

    // first call? include styles and javascript
    if(static::$didAssets)
      return '';

    ob_start();

    if(ref::config('stylePath') !== false){
      ?>
      <style scoped>
        <?php readfile(str_replace('{:dir}', __DIR__, ref::config('stylePath'))); ?>
      </style>
      <?php
    }

    if(ref::config('scriptPath') !== false){
      ?>
      <script>
        <?php readfile(str_replace('{:dir}', __DIR__, ref::config('scriptPath'))); ?>
      </script>
      <?php
    }

    // normalize space and remove comments
    $output = preg_replace('/\s+/', ' ', trim(ob_get_clean()));
    $output = preg_replace('!/\*.*?\*/!s', '', $output);
    $output = preg_replace('/\n\s*\n/', "\n", $output);

    static::$didAssets = true;
    return $output;
  }
1030374
static function exportByNode( $nodeID )
    {
        if ( !$nodeID )
            return array( 'error' => array( 'error_type' => 'kernel',
                                            'error_code' => eZError::KERNEL_NOT_FOUND ) );

        $rssExport = eZPersistentObject::fetchObject( eZRSSExport::definition(),
                                                null,
                                                array( 'node_id' => $nodeID,
                                                       'status' => eZRSSExport::STATUS_VALID ),
                                                true );

        return array( 'result' => $rssExport );
    }
91120
static function fetchList( $asObject = true, $offset = false, $limit = false )
    {
        $sql = "SELECT * FROM ezcontentobject_tree";
        $parameters = array();
        if ( $offset !== false )
            $parameters['offset'] = $offset;
        if ( $limit !== false )
            $parameters['limit'] = $limit;
        $db = eZDB::instance();
        $rows = $db->arrayQuery( $sql, $parameters );
        $nodes = array();
        if ( $asObject )
        {
            foreach ( $rows as $row )
            {
                $nodes[] = new eZContentObjectTreeNode( $row );
            }
            return $nodes;
        }
        else
            return $rows;
    }
697968
public function getSupportedReportSet($uri)
    {
        $node = $this->server->tree->getNodeForPath($uri);
        if ($node instanceof ISyncCollection && $node->getSyncToken()) {
            return [
                '{DAV:}sync-collection',
            ];
        }

        return [];
    }
480452
protected function getExports()
	{
		if (empty($this->exports))
		{
			return '';
		}

		$exports = [];
		foreach ($this->exports as $export)
		{
			$exports[] = "'" . $export . "':" . $export;
		}
		sort($exports);

		return "window['s9e']['TextFormatter'] = {" . implode(',', $exports) . '}';
	}
753212
public function getRSS()
    {
        $this->checkValidity();

        if (!$this->valid) {
            $this->createRSS();
        }

        if ($this->sendHeader) {
            header('Content-type: application/rss+xml; charset=UTF-8');
        }

        readfile($this->rssFile);
    }
479861
public function getFormatters()
    {
        if (null === static::$formatters) {
            static::$formatters = array();
            $dirs = array();
            // if we'are using Composer, include these formatters
            if ($composer = $this->getComposer()) {
                $vendorDir = realpath(__DIR__.'/../../../..');
                if (is_readable($installed = $vendorDir.'/composer/installed.json')) {
                    $packages = json_decode(file_get_contents($installed), true);
                    foreach ($packages as $package) {
                        if (isset($package['name']) && is_dir($dir = $vendorDir.DIRECTORY_SEPARATOR.$package['name'])) {
                            /**
                             * Check for extended package extra attribute to customize
                             * formatter inclusion.
                             *
                             * An example to include formatter using class:
                             * {
                             *     "extra" : {
                             *         "mysql-workbench-schema-exporter" : {
                             *             "formatters" : {
                             *                 "my-simple" : "\\My\\Simple\\Formatter",
                             *                 "my-simple2" : "\\My\\Simple2\\Formatter"
                             *             }
                             *         }
                             *     }
                             * }
                             *
                             * An example include formatter using namespace:
                             * {
                             *     "extra" : {
                             *         "mysql-workbench-schema-exporter" : {
                             *             "namespaces" : {
                             *                 "lib/My/Exporter" : "\\Acme\\My\\Exporter",
                             *             }
                             *         }
                             *     }
                             * }
                             */
                            if (isset($package['extra']) && isset($package['extra']['mysql-workbench-schema-exporter'])) {
                                if (is_array($options = $package['extra']['mysql-workbench-schema-exporter'])) {
                                    if (isset($options['formatters']) && is_array($options['formatters'])) {
                                        foreach ($options['formatters'] as $name => $class) {
                                            $this->registerFormatter($name, $class);
                                        }
                                    }
                                    if (isset($options['namespaces']) && is_array($options['namespaces'])) {
                                        foreach ($options['namespaces'] as $lib => $namespace) {
                                            $dirs[$dir.DIRECTORY_SEPARATOR.$lib] = $namespace;
                                        }
                                    }
                                    continue;
                                }
                            }
                            $dirs[] = $dir;
                        }
                    }
                }
            } else {
                $dirs[] = realpath(__DIR__.'/../..');
            }
            $this->scanFormatters($dirs);
        }

        return static::$formatters;
    }
1348424
static function get( $what = 'next', $return_post_id = false, $admin_mode = false ) {

		if ( 'first' === $what ) {
			return static::getFirst( $return_post_id, $admin_mode );
		}

		global $blog_id;

		global $post;

		$current_post_id = $post->ID;
		$book_structure = static::getBookStructure();
		$order = $book_structure['__order'];
		$pos = array_keys( $order );

		$what = ( 'next' === $what ? 'next' : 'prev' );

		// Move internal pointer to correct position
		reset( $pos );
		while ( $find_me = current( $pos ) ) {
			if ( (int) $find_me === (int) $current_post_id ) {
				break;
			} else {
				next( $pos );
			}
		}

		// Get next/previous
		$what( $pos );
		while ( $post_id = current( $pos ) ) {
			if ( $admin_mode ) {
				if ( current_user_can( 'edit_post', $post_id ) ) {
					break;
				} else {
					$what( $pos );
				}
			} else {
				if ( in_array( $order[ $post_id ]['post_status'], [ 'publish', 'web-only' ], true ) ) {
					break;
				} elseif ( current_user_can_for_blog( $blog_id, 'read_private_posts' ) ) {
					break;
				} elseif ( get_option( 'permissive_private_content' ) && current_user_can_for_blog( $blog_id, 'read' ) ) {
					break;
				} else {
					$what( $pos );
				}
			}
		}

		if ( $return_post_id ) {
			return (int) $post_id;
		} else {
			return ( empty( $post_id ) ) ? '/' : get_permalink( $post_id );
		}
	}
212143
static function fetchCountryList()
    {
        if ( isset( $GLOBALS['CountryList'] ) )
            return $GLOBALS['CountryList'];

        $ini = eZINI::instance( 'country.ini' );
        $countries = $ini->getNamedArray();
        eZCountryType::fetchTranslatedNames( $countries );
        $GLOBALS['CountryList'] = $countries;
        return $countries;
    }
712413
public static function extractImports($css)
    {
        $imports = [];
        preg_match_all(static::IMPORT_PATTERN, $css, $matches, PREG_SET_ORDER);
        if (empty($matches)) {
            return $imports;
        }
        foreach ($matches as $match) {
            $url = empty($match[2]) ? $match[4] : $match[2];
            $imports[] = $url;
        }
        return $imports;
    }
467925
public function rss()
    {
        $this->blogPosts = $this->getBlogPosts()->limit($this->PostsPerPage);

        $rss = new RSSFeed($this->blogPosts, $this->Link(), $this->Title, $this->MetaDescription);

        $this->extend('updateRss', $rss);

        return $rss->outputToBrowser();
    }
454336
public function export()
    {
        $rows = [];
        foreach ($this->messages as $message) {
            list($text, $level, $category, $timestamp) = $message;
            if (!is_string($text)) {
                // exceptions may not be serializable if in the call stack somewhere is a Closure
                if ($text instanceof \Throwable || $text instanceof \Exception) {
                    $text = (string) $text;
                } else {
                    $text = VarDumper::export($text);
                }
            }
            $rows[] = [
                'level' => $level,
                'category' => $category,
                'log_time' => $timestamp,
                'prefix' => $this->getMessagePrefix($message),
                'message' => $text,
            ];
        }

        $this->db->getCollection($this->logCollection)->batchInsert($rows);
    }
727001
private function makeItems()
    {
        $out = '';

        foreach ($this->items as $item) {
            $thisItems = $item->getElements();

            // The argument is printed as rdf:about attribute of item in RSS 1.0
            // We're using the link set in the item (which is mandatory) as the about attribute.
            if ($this->version == Feed::RSS1)
                $out .= $this->startItem($thisItems['link']['content']);
            else
                $out .= $this->startItem();

            foreach ($thisItems as $feedItem) {
                $name = $feedItem['name'];

                // Strip all ATOM namespace prefixes from tags when feed is an ATOM feed.
                // Not needed here, because the ATOM namespace name is used as default namespace.
                if ($this->version == Feed::ATOM && strncmp($name, 'atom', 4) == 0)
                    $name = substr($name, 5);

                $out .= $this->makeNode($name, $feedItem['content'], $feedItem['attributes']);
            }
            $out .= $this->endItem();
        }

        return $out;
    }