Classes/Utility/SitemapUtility.php
public static function index(array $pageData)
    {
        static $cache = array();

        // do not index empty urls
        if (empty($pageData['page_url'])) {
            return;
        }

        // Trim url
        $pageData['page_url'] = trim($pageData['page_url']);

        // calc page hash
        $pageData['page_hash'] = md5($pageData['page_url']);
        $pageHash              = $pageData['page_hash'];

        // set default type if not set
        if (!isset($pageData['page_type'])) {
            $pageData['page_type'] = self::SITEMAP_TYPE_PAGE;
        }

        // Escape/Quote data
        foreach ($pageData as &$pageDataValue) {
            if ($pageDataValue === null) {
                $pageDataValue = 'NULL';
            } elseif (is_int($pageDataValue) || is_numeric($pageDataValue)) {
                // Don't quote numeric/integers
                $pageDataValue = (int)$pageDataValue;
            } else {
                // String
                $pageDataValue = DatabaseUtility::quote($pageDataValue, 'tx_metaseo_sitemap');
            }
        }
        unset($pageDataValue);

        // only process each page once to keep sql-statements at a normal level
        if (empty($cache[$pageHash])) {
            // $pageData is already quoted

            $query      = 'SELECT uid
                             FROM tx_metaseo_sitemap
                            WHERE page_uid      = ' . $pageData['page_uid'] . '
                              AND page_language = ' . $pageData['page_language'] . '
                              AND page_hash     = ' . $pageData['page_hash'] . '
                              AND page_type     = ' . $pageData['page_type'];
            $sitemapUid = DatabaseUtility::getOne($query);

            if (!empty($sitemapUid)) {
                $query = 'UPDATE tx_metaseo_sitemap
                             SET tstamp                = ' . $pageData['tstamp'] . ',
                                 page_rootpid          = ' . $pageData['page_rootpid'] . ',
                                 page_language         = ' . $pageData['page_language'] . ',
                                 page_url              = ' . $pageData['page_url'] . ',
                                 page_depth            = ' . $pageData['page_depth'] . ',
                                 page_change_frequency = ' . $pageData['page_change_frequency'] . ',
                                 page_type             = ' . $pageData['page_type'] . ',
                                 expire                = ' . $pageData['expire'] . '
                           WHERE uid = ' . (int)$sitemapUid;
                DatabaseUtility::exec($query);
            } else {
                // #####################################
                // INSERT
                // #####################################
                DatabaseUtility::connection()->exec_INSERTquery(
                    'tx_metaseo_sitemap',
                    $pageData,
                    array_keys($pageData)
                );
            }

            $cache[$pageHash] = 1;
        }
    }
public static function index(array $pageData)
    {
        static $cache = array();

        // do not index empty urls
        if (empty($pageData['page_url'])) {
            return;
        }

        // Trim url
        $pageData['page_url'] = trim($pageData['page_url']);

        // calc page hash
        $pageData['page_hash'] = md5($pageData['page_url']);
        $pageHash              = $pageData['page_hash'];

        // set default type if not set
        if (!isset($pageData['page_type'])) {
            $pageData['page_type'] = self::SITEMAP_TYPE_PAGE;
        }

        // Escape/Quote data
        foreach ($pageData as &$pageDataValue) {
            if ($pageDataValue === null) {
                $pageDataValue = 'NULL';
            } elseif (is_int($pageDataValue) || is_numeric($pageDataValue)) {
                // Don't quote numeric/integers
                $pageDataValue = (int)$pageDataValue;
            } else {
                // String
                $pageDataValue = DatabaseUtility::quote($pageDataValue, 'tx_metaseo_sitemap');
            }
        }
        unset($pageDataValue);

        // only process each page once to keep sql-statements at a normal level
        if (empty($cache[$pageHash])) {
            // $pageData is already quoted

            $query      = 'SELECT uid
                             FROM tx_metaseo_sitemap
                            WHERE page_uid      = ' . $pageData['page_uid'] . '
                              AND page_language = ' . $pageData['page_language'] . '
                              AND page_hash     = ' . $pageData['page_hash'] . '
                              AND page_type     = ' . $pageData['page_type'];
            $sitemapUid = DatabaseUtility::getOne($query);

            if (!empty($sitemapUid)) {
                $query = 'UPDATE tx_metaseo_sitemap
                             SET tstamp                = ' . $pageData['tstamp'] . ',
                                 page_rootpid          = ' . $pageData['page_rootpid'] . ',
                                 page_language         = ' . $pageData['page_language'] . ',
                                 page_url              = ' . $pageData['page_url'] . ',
                                 page_depth            = ' . $pageData['page_depth'] . ',
                                 page_change_frequency = ' . $pageData['page_change_frequency'] . ',
                                 page_type             = ' . $pageData['page_type'] . ',
                                 expire                = ' . $pageData['expire'] . '
                           WHERE uid = ' . (int)$sitemapUid;
                DatabaseUtility::exec($query);
            } else {
                // #####################################
                // INSERT
                // #####################################
                DatabaseUtility::connection()->exec_INSERTquery(
                    'tx_metaseo_sitemap',
                    $pageData,
                    array_keys($pageData)
                );
            }

            $cache[$pageHash] = 1;
        }
    }
public static function index ( array $ pageData ) { static $ cache = array ( ) ; // do not index empty urls if ( empty ( $ pageData [ 'page_url' ] ) ) { return ; } // Trim url $ pageData [ 'page_url' ] = trim ( $ pageData [ 'page_url' ] ) ; // calc page hash $ pageData [ 'page_hash' ] = md5 ( $ pageData [ 'page_url' ] ) ; $ pageHash = $ pageData [ 'page_hash' ] ; // set default type if not set if ( ! isset ( $ pageData [ 'page_type' ] ) ) { $ pageData [ 'page_type' ] = self :: SITEMAP_TYPE_PAGE ; } // Escape/Quote data foreach ( $ pageData as & $ pageDataValue ) { if ( $ pageDataValue === null ) { $ pageDataValue = 'NULL' ; } elseif ( is_int ( $ pageDataValue ) || is_numeric ( $ pageDataValue ) ) { // Don't quote numeric/integers $ pageDataValue = ( int ) $ pageDataValue ; } else { // String $ pageDataValue = DatabaseUtility :: quote ( $ pageDataValue , 'tx_metaseo_sitemap' ) ; } } unset ( $ pageDataValue ) ; // only process each page once to keep sql-statements at a normal level if ( empty ( $ cache [ $ pageHash ] ) ) { // $pageData is already quoted $ query = 'SELECT uid
                             FROM tx_metaseo_sitemap
                            WHERE page_uid      = ' . $ pageData [ 'page_uid' ] . '
                              AND page_language = ' . $ pageData [ 'page_language' ] . '
                              AND page_hash     = ' . $ pageData [ 'page_hash' ] . '
                              AND page_type     = ' . $ pageData [ 'page_type' ] ; $ sitemapUid = DatabaseUtility :: getOne ( $ query ) ; if ( ! empty ( $ sitemapUid ) ) { $ query = 'UPDATE tx_metaseo_sitemap
                             SET tstamp                = ' . $ pageData [ 'tstamp' ] . ',
                                 page_rootpid          = ' . $ pageData [ 'page_rootpid' ] . ',
                                 page_language         = ' . $ pageData [ 'page_language' ] . ',
                                 page_url              = ' . $ pageData [ 'page_url' ] . ',
                                 page_depth            = ' . $ pageData [ 'page_depth' ] . ',
                                 page_change_frequency = ' . $ pageData [ 'page_change_frequency' ] . ',
                                 page_type             = ' . $ pageData [ 'page_type' ] . ',
                                 expire                = ' . $ pageData [ 'expire' ] . '
                           WHERE uid = ' . ( int ) $ sitemapUid ; DatabaseUtility :: exec ( $ query ) ; } else { // ##################################### // INSERT // ##################################### DatabaseUtility :: connection ( ) -> exec_INSERTquery ( 'tx_metaseo_sitemap' , $ pageData , array_keys ( $ pageData ) ) ; } $ cache [ $ pageHash ] = 1 ; } }
Insert into sitemap

@param   array $pageData page information
Insert into sitemap