id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
40,000
marciioluucas/phiber
src/Phiber/ORM/Queries/PhiberQueryWriter.php
PhiberQueryWriter.select
public function select(array $infos) { try { $tabela = $infos['table']; $campos = $infos['fields']; $whereCriteria = $infos['where']; $joins = $infos['join']; $limitCriteria = $infos['limit']; $offsetCriteria = $infos['offset']; $orderByCriteria = $infos['orderby']; $campos = gettype($campos) == "array" ? implode(", ", $campos) : $campos; $this->sql = "SELECT " . $campos . " FROM $tabela"; // responsável por montar JOIN if (!empty($joins)) { for ($i = 0; $i < count($joins); $i++) { $this->sql .= " " . $joins[$i] . " "; } } // responsável por montar o WHERE. if (!empty($whereCriteria)) { $this->sql .= " WHERE " . $whereCriteria; } // responsável por montar o order by. if (!is_null($orderByCriteria)) { $orderBy = gettype($orderByCriteria) == "array" ? implode(", ", $orderByCriteria) : $orderByCriteria; $this->sql .= " ORDER BY " . $orderBy; } // responsável por montar o limit. if (!empty($limitCriteria)) { $this->sql .= " LIMIT " . $limitCriteria; } // responsável por montar OFFSET if (!empty($offsetCriteria)) { $this->sql .= " OFFSET " . $offsetCriteria; } $this->sql .= ";"; return $this->sql; } catch (PhiberException $phiberException) { throw new PhiberException(new Internationalization("query_processor_error")); } }
php
public function select(array $infos) { try { $tabela = $infos['table']; $campos = $infos['fields']; $whereCriteria = $infos['where']; $joins = $infos['join']; $limitCriteria = $infos['limit']; $offsetCriteria = $infos['offset']; $orderByCriteria = $infos['orderby']; $campos = gettype($campos) == "array" ? implode(", ", $campos) : $campos; $this->sql = "SELECT " . $campos . " FROM $tabela"; // responsável por montar JOIN if (!empty($joins)) { for ($i = 0; $i < count($joins); $i++) { $this->sql .= " " . $joins[$i] . " "; } } // responsável por montar o WHERE. if (!empty($whereCriteria)) { $this->sql .= " WHERE " . $whereCriteria; } // responsável por montar o order by. if (!is_null($orderByCriteria)) { $orderBy = gettype($orderByCriteria) == "array" ? implode(", ", $orderByCriteria) : $orderByCriteria; $this->sql .= " ORDER BY " . $orderBy; } // responsável por montar o limit. if (!empty($limitCriteria)) { $this->sql .= " LIMIT " . $limitCriteria; } // responsável por montar OFFSET if (!empty($offsetCriteria)) { $this->sql .= " OFFSET " . $offsetCriteria; } $this->sql .= ";"; return $this->sql; } catch (PhiberException $phiberException) { throw new PhiberException(new Internationalization("query_processor_error")); } }
[ "public", "function", "select", "(", "array", "$", "infos", ")", "{", "try", "{", "$", "tabela", "=", "$", "infos", "[", "'table'", "]", ";", "$", "campos", "=", "$", "infos", "[", "'fields'", "]", ";", "$", "whereCriteria", "=", "$", "infos", "[",...
Faz a query de select de um registro no banco com os dados. @param array $infos @return string @throws PhiberException
[ "Faz", "a", "query", "de", "select", "de", "um", "registro", "no", "banco", "com", "os", "dados", "." ]
7218e07872279f8c6cd8286460c82782ec62de4c
https://github.com/marciioluucas/phiber/blob/7218e07872279f8c6cd8286460c82782ec62de4c/src/Phiber/ORM/Queries/PhiberQueryWriter.php#L166-L220
40,001
webdevops/TYPO3-metaseo
Classes/Hook/HttpHook.php
HttpHook.main
public function main() { // INIT $tsSetup = $GLOBALS['TSFE']->tmpl->setup; $headers = array(); // don't send any headers if headers are already sent if (headers_sent()) { return; } // Init caches $cacheIdentification = sprintf( '%s_%s_http', $GLOBALS['TSFE']->id, substr(sha1(FrontendUtility::getCurrentUrl()), 10, 30) ); /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */ $objectManager = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); $cacheManager = $objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cache = $cacheManager->getCache('cache_pagesection'); if (!empty($GLOBALS['TSFE']->tmpl->loaded)) { // ################################## // Non-Cached page // ################################## if (!empty($tsSetup['plugin.']['metaseo.']['metaTags.'])) { $tsSetupSeo = $tsSetup['plugin.']['metaseo.']['metaTags.']; // ################################## // W3C P3P Tags // ################################## $p3pCP = null; $p3pPolicyUrl = null; if (!empty($tsSetupSeo['p3pCP'])) { $p3pCP = $tsSetupSeo['p3pCP']; } if (!empty($tsSetupSeo['p3pPolicyUrl'])) { $p3pPolicyUrl = $tsSetupSeo['p3pPolicyUrl']; } if (!empty($p3pCP) || !empty($p3pPolicyUrl)) { $p3pHeader = array(); if (!empty($p3pCP)) { $p3pHeader[] = 'CP="' . $p3pCP . '"'; } if (!empty($p3pPolicyUrl)) { $p3pHeader[] = 'policyref="' . $p3pPolicyUrl . '"'; } $headers['P3P'] = implode(' ', $p3pHeader); } } // Store headers into cache $cache->set($cacheIdentification, $headers, array('pageId_' . $GLOBALS['TSFE']->id)); } else { // ##################################### // Cached page // ##################################### // Fetched cached headers $cachedHeaders = $cache->get($cacheIdentification); if (!empty($cachedHeaders)) { $headers = $cachedHeaders; } } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'httpHeaderOutput', $this, $headers); // ##################################### // Sender headers // ##################################### if (!empty($headers['P3P'])) { header('P3P: ' . $headers['P3P']); } }
php
public function main() { // INIT $tsSetup = $GLOBALS['TSFE']->tmpl->setup; $headers = array(); // don't send any headers if headers are already sent if (headers_sent()) { return; } // Init caches $cacheIdentification = sprintf( '%s_%s_http', $GLOBALS['TSFE']->id, substr(sha1(FrontendUtility::getCurrentUrl()), 10, 30) ); /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */ $objectManager = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); $cacheManager = $objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cache = $cacheManager->getCache('cache_pagesection'); if (!empty($GLOBALS['TSFE']->tmpl->loaded)) { // ################################## // Non-Cached page // ################################## if (!empty($tsSetup['plugin.']['metaseo.']['metaTags.'])) { $tsSetupSeo = $tsSetup['plugin.']['metaseo.']['metaTags.']; // ################################## // W3C P3P Tags // ################################## $p3pCP = null; $p3pPolicyUrl = null; if (!empty($tsSetupSeo['p3pCP'])) { $p3pCP = $tsSetupSeo['p3pCP']; } if (!empty($tsSetupSeo['p3pPolicyUrl'])) { $p3pPolicyUrl = $tsSetupSeo['p3pPolicyUrl']; } if (!empty($p3pCP) || !empty($p3pPolicyUrl)) { $p3pHeader = array(); if (!empty($p3pCP)) { $p3pHeader[] = 'CP="' . $p3pCP . '"'; } if (!empty($p3pPolicyUrl)) { $p3pHeader[] = 'policyref="' . $p3pPolicyUrl . '"'; } $headers['P3P'] = implode(' ', $p3pHeader); } } // Store headers into cache $cache->set($cacheIdentification, $headers, array('pageId_' . $GLOBALS['TSFE']->id)); } else { // ##################################### // Cached page // ##################################### // Fetched cached headers $cachedHeaders = $cache->get($cacheIdentification); if (!empty($cachedHeaders)) { $headers = $cachedHeaders; } } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'httpHeaderOutput', $this, $headers); // ##################################### // Sender headers // ##################################### if (!empty($headers['P3P'])) { header('P3P: ' . $headers['P3P']); } }
[ "public", "function", "main", "(", ")", "{", "// INIT", "$", "tsSetup", "=", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "tmpl", "->", "setup", ";", "$", "headers", "=", "array", "(", ")", ";", "// don't send any headers if headers are already sent", "if", "("...
Add HTTP Headers
[ "Add", "HTTP", "Headers" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/HttpHook.php#L42-L128
40,002
webdevops/TYPO3-metaseo
Classes/Page/SitemapTxtPage.php
SitemapTxtPage.main
public function main() { // INIT $this->tsSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['sitemap.']; // check if sitemap is enabled in root if (!GeneralUtility::getRootSettingValue('is_sitemap', true)) { $this->showError('Sitemap is not available, please check your configuration [control-center]'); } return $this->build(); }
php
public function main() { // INIT $this->tsSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['sitemap.']; // check if sitemap is enabled in root if (!GeneralUtility::getRootSettingValue('is_sitemap', true)) { $this->showError('Sitemap is not available, please check your configuration [control-center]'); } return $this->build(); }
[ "public", "function", "main", "(", ")", "{", "// INIT", "$", "this", "->", "tsSetup", "=", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "tmpl", "->", "setup", "[", "'plugin.'", "]", "[", "'metaseo.'", "]", "[", "'sitemap.'", "]", ";", "// check if sitemap i...
Build sitemap xml @return string
[ "Build", "sitemap", "xml" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/SitemapTxtPage.php#L51-L62
40,003
webdevops/TYPO3-metaseo
Classes/Utility/DatabaseUtility.php
DatabaseUtility.addCondition
public static function addCondition($condition) { $ret = ' '; if (!empty($condition)) { if (is_array($condition)) { $ret .= ' AND (( ' . implode(" )\nAND (", $condition) . ' ))'; } else { $ret .= ' AND ( ' . $condition . ' )'; } } return $ret; }
php
public static function addCondition($condition) { $ret = ' '; if (!empty($condition)) { if (is_array($condition)) { $ret .= ' AND (( ' . implode(" )\nAND (", $condition) . ' ))'; } else { $ret .= ' AND ( ' . $condition . ' )'; } } return $ret; }
[ "public", "static", "function", "addCondition", "(", "$", "condition", ")", "{", "$", "ret", "=", "' '", ";", "if", "(", "!", "empty", "(", "$", "condition", ")", ")", "{", "if", "(", "is_array", "(", "$", "condition", ")", ")", "{", "$", "ret", ...
Add condition to query @param array|string $condition Condition @return string
[ "Add", "condition", "to", "query" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/DatabaseUtility.php#L331-L344
40,004
webdevops/TYPO3-metaseo
Classes/Utility/DatabaseUtility.php
DatabaseUtility.quoteArray
public static function quoteArray(array $valueList, $table = null) { $ret = array(); foreach ($valueList as $k => $v) { $ret[$k] = self::quote($v, $table); } return $ret; }
php
public static function quoteArray(array $valueList, $table = null) { $ret = array(); foreach ($valueList as $k => $v) { $ret[$k] = self::quote($v, $table); } return $ret; }
[ "public", "static", "function", "quoteArray", "(", "array", "$", "valueList", ",", "$", "table", "=", "null", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "valueList", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "ret...
Quote array with values @param array $valueList Values @param string $table Table @return array
[ "Quote", "array", "with", "values" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/DatabaseUtility.php#L404-L412
40,005
webdevops/TYPO3-metaseo
Classes/Page/Part/FooterPart.php
FooterPart.main
public function main($title) { // INIT $ret = array(); $tsSetup = $GLOBALS['TSFE']->tmpl->setup; $tsServices = array(); $beLoggedIn = isset($GLOBALS['BE_USER']->user['username']); $disabledHeaderCode = false; if (!empty($tsSetup['config.']['disableAllHeaderCode'])) { $disabledHeaderCode = true; } if (!empty($tsSetup['plugin.']['metaseo.']['services.'])) { $tsServices = $tsSetup['plugin.']['metaseo.']['services.']; } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterSetup', $this, $tsServices); // ######################################### // GOOGLE ANALYTICS // ######################################### if (!empty($tsServices['googleAnalytics'])) { $gaConf = $tsServices['googleAnalytics.']; $gaEnabled = true; if ($disabledHeaderCode && empty($gaConf['enableIfHeaderIsDisabled'])) { $gaEnabled = false; } if ($gaEnabled && !(empty($gaConf['showIfBeLogin']) && $beLoggedIn)) { // Build Google Analytics service $ret['ga'] = $this->buildGoogleAnalyticsCode($tsServices, $gaConf); if (!empty($gaConf['trackDownloads']) && !empty($gaConf['trackDownloadsScript'])) { $ret['ga.trackdownload'] = $this->serviceGoogleAnalyticsTrackDownloads($gaConf); } } elseif ($gaEnabled && $beLoggedIn) { // Disable caching $GLOBALS['TSFE']->set_no_cache('MetaSEO: Google Analytics code disabled, backend login detected'); // Backend login detected, disable cache because this page is viewed by BE-users $ret['ga.disabled'] = '<!-- Google Analytics disabled, ' . 'Page cache disabled - Backend-Login detected -->'; } } // ######################################### // PIWIK // ######################################### if (!empty($tsServices['piwik.']) && !empty($tsServices['piwik.']['url']) && !empty($tsServices['piwik.']['id']) ) { $piwikConf = $tsServices['piwik.']; $piwikEnabled = true; if ($disabledHeaderCode && empty($piwikConf['enableIfHeaderIsDisabled'])) { $piwikEnabled = false; } if ($piwikEnabled && !(empty($piwikConf['showIfBeLogin']) && $beLoggedIn)) { // Build Piwik service $ret['piwik'] = $this->buildPiwikCode($tsServices, $piwikConf); } elseif ($piwikEnabled && $beLoggedIn) { // Disable caching $GLOBALS['TSFE']->set_no_cache('MetaSEO: Piwik code disabled, backend login detected'); // Backend login detected, disable cache because this page is viewed by BE-users $ret['piwik.disabled'] = '<!-- Piwik disabled, Page cache disabled - Backend-Login detected -->'; } } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterOutput', $this, $ret); return implode("\n", $ret); }
php
public function main($title) { // INIT $ret = array(); $tsSetup = $GLOBALS['TSFE']->tmpl->setup; $tsServices = array(); $beLoggedIn = isset($GLOBALS['BE_USER']->user['username']); $disabledHeaderCode = false; if (!empty($tsSetup['config.']['disableAllHeaderCode'])) { $disabledHeaderCode = true; } if (!empty($tsSetup['plugin.']['metaseo.']['services.'])) { $tsServices = $tsSetup['plugin.']['metaseo.']['services.']; } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterSetup', $this, $tsServices); // ######################################### // GOOGLE ANALYTICS // ######################################### if (!empty($tsServices['googleAnalytics'])) { $gaConf = $tsServices['googleAnalytics.']; $gaEnabled = true; if ($disabledHeaderCode && empty($gaConf['enableIfHeaderIsDisabled'])) { $gaEnabled = false; } if ($gaEnabled && !(empty($gaConf['showIfBeLogin']) && $beLoggedIn)) { // Build Google Analytics service $ret['ga'] = $this->buildGoogleAnalyticsCode($tsServices, $gaConf); if (!empty($gaConf['trackDownloads']) && !empty($gaConf['trackDownloadsScript'])) { $ret['ga.trackdownload'] = $this->serviceGoogleAnalyticsTrackDownloads($gaConf); } } elseif ($gaEnabled && $beLoggedIn) { // Disable caching $GLOBALS['TSFE']->set_no_cache('MetaSEO: Google Analytics code disabled, backend login detected'); // Backend login detected, disable cache because this page is viewed by BE-users $ret['ga.disabled'] = '<!-- Google Analytics disabled, ' . 'Page cache disabled - Backend-Login detected -->'; } } // ######################################### // PIWIK // ######################################### if (!empty($tsServices['piwik.']) && !empty($tsServices['piwik.']['url']) && !empty($tsServices['piwik.']['id']) ) { $piwikConf = $tsServices['piwik.']; $piwikEnabled = true; if ($disabledHeaderCode && empty($piwikConf['enableIfHeaderIsDisabled'])) { $piwikEnabled = false; } if ($piwikEnabled && !(empty($piwikConf['showIfBeLogin']) && $beLoggedIn)) { // Build Piwik service $ret['piwik'] = $this->buildPiwikCode($tsServices, $piwikConf); } elseif ($piwikEnabled && $beLoggedIn) { // Disable caching $GLOBALS['TSFE']->set_no_cache('MetaSEO: Piwik code disabled, backend login detected'); // Backend login detected, disable cache because this page is viewed by BE-users $ret['piwik.disabled'] = '<!-- Piwik disabled, Page cache disabled - Backend-Login detected -->'; } } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterOutput', $this, $ret); return implode("\n", $ret); }
[ "public", "function", "main", "(", "$", "title", ")", "{", "// INIT", "$", "ret", "=", "array", "(", ")", ";", "$", "tsSetup", "=", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "tmpl", "->", "setup", ";", "$", "tsServices", "=", "array", "(", ")", "...
Add Page Footer @param string $title Default page title (rendered by TYPO3) @return string Modified page title
[ "Add", "Page", "Footer" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/FooterPart.php#L51-L134
40,006
webdevops/TYPO3-metaseo
Classes/Connector.php
Connector.setPageTitle
public static function setPageTitle($value, $updateTsfe = true) { $value = (string)$value; if ($updateTsfe && !empty($GLOBALS['TSFE'])) { $GLOBALS['TSFE']->page['title'] = $value; $GLOBALS['TSFE']->indexedDocTitle = $value; } self::$store['pagetitle']['pagetitle.title'] = $value; }
php
public static function setPageTitle($value, $updateTsfe = true) { $value = (string)$value; if ($updateTsfe && !empty($GLOBALS['TSFE'])) { $GLOBALS['TSFE']->page['title'] = $value; $GLOBALS['TSFE']->indexedDocTitle = $value; } self::$store['pagetitle']['pagetitle.title'] = $value; }
[ "public", "static", "function", "setPageTitle", "(", "$", "value", ",", "$", "updateTsfe", "=", "true", ")", "{", "$", "value", "=", "(", "string", ")", "$", "value", ";", "if", "(", "$", "updateTsfe", "&&", "!", "empty", "(", "$", "GLOBALS", "[", ...
Set page title @param string $value Page title @param boolean $updateTsfe Update TSFE values
[ "Set", "page", "title" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Connector.php#L66-L76
40,007
webdevops/TYPO3-metaseo
Classes/Connector.php
Connector.setOpenGraphTag
public static function setOpenGraphTag($key, $value) { $key = (string)$key; $value = (string)$value; self::$store['flag']['meta:og:external'] = true; self::$store['meta:og'][$key] = $value; }
php
public static function setOpenGraphTag($key, $value) { $key = (string)$key; $value = (string)$value; self::$store['flag']['meta:og:external'] = true; self::$store['meta:og'][$key] = $value; }
[ "public", "static", "function", "setOpenGraphTag", "(", "$", "key", ",", "$", "value", ")", "{", "$", "key", "=", "(", "string", ")", "$", "key", ";", "$", "value", "=", "(", "string", ")", "$", "value", ";", "self", "::", "$", "store", "[", "'fl...
Set opengraph tag @param string $key Metatag name @param string $value Metatag value
[ "Set", "opengraph", "tag" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Connector.php#L152-L159
40,008
webdevops/TYPO3-metaseo
Classes/Connector.php
Connector.setCustomOpenGraphTag
public static function setCustomOpenGraphTag($key, $value) { $key = (string)$key; $value = (string)$value; self::$store['flag']['custom:og:external'] = true; self::$store['custom:og'][$key] = $value; }
php
public static function setCustomOpenGraphTag($key, $value) { $key = (string)$key; $value = (string)$value; self::$store['flag']['custom:og:external'] = true; self::$store['custom:og'][$key] = $value; }
[ "public", "static", "function", "setCustomOpenGraphTag", "(", "$", "key", ",", "$", "value", ")", "{", "$", "key", "=", "(", "string", ")", "$", "key", ";", "$", "value", "=", "(", "string", ")", "$", "value", ";", "self", "::", "$", "store", "[", ...
Set custom opengraph tag @param string $key Metatag name @param string $value Metatag value
[ "Set", "custom", "opengraph", "tag" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Connector.php#L181-L188
40,009
webdevops/TYPO3-metaseo
Classes/Hook/SitemapIndexLinkHook.php
SitemapIndexLinkHook.checkIfFileIsWhitelisted
protected function checkIfFileIsWhitelisted($url) { $ret = false; // check for valid url if (empty($url)) { return false; } // parse url to extract only path $urlParts = parse_url($url); $filePath = $urlParts['path']; // Extract last file extension if (preg_match('/\.([^\.]+)$/', $filePath, $matches)) { $fileExt = trim(strtolower($matches[1])); // Check if file extension is whitelisted foreach ($this->fileExtList as $allowedFileExt) { if ($allowedFileExt === $fileExt) { // File is whitelisted, not blacklisted $ret = true; break; } } } return $ret; }
php
protected function checkIfFileIsWhitelisted($url) { $ret = false; // check for valid url if (empty($url)) { return false; } // parse url to extract only path $urlParts = parse_url($url); $filePath = $urlParts['path']; // Extract last file extension if (preg_match('/\.([^\.]+)$/', $filePath, $matches)) { $fileExt = trim(strtolower($matches[1])); // Check if file extension is whitelisted foreach ($this->fileExtList as $allowedFileExt) { if ($allowedFileExt === $fileExt) { // File is whitelisted, not blacklisted $ret = true; break; } } } return $ret; }
[ "protected", "function", "checkIfFileIsWhitelisted", "(", "$", "url", ")", "{", "$", "ret", "=", "false", ";", "// check for valid url", "if", "(", "empty", "(", "$", "url", ")", ")", "{", "return", "false", ";", "}", "// parse url to extract only path", "$", ...
Check if file is whitelisted Configuration specified in plugin.metaseo.sitemap.index.fileExtension @param string $url Url to file @return boolean
[ "Check", "if", "file", "is", "whitelisted" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/SitemapIndexLinkHook.php#L265-L293
40,010
webdevops/TYPO3-metaseo
Classes/Hook/TCA/RobotsTxtDefault.php
RobotsTxtDefault.main
public function main(array $data) { // ############################ // Init // ############################ /** @var \TYPO3\CMS\Extbase\Object\ObjectManager objectManager */ $this->objectManager = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); /** @var ConfigurationManager configurationManager */ $this->configurationManager = $this->objectManager->get( 'TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager' ); /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer cObj */ $this->cObj = $this->objectManager->get('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); // ############################ // Init TSFE // ############################ $rootPageId = $data['row']['pid']; // Disables the time tracker to speed up TypoScript execution /** @var \TYPO3\CMS\Core\TimeTracker\TimeTracker $timeTracker */ $timeTracker = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker', false); $GLOBALS['TT'] = $timeTracker; $GLOBALS['TT']->start(); /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $tsfeController */ $tsfeController = $this->objectManager->get( 'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $rootPageId, 0 ); $GLOBALS['TSFE'] = $tsfeController; //allow dynamically robots.txt to be dynamically scripted via TS if (empty($GLOBALS['TSFE']->sys_page)) { $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->initTemplate(); } // ############################ // Render default robots.txt content // ############################ // Fetch TypoScript setup $tsSetup = $this->configurationManager->getConfiguration( ConfigurationManager::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'metaseo', 'plugin' ); $content = ''; if (!empty($tsSetup['plugin.']['metaseo.']['robotsTxt.'])) { $content = $this->cObj->cObjGetSingle( $tsSetup['plugin.']['metaseo.']['robotsTxt.']['default'], $tsSetup['plugin.']['metaseo.']['robotsTxt.']['default.'] ); } $content = htmlspecialchars($content); $content = nl2br($content); return $content; }
php
public function main(array $data) { // ############################ // Init // ############################ /** @var \TYPO3\CMS\Extbase\Object\ObjectManager objectManager */ $this->objectManager = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); /** @var ConfigurationManager configurationManager */ $this->configurationManager = $this->objectManager->get( 'TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager' ); /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer cObj */ $this->cObj = $this->objectManager->get('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); // ############################ // Init TSFE // ############################ $rootPageId = $data['row']['pid']; // Disables the time tracker to speed up TypoScript execution /** @var \TYPO3\CMS\Core\TimeTracker\TimeTracker $timeTracker */ $timeTracker = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker', false); $GLOBALS['TT'] = $timeTracker; $GLOBALS['TT']->start(); /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $tsfeController */ $tsfeController = $this->objectManager->get( 'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $rootPageId, 0 ); $GLOBALS['TSFE'] = $tsfeController; //allow dynamically robots.txt to be dynamically scripted via TS if (empty($GLOBALS['TSFE']->sys_page)) { $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->initTemplate(); } // ############################ // Render default robots.txt content // ############################ // Fetch TypoScript setup $tsSetup = $this->configurationManager->getConfiguration( ConfigurationManager::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'metaseo', 'plugin' ); $content = ''; if (!empty($tsSetup['plugin.']['metaseo.']['robotsTxt.'])) { $content = $this->cObj->cObjGetSingle( $tsSetup['plugin.']['metaseo.']['robotsTxt.']['default'], $tsSetup['plugin.']['metaseo.']['robotsTxt.']['default.'] ); } $content = htmlspecialchars($content); $content = nl2br($content); return $content; }
[ "public", "function", "main", "(", "array", "$", "data", ")", "{", "// ############################", "// Init", "// ############################", "/** @var \\TYPO3\\CMS\\Extbase\\Object\\ObjectManager objectManager */", "$", "this", "->", "objectManager", "=", "GeneralUtility",...
Render default Robots.txt from TypoScript Setup @param array $data TCE Information array @return string
[ "Render", "default", "Robots", ".", "txt", "from", "TypoScript", "Setup" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/TCA/RobotsTxtDefault.php#L66-L136
40,011
webdevops/TYPO3-metaseo
Classes/Dao/PageSeoDao.php
PageSeoDao.listCalcDepth
protected function listCalcDepth($pageUid, array $rootLineRaw, $depth = null) { if ($depth === null) { $depth = 1; } if (empty($rootLineRaw[$pageUid])) { // found root page return $depth; } // we must be at least in the first depth ++$depth; $pagePid = $rootLineRaw[$pageUid]; if (!empty($pagePid)) { // recursive $depth = $this->listCalcDepth($pagePid, $rootLineRaw, $depth); } return $depth; }
php
protected function listCalcDepth($pageUid, array $rootLineRaw, $depth = null) { if ($depth === null) { $depth = 1; } if (empty($rootLineRaw[$pageUid])) { // found root page return $depth; } // we must be at least in the first depth ++$depth; $pagePid = $rootLineRaw[$pageUid]; if (!empty($pagePid)) { // recursive $depth = $this->listCalcDepth($pagePid, $rootLineRaw, $depth); } return $depth; }
[ "protected", "function", "listCalcDepth", "(", "$", "pageUid", ",", "array", "$", "rootLineRaw", ",", "$", "depth", "=", "null", ")", "{", "if", "(", "$", "depth", "===", "null", ")", "{", "$", "depth", "=", "1", ";", "}", "if", "(", "empty", "(", ...
Calculate the depth of a page @param integer $pageUid Page UID @param array $rootLineRaw Root line (raw list) @param integer $depth Current depth @return integer
[ "Calculate", "the", "depth", "of", "a", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Dao/PageSeoDao.php#L213-L235
40,012
webdevops/TYPO3-metaseo
Classes/Dao/PageSeoDao.php
PageSeoDao.updatePageTableField
public function updatePageTableField($pid, $sysLanguage, $fieldName, $fieldValue) { $tableName = 'pages'; if (!empty($sysLanguage)) { // check if field is in overlay if ($this->isFieldInTcaTable('pages_language_overlay', $fieldName)) { // Field is in pages language overlay $tableName = 'pages_language_overlay'; } } switch ($tableName) { case 'pages_language_overlay': // Update field in pages overlay (also logs update event and clear cache for this page) // check uid of pages language overlay $query = 'SELECT uid FROM pages_language_overlay WHERE pid = ' . (int)$pid . ' AND sys_language_uid = ' . (int)$sysLanguage; $overlayId = DatabaseUtility::getOne($query); if (empty($overlayId)) { // No access throw new AjaxException( 'message.error.no_language_overlay_found', '[0x4FBF3C05]', HttpUtility::HTTP_STATUS_BAD_REQUEST ); } // ################ // UPDATE // ################ $this->getDataHandler()->updateDB( 'pages_language_overlay', (int)$overlayId, array( $fieldName => $fieldValue ) ); break; case 'pages': // Update field in page (also logs update event and clear cache for this page) $this->getDataHandler()->updateDB( 'pages', (int)$pid, array( $fieldName => $fieldValue ) ); break; } return array(); }
php
public function updatePageTableField($pid, $sysLanguage, $fieldName, $fieldValue) { $tableName = 'pages'; if (!empty($sysLanguage)) { // check if field is in overlay if ($this->isFieldInTcaTable('pages_language_overlay', $fieldName)) { // Field is in pages language overlay $tableName = 'pages_language_overlay'; } } switch ($tableName) { case 'pages_language_overlay': // Update field in pages overlay (also logs update event and clear cache for this page) // check uid of pages language overlay $query = 'SELECT uid FROM pages_language_overlay WHERE pid = ' . (int)$pid . ' AND sys_language_uid = ' . (int)$sysLanguage; $overlayId = DatabaseUtility::getOne($query); if (empty($overlayId)) { // No access throw new AjaxException( 'message.error.no_language_overlay_found', '[0x4FBF3C05]', HttpUtility::HTTP_STATUS_BAD_REQUEST ); } // ################ // UPDATE // ################ $this->getDataHandler()->updateDB( 'pages_language_overlay', (int)$overlayId, array( $fieldName => $fieldValue ) ); break; case 'pages': // Update field in page (also logs update event and clear cache for this page) $this->getDataHandler()->updateDB( 'pages', (int)$pid, array( $fieldName => $fieldValue ) ); break; } return array(); }
[ "public", "function", "updatePageTableField", "(", "$", "pid", ",", "$", "sysLanguage", ",", "$", "fieldName", ",", "$", "fieldValue", ")", "{", "$", "tableName", "=", "'pages'", ";", "if", "(", "!", "empty", "(", "$", "sysLanguage", ")", ")", "{", "//...
Update field in page table @param integer $pid PID @param integer|NULL $sysLanguage System language id @param string $fieldName Field name @param string $fieldValue Field value @return array @throws AjaxException
[ "Update", "field", "in", "page", "table" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Dao/PageSeoDao.php#L249-L307
40,013
webdevops/TYPO3-metaseo
Classes/Controller/Ajax/SitemapController.php
SitemapController.executeIndex
protected function executeIndex() { // Init $rootPid = (int)$this->postVar['pid']; $offset = (int)$this->postVar['start']; $itemsPerPage = (int)$this->postVar['pagingSize']; $searchFulltext = trim((string)$this->postVar['criteriaFulltext']); $searchPageUid = trim((int)$this->postVar['criteriaPageUid']); $searchPageLanguage = trim((string)$this->postVar['criteriaPageLanguage']); $searchPageDepth = trim((string)$this->postVar['criteriaPageDepth']); $searchIsBlacklisted = (bool)trim((string)$this->postVar['criteriaIsBlacklisted']); // ############################ // Criteria // ############################ $where = array(); // Root pid limit $where[] = 's.page_rootpid = ' . (int)$rootPid; // Fulltext if (!empty($searchFulltext)) { $where[] = 's.page_url LIKE ' . DatabaseUtility::quote('%' . $searchFulltext . '%', 'tx_metaseo_sitemap'); } // Page id if (!empty($searchPageUid)) { $where[] = 's.page_uid = ' . (int)$searchPageUid; } // Language if ($searchPageLanguage != -1 && strlen($searchPageLanguage) >= 1) { $where[] = 's.page_language = ' . (int)$searchPageLanguage; } // Depth if ($searchPageDepth != -1 && strlen($searchPageDepth) >= 1) { $where[] = 's.page_depth = ' . (int)$searchPageDepth; } if ($searchIsBlacklisted) { $where[] = 's.is_blacklisted = 1'; } // Filter blacklisted page types $where[] = DatabaseUtility::conditionNotIn( 'p.doktype', SitemapUtility::getDoktypeBlacklist() ); // Build where $where = DatabaseUtility::buildCondition($where); // ############################ // Pager // ############################ // Fetch total count of items with this filter settings $query = 'SELECT COUNT(*) AS count FROM tx_metaseo_sitemap s INNER JOIN pages p ON p.uid = s.page_uid WHERE ' . $where; $itemCount = DatabaseUtility::getOne($query); // ############################ // Sort // ############################ // default sort $sort = 's.page_depth ASC, s.page_uid ASC'; if (!empty($this->sortField) && !empty($this->sortDir)) { // already filtered $sort = $this->sortField . ' ' . $this->sortDir; } // ############################ // Fetch sitemap // ############################ $query = 'SELECT s.uid, s.page_rootpid, s.page_uid, s.page_language, s.page_url, s.page_depth, s.page_type, s.is_blacklisted, p.tx_metaseo_is_exclude, FROM_UNIXTIME(s.tstamp) as tstamp, FROM_UNIXTIME(s.crdate) as crdate FROM tx_metaseo_sitemap s INNER JOIN pages p ON p.uid = s.page_uid WHERE ' . $where . ' ORDER BY ' . $sort . ' LIMIT ' . (int)$offset . ', ' . (int)$itemsPerPage; $list = DatabaseUtility::getAll($query); return array( 'results' => $itemCount, 'rows' => $list, ); }
php
protected function executeIndex() { // Init $rootPid = (int)$this->postVar['pid']; $offset = (int)$this->postVar['start']; $itemsPerPage = (int)$this->postVar['pagingSize']; $searchFulltext = trim((string)$this->postVar['criteriaFulltext']); $searchPageUid = trim((int)$this->postVar['criteriaPageUid']); $searchPageLanguage = trim((string)$this->postVar['criteriaPageLanguage']); $searchPageDepth = trim((string)$this->postVar['criteriaPageDepth']); $searchIsBlacklisted = (bool)trim((string)$this->postVar['criteriaIsBlacklisted']); // ############################ // Criteria // ############################ $where = array(); // Root pid limit $where[] = 's.page_rootpid = ' . (int)$rootPid; // Fulltext if (!empty($searchFulltext)) { $where[] = 's.page_url LIKE ' . DatabaseUtility::quote('%' . $searchFulltext . '%', 'tx_metaseo_sitemap'); } // Page id if (!empty($searchPageUid)) { $where[] = 's.page_uid = ' . (int)$searchPageUid; } // Language if ($searchPageLanguage != -1 && strlen($searchPageLanguage) >= 1) { $where[] = 's.page_language = ' . (int)$searchPageLanguage; } // Depth if ($searchPageDepth != -1 && strlen($searchPageDepth) >= 1) { $where[] = 's.page_depth = ' . (int)$searchPageDepth; } if ($searchIsBlacklisted) { $where[] = 's.is_blacklisted = 1'; } // Filter blacklisted page types $where[] = DatabaseUtility::conditionNotIn( 'p.doktype', SitemapUtility::getDoktypeBlacklist() ); // Build where $where = DatabaseUtility::buildCondition($where); // ############################ // Pager // ############################ // Fetch total count of items with this filter settings $query = 'SELECT COUNT(*) AS count FROM tx_metaseo_sitemap s INNER JOIN pages p ON p.uid = s.page_uid WHERE ' . $where; $itemCount = DatabaseUtility::getOne($query); // ############################ // Sort // ############################ // default sort $sort = 's.page_depth ASC, s.page_uid ASC'; if (!empty($this->sortField) && !empty($this->sortDir)) { // already filtered $sort = $this->sortField . ' ' . $this->sortDir; } // ############################ // Fetch sitemap // ############################ $query = 'SELECT s.uid, s.page_rootpid, s.page_uid, s.page_language, s.page_url, s.page_depth, s.page_type, s.is_blacklisted, p.tx_metaseo_is_exclude, FROM_UNIXTIME(s.tstamp) as tstamp, FROM_UNIXTIME(s.crdate) as crdate FROM tx_metaseo_sitemap s INNER JOIN pages p ON p.uid = s.page_uid WHERE ' . $where . ' ORDER BY ' . $sort . ' LIMIT ' . (int)$offset . ', ' . (int)$itemsPerPage; $list = DatabaseUtility::getAll($query); return array( 'results' => $itemCount, 'rows' => $list, ); }
[ "protected", "function", "executeIndex", "(", ")", "{", "// Init", "$", "rootPid", "=", "(", "int", ")", "$", "this", "->", "postVar", "[", "'pid'", "]", ";", "$", "offset", "=", "(", "int", ")", "$", "this", "->", "postVar", "[", "'start'", "]", "...
Return sitemap entry list for root tree @return array
[ "Return", "sitemap", "entry", "list", "for", "root", "tree" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Controller/Ajax/SitemapController.php#L66-L167
40,014
webdevops/TYPO3-metaseo
Classes/Controller/Ajax/SitemapController.php
SitemapController.executeDelete
protected function executeDelete() { $uidList = $this->postVar['uidList']; $rootPid = (int)$this->postVar['pid']; $uidList = DatabaseUtility::connection()->cleanIntArray($uidList); if (empty($uidList) || empty($rootPid)) { throw new AjaxException( 'message.warning.incomplete_data_received.message', '[0x4FBF3C11]', HttpUtility::HTTP_STATUS_BAD_REQUEST ); } $where = array(); $where[] = 'page_rootpid = ' . (int)$rootPid; $where[] = DatabaseUtility::conditionIn('uid', $uidList); $where = DatabaseUtility::buildCondition($where); $query = 'DELETE FROM tx_metaseo_sitemap WHERE ' . $where; DatabaseUtility::exec($query); return array(); }
php
protected function executeDelete() { $uidList = $this->postVar['uidList']; $rootPid = (int)$this->postVar['pid']; $uidList = DatabaseUtility::connection()->cleanIntArray($uidList); if (empty($uidList) || empty($rootPid)) { throw new AjaxException( 'message.warning.incomplete_data_received.message', '[0x4FBF3C11]', HttpUtility::HTTP_STATUS_BAD_REQUEST ); } $where = array(); $where[] = 'page_rootpid = ' . (int)$rootPid; $where[] = DatabaseUtility::conditionIn('uid', $uidList); $where = DatabaseUtility::buildCondition($where); $query = 'DELETE FROM tx_metaseo_sitemap WHERE ' . $where; DatabaseUtility::exec($query); return array(); }
[ "protected", "function", "executeDelete", "(", ")", "{", "$", "uidList", "=", "$", "this", "->", "postVar", "[", "'uidList'", "]", ";", "$", "rootPid", "=", "(", "int", ")", "$", "this", "->", "postVar", "[", "'pid'", "]", ";", "$", "uidList", "=", ...
Delete sitemap entries @return array @throws AjaxException
[ "Delete", "sitemap", "entries" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Controller/Ajax/SitemapController.php#L296-L322
40,015
webdevops/TYPO3-metaseo
Classes/Controller/Ajax/SitemapController.php
SitemapController.executeDeleteAll
protected function executeDeleteAll() { $rootPid = (int)$this->postVar['pid']; if (empty($rootPid)) { throw new AjaxException( 'message.warning.incomplete_data_received.message', '[0x4FBF3C12]', HttpUtility::HTTP_STATUS_BAD_REQUEST ); } $where = array(); $where[] = 'page_rootpid = ' . (int)$rootPid; $where = DatabaseUtility::buildCondition($where); $query = 'DELETE FROM tx_metaseo_sitemap WHERE ' . $where; DatabaseUtility::exec($query); return array(); }
php
protected function executeDeleteAll() { $rootPid = (int)$this->postVar['pid']; if (empty($rootPid)) { throw new AjaxException( 'message.warning.incomplete_data_received.message', '[0x4FBF3C12]', HttpUtility::HTTP_STATUS_BAD_REQUEST ); } $where = array(); $where[] = 'page_rootpid = ' . (int)$rootPid; $where = DatabaseUtility::buildCondition($where); $query = 'DELETE FROM tx_metaseo_sitemap WHERE ' . $where; DatabaseUtility::exec($query); return array(); }
[ "protected", "function", "executeDeleteAll", "(", ")", "{", "$", "rootPid", "=", "(", "int", ")", "$", "this", "->", "postVar", "[", "'pid'", "]", ";", "if", "(", "empty", "(", "$", "rootPid", ")", ")", "{", "throw", "new", "AjaxException", "(", "'me...
Delete all sitemap entries @return array @throws AjaxException
[ "Delete", "all", "sitemap", "entries" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Controller/Ajax/SitemapController.php#L347-L369
40,016
webdevops/TYPO3-metaseo
class.ext_update.php
ext_update.renameDatabaseTableField
protected function renameDatabaseTableField($table, $oldFieldName, $newFieldName) { $title = 'Renaming "' . $table . ':' . $oldFieldName . '" to "' . $table . ':' . $newFieldName . '": '; $currentTableFields = $this->databaseConnection->admin_get_fields($table); if ($currentTableFields[$newFieldName]) { $message = 'Field ' . $table . ':' . $newFieldName . ' already existing.'; $status = FlashMessage::OK; } else { if (!$currentTableFields[$oldFieldName]) { $message = 'Field ' . $table . ':' . $oldFieldName . ' not existing'; $status = FlashMessage::ERROR; } else { $sql = 'ALTER TABLE ' . $table . ' CHANGE COLUMN ' . $oldFieldName . ' ' . $newFieldName . ' ' . $currentTableFields[$oldFieldName]['Type']; if ($this->databaseConnection->admin_query($sql) === false) { $message = ' SQL ERROR: ' . $this->databaseConnection->sql_error(); $status = FlashMessage::ERROR; } else { $message = 'OK!'; $status = FlashMessage::OK; } } } $this->addMessage($status, $title, $message); return $status; }
php
protected function renameDatabaseTableField($table, $oldFieldName, $newFieldName) { $title = 'Renaming "' . $table . ':' . $oldFieldName . '" to "' . $table . ':' . $newFieldName . '": '; $currentTableFields = $this->databaseConnection->admin_get_fields($table); if ($currentTableFields[$newFieldName]) { $message = 'Field ' . $table . ':' . $newFieldName . ' already existing.'; $status = FlashMessage::OK; } else { if (!$currentTableFields[$oldFieldName]) { $message = 'Field ' . $table . ':' . $oldFieldName . ' not existing'; $status = FlashMessage::ERROR; } else { $sql = 'ALTER TABLE ' . $table . ' CHANGE COLUMN ' . $oldFieldName . ' ' . $newFieldName . ' ' . $currentTableFields[$oldFieldName]['Type']; if ($this->databaseConnection->admin_query($sql) === false) { $message = ' SQL ERROR: ' . $this->databaseConnection->sql_error(); $status = FlashMessage::ERROR; } else { $message = 'OK!'; $status = FlashMessage::OK; } } } $this->addMessage($status, $title, $message); return $status; }
[ "protected", "function", "renameDatabaseTableField", "(", "$", "table", ",", "$", "oldFieldName", ",", "$", "newFieldName", ")", "{", "$", "title", "=", "'Renaming \"'", ".", "$", "table", ".", "':'", ".", "$", "oldFieldName", ".", "'\" to \"'", ".", "$", ...
Renames a tabled field and does some plausibility checks. @param string $table @param string $oldFieldName @param string $newFieldName @return int
[ "Renames", "a", "tabled", "field", "and", "does", "some", "plausibility", "checks", "." ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/class.ext_update.php#L219-L249
40,017
webdevops/TYPO3-metaseo
Classes/Utility/BackendUtility.php
BackendUtility.getRootPageSettingList
public static function getRootPageSettingList() { static $cache = null; if ($cache === null) { $query = 'SELECT seosr.* FROM tx_metaseo_setting_root seosr INNER JOIN pages p ON p.uid = seosr.pid AND p.is_siteroot = 1 AND p.deleted = 0 WHERE seosr.deleted = 0'; $cache = DatabaseUtility::getAllWithIndex($query, 'pid'); } return $cache; }
php
public static function getRootPageSettingList() { static $cache = null; if ($cache === null) { $query = 'SELECT seosr.* FROM tx_metaseo_setting_root seosr INNER JOIN pages p ON p.uid = seosr.pid AND p.is_siteroot = 1 AND p.deleted = 0 WHERE seosr.deleted = 0'; $cache = DatabaseUtility::getAllWithIndex($query, 'pid'); } return $cache; }
[ "public", "static", "function", "getRootPageSettingList", "(", ")", "{", "static", "$", "cache", "=", "null", ";", "if", "(", "$", "cache", "===", "null", ")", "{", "$", "query", "=", "'SELECT seosr.*\n FROM tx_metaseo_setting_root seosr\n ...
Fetch list of setting entries @return array
[ "Fetch", "list", "of", "setting", "entries" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/BackendUtility.php#L62-L78
40,018
webdevops/TYPO3-metaseo
Classes/Utility/TypoScript.php
TypoScript.getNode
public function getNode($tsNodePath) { $ret = null; // extract TypoScript-path information $nodeSections = explode('.', $tsNodePath); $nodeValueType = end($nodeSections); $nodeValueName = end($nodeSections) . '.'; // remove last node from sections because we already got the node name unset($nodeSections[key($nodeSections)]); // walk though array to find node $nodeData = $this->tsData; if (!empty($nodeSections) && is_array($nodeSections)) { foreach ($nodeSections as $sectionName) { $sectionName .= '.'; if (is_array($nodeData) && array_key_exists($sectionName, $nodeData)) { $nodeData = $nodeData[$sectionName]; } else { break; } } } // Fetch TypoScript configuration data $tsData = array(); if (is_array($nodeData) && array_key_exists($nodeValueName, $nodeData)) { $tsData = $nodeData[$nodeValueName]; } // Fetch TypoScript configuration type $tsType = null; if (is_array($nodeData) && array_key_exists($nodeValueType, $nodeData)) { $tsType = $nodeData[$nodeValueType]; } // Clone object and set values $ret = clone $this; $ret->tsData = $tsData; $ret->tsType = $tsType; $ret->iteratorPosition = false; return $ret; }
php
public function getNode($tsNodePath) { $ret = null; // extract TypoScript-path information $nodeSections = explode('.', $tsNodePath); $nodeValueType = end($nodeSections); $nodeValueName = end($nodeSections) . '.'; // remove last node from sections because we already got the node name unset($nodeSections[key($nodeSections)]); // walk though array to find node $nodeData = $this->tsData; if (!empty($nodeSections) && is_array($nodeSections)) { foreach ($nodeSections as $sectionName) { $sectionName .= '.'; if (is_array($nodeData) && array_key_exists($sectionName, $nodeData)) { $nodeData = $nodeData[$sectionName]; } else { break; } } } // Fetch TypoScript configuration data $tsData = array(); if (is_array($nodeData) && array_key_exists($nodeValueName, $nodeData)) { $tsData = $nodeData[$nodeValueName]; } // Fetch TypoScript configuration type $tsType = null; if (is_array($nodeData) && array_key_exists($nodeValueType, $nodeData)) { $tsType = $nodeData[$nodeValueType]; } // Clone object and set values $ret = clone $this; $ret->tsData = $tsData; $ret->tsType = $tsType; $ret->iteratorPosition = false; return $ret; }
[ "public", "function", "getNode", "(", "$", "tsNodePath", ")", "{", "$", "ret", "=", "null", ";", "// extract TypoScript-path information", "$", "nodeSections", "=", "explode", "(", "'.'", ",", "$", "tsNodePath", ")", ";", "$", "nodeValueType", "=", "end", "(...
Get TypoScript subnode @param string $tsNodePath TypoScript node-path @return TypoScript TypoScript subnode-object
[ "Get", "TypoScript", "subnode" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/TypoScript.php#L137-L182
40,019
webdevops/TYPO3-metaseo
Classes/Utility/TypoScript.php
TypoScript.iteratorNextNode
public function iteratorNextNode() { // INIT $iteratorPosition = null; $this->iteratorPosition = false; $nextNode = false; do { if ($nextNode) { next($this->tsData); } $currentNode = current($this->tsData); if ($currentNode !== false) { // get key $iteratorPosition = key($this->tsData); // check if node is subnode or value if (substr($iteratorPosition, -1) == '.') { // next subnode fond $this->iteratorPosition = $iteratorPosition; break; } } else { $iteratorPosition = false; $this->iteratorPosition = false; } $nextNode = true; } while ($iteratorPosition !== false); }
php
public function iteratorNextNode() { // INIT $iteratorPosition = null; $this->iteratorPosition = false; $nextNode = false; do { if ($nextNode) { next($this->tsData); } $currentNode = current($this->tsData); if ($currentNode !== false) { // get key $iteratorPosition = key($this->tsData); // check if node is subnode or value if (substr($iteratorPosition, -1) == '.') { // next subnode fond $this->iteratorPosition = $iteratorPosition; break; } } else { $iteratorPosition = false; $this->iteratorPosition = false; } $nextNode = true; } while ($iteratorPosition !== false); }
[ "public", "function", "iteratorNextNode", "(", ")", "{", "// INIT", "$", "iteratorPosition", "=", "null", ";", "$", "this", "->", "iteratorPosition", "=", "false", ";", "$", "nextNode", "=", "false", ";", "do", "{", "if", "(", "$", "nextNode", ")", "{", ...
Search next iterator node
[ "Search", "next", "iterator", "node" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/TypoScript.php#L200-L231
40,020
webdevops/TYPO3-metaseo
Classes/Utility/TypoScript.php
TypoScript.getValue
public function getValue($tsNodePath, $defaultValue = null) { $ret = $defaultValue; // extract TypoScript-path information $nodeFound = true; $nodeSections = explode('.', $tsNodePath); $nodeValueName = end($nodeSections); // remove last node from sections because we already got the node name unset($nodeSections[key($nodeSections)]); // walk though array to find node $nodeData = $this->tsData; if (!empty($nodeSections) && is_array($nodeSections)) { foreach ($nodeSections as $sectionName) { $sectionName .= '.'; if (is_array($nodeData) && array_key_exists($sectionName, $nodeData)) { $nodeData = $nodeData[$sectionName]; } else { $nodeFound = false; break; } } } // check if we got the value of the node if ($nodeFound && is_array($nodeData) && array_key_exists($nodeValueName, $nodeData)) { $ret = $nodeData[$nodeValueName]; } return $ret; }
php
public function getValue($tsNodePath, $defaultValue = null) { $ret = $defaultValue; // extract TypoScript-path information $nodeFound = true; $nodeSections = explode('.', $tsNodePath); $nodeValueName = end($nodeSections); // remove last node from sections because we already got the node name unset($nodeSections[key($nodeSections)]); // walk though array to find node $nodeData = $this->tsData; if (!empty($nodeSections) && is_array($nodeSections)) { foreach ($nodeSections as $sectionName) { $sectionName .= '.'; if (is_array($nodeData) && array_key_exists($sectionName, $nodeData)) { $nodeData = $nodeData[$sectionName]; } else { $nodeFound = false; break; } } } // check if we got the value of the node if ($nodeFound && is_array($nodeData) && array_key_exists($nodeValueName, $nodeData)) { $ret = $nodeData[$nodeValueName]; } return $ret; }
[ "public", "function", "getValue", "(", "$", "tsNodePath", ",", "$", "defaultValue", "=", "null", ")", "{", "$", "ret", "=", "$", "defaultValue", ";", "// extract TypoScript-path information", "$", "nodeFound", "=", "true", ";", "$", "nodeSections", "=", "explo...
Get value from node @param string $tsNodePath TypoScript node-path @param mixed $defaultValue Default value @return mixed Node value (or default value)
[ "Get", "value", "from", "node" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/TypoScript.php#L241-L275
40,021
webdevops/TYPO3-metaseo
Classes/Utility/TypoScript.php
TypoScript.getCObj
protected function getCObj() { if ($this->cObj === null) { $this->cObj = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer' ); } return $this->cObj; }
php
protected function getCObj() { if ($this->cObj === null) { $this->cObj = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer' ); } return $this->cObj; }
[ "protected", "function", "getCObj", "(", ")", "{", "if", "(", "$", "this", "->", "cObj", "===", "null", ")", "{", "$", "this", "->", "cObj", "=", "Typo3GeneralUtility", "::", "makeInstance", "(", "'TYPO3\\\\CMS\\\\Frontend\\\\ContentObject\\\\ContentObjectRenderer'"...
Return instance of \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer @return \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
[ "Return", "instance", "of", "\\", "TYPO3", "\\", "CMS", "\\", "Frontend", "\\", "ContentObject", "\\", "ContentObjectRenderer" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/TypoScript.php#L329-L338
40,022
webdevops/TYPO3-metaseo
Classes/Utility/RootPageUtility.php
RootPageUtility.getFrontendUrl
public static function getFrontendUrl($rootPid, $typeNum) { $domain = self::getDomain($rootPid); if (!empty($domain)) { $domain = 'http://' . $domain . '/'; } else { $domain = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); } $url = $domain . 'index.php?id=' . (int)$rootPid . '&type=' . (int)$typeNum; return $url; }
php
public static function getFrontendUrl($rootPid, $typeNum) { $domain = self::getDomain($rootPid); if (!empty($domain)) { $domain = 'http://' . $domain . '/'; } else { $domain = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); } $url = $domain . 'index.php?id=' . (int)$rootPid . '&type=' . (int)$typeNum; return $url; }
[ "public", "static", "function", "getFrontendUrl", "(", "$", "rootPid", ",", "$", "typeNum", ")", "{", "$", "domain", "=", "self", "::", "getDomain", "(", "$", "rootPid", ")", ";", "if", "(", "!", "empty", "(", "$", "domain", ")", ")", "{", "$", "do...
Build a frontend url @param integer $rootPid Root Page ID @param integer $typeNum Type num @return string
[ "Build", "a", "frontend", "url" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/RootPageUtility.php#L68-L79
40,023
webdevops/TYPO3-metaseo
Classes/Controller/Ajax/PageSeo/PageTitleSimController.php
PageTitleSimController.simulateTitle
protected function simulateTitle(array $page, $sysLanguage) { $this->getFrontendUtility()->initTsfe($page, null, $page, null, $sysLanguage); $pagetitle = $this->objectManager->get('Metaseo\\Metaseo\\Page\\Part\\PagetitlePart'); $ret = $pagetitle->main($page['title']); return $ret; }
php
protected function simulateTitle(array $page, $sysLanguage) { $this->getFrontendUtility()->initTsfe($page, null, $page, null, $sysLanguage); $pagetitle = $this->objectManager->get('Metaseo\\Metaseo\\Page\\Part\\PagetitlePart'); $ret = $pagetitle->main($page['title']); return $ret; }
[ "protected", "function", "simulateTitle", "(", "array", "$", "page", ",", "$", "sysLanguage", ")", "{", "$", "this", "->", "getFrontendUtility", "(", ")", "->", "initTsfe", "(", "$", "page", ",", "null", ",", "$", "page", ",", "null", ",", "$", "sysLan...
Generate simulated page title @param array $page Page @param integer $sysLanguage System language @return string
[ "Generate", "simulated", "page", "title" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Controller/Ajax/PageSeo/PageTitleSimController.php#L84-L92
40,024
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.initExtensionSupportNews
protected function initExtensionSupportNews() { if (empty($GLOBALS['TSFE']->register)) { return; } /** @var \Metaseo\Metaseo\Connector $connector */ $connector = $this->objectManager->get('Metaseo\\Metaseo\\Connector'); if (isset($GLOBALS['TSFE']->register['newsTitle'])) { $connector->setMetaTag('title', $GLOBALS['TSFE']->register['newsTitle']); } if (isset($GLOBALS['TSFE']->register['newsAuthor'])) { $connector->setMetaTag('author', $GLOBALS['TSFE']->register['newsAuthor']); } if (isset($GLOBALS['TSFE']->register['newsAuthoremail'])) { $connector->setMetaTag('email', $GLOBALS['TSFE']->register['newsAuthoremail']); } if (isset($GLOBALS['TSFE']->register['newsAuthorEmail'])) { $connector->setMetaTag('email', $GLOBALS['TSFE']->register['newsAuthorEmail']); } if (isset($GLOBALS['TSFE']->register['newsKeywords'])) { $connector->setMetaTag('keywords', $GLOBALS['TSFE']->register['newsKeywords']); } if (isset($GLOBALS['TSFE']->register['newsTeaser'])) { $connector->setMetaTag('description', $GLOBALS['TSFE']->register['newsTeaser']); } }
php
protected function initExtensionSupportNews() { if (empty($GLOBALS['TSFE']->register)) { return; } /** @var \Metaseo\Metaseo\Connector $connector */ $connector = $this->objectManager->get('Metaseo\\Metaseo\\Connector'); if (isset($GLOBALS['TSFE']->register['newsTitle'])) { $connector->setMetaTag('title', $GLOBALS['TSFE']->register['newsTitle']); } if (isset($GLOBALS['TSFE']->register['newsAuthor'])) { $connector->setMetaTag('author', $GLOBALS['TSFE']->register['newsAuthor']); } if (isset($GLOBALS['TSFE']->register['newsAuthoremail'])) { $connector->setMetaTag('email', $GLOBALS['TSFE']->register['newsAuthoremail']); } if (isset($GLOBALS['TSFE']->register['newsAuthorEmail'])) { $connector->setMetaTag('email', $GLOBALS['TSFE']->register['newsAuthorEmail']); } if (isset($GLOBALS['TSFE']->register['newsKeywords'])) { $connector->setMetaTag('keywords', $GLOBALS['TSFE']->register['newsKeywords']); } if (isset($GLOBALS['TSFE']->register['newsTeaser'])) { $connector->setMetaTag('description', $GLOBALS['TSFE']->register['newsTeaser']); } }
[ "protected", "function", "initExtensionSupportNews", "(", ")", "{", "if", "(", "empty", "(", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "register", ")", ")", "{", "return", ";", "}", "/** @var \\Metaseo\\Metaseo\\Connector $connector */", "$", "connector", "=", "...
Init extension support for "news" extension
[ "Init", "extension", "support", "for", "news", "extension" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L258-L290
40,025
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.applyStdWrap
protected function applyStdWrap($key, $value) { $key .= '.'; if (empty($this->stdWrapList[$key])) { return $value; } return $this->cObj->stdWrap($value, $this->stdWrapList[$key]); }
php
protected function applyStdWrap($key, $value) { $key .= '.'; if (empty($this->stdWrapList[$key])) { return $value; } return $this->cObj->stdWrap($value, $this->stdWrapList[$key]); }
[ "protected", "function", "applyStdWrap", "(", "$", "key", ",", "$", "value", ")", "{", "$", "key", ".=", "'.'", ";", "if", "(", "empty", "(", "$", "this", "->", "stdWrapList", "[", "$", "key", "]", ")", ")", "{", "return", "$", "value", ";", "}",...
Process stdWrap from stdWrap list @param string $key StdWrap-List key @param string $value Value @return string
[ "Process", "stdWrap", "from", "stdWrap", "list" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L300-L309
40,026
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.isXhtml
protected function isXhtml() { $ret = false; if (strpos($GLOBALS['TSFE']->config['config']['doctype'], 'xhtml') !== false) { // doctype xhtml $ret = true; } if (strpos($GLOBALS['TSFE']->config['config']['xhtmlDoctype'], 'xhtml') !== false) { // doctype xhtml doctype $ret = true; } return $ret; }
php
protected function isXhtml() { $ret = false; if (strpos($GLOBALS['TSFE']->config['config']['doctype'], 'xhtml') !== false) { // doctype xhtml $ret = true; } if (strpos($GLOBALS['TSFE']->config['config']['xhtmlDoctype'], 'xhtml') !== false) { // doctype xhtml doctype $ret = true; } return $ret; }
[ "protected", "function", "isXhtml", "(", ")", "{", "$", "ret", "=", "false", ";", "if", "(", "strpos", "(", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "config", "[", "'config'", "]", "[", "'doctype'", "]", ",", "'xhtml'", ")", "!==", "false", ")", "...
Check if page is configured as XHTML @return bool
[ "Check", "if", "page", "is", "configured", "as", "XHTML" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L326-L341
40,027
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.generateLink
protected function generateLink($url, array $conf = null, $disableMP = false) { if ($conf === null) { $conf = array(); } $mpOldConfValue = $GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue']; if ($disableMP === true) { // Disable MP usage in typolink - link to the real page instead $GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue'] = 1; } $conf['parameter'] = $url; $ret = $this->cObj->typoLink_URL($conf); // maybe baseUrlWrap is better? but breaks with realurl currently? $ret = GeneralUtility::fullUrl($ret); if ($disableMP === true) { // Restore old MP linking configuration $GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue'] = $mpOldConfValue; } return $ret; }
php
protected function generateLink($url, array $conf = null, $disableMP = false) { if ($conf === null) { $conf = array(); } $mpOldConfValue = $GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue']; if ($disableMP === true) { // Disable MP usage in typolink - link to the real page instead $GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue'] = 1; } $conf['parameter'] = $url; $ret = $this->cObj->typoLink_URL($conf); // maybe baseUrlWrap is better? but breaks with realurl currently? $ret = GeneralUtility::fullUrl($ret); if ($disableMP === true) { // Restore old MP linking configuration $GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue'] = $mpOldConfValue; } return $ret; }
[ "protected", "function", "generateLink", "(", "$", "url", ",", "array", "$", "conf", "=", "null", ",", "$", "disableMP", "=", "false", ")", "{", "if", "(", "$", "conf", "===", "null", ")", "{", "$", "conf", "=", "array", "(", ")", ";", "}", "$", ...
Generate a link via TYPO3-Api @param integer|string $url URL (id or string) @param array|NULL $conf URL configuration @param boolean $disableMP Disable mountpoint linking @return string URL
[ "Generate", "a", "link", "via", "TYPO3", "-", "Api" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L353-L377
40,028
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.detectCanonicalPage
protected function detectCanonicalPage(array $tsConfig = array()) { ##################### # Fetch typoscript config ##################### $strictMode = (bool)(int)$tsConfig['strict']; $noMpMode = (bool)(int)$tsConfig['noMP']; $linkConf = !empty($tsConfig['typolink.']) ? $tsConfig['typolink.'] : array(); $blacklist = !empty($tsConfig['blacklist.']) ? $tsConfig['blacklist.'] : array(); $linkParam = null; $linkMpMode = false; // Init link configuration if ($linkConf === null) { $linkConf = array(); } // Fetch chash $pageHash = null; if (!empty($GLOBALS['TSFE']->cHash)) { $pageHash = $GLOBALS['TSFE']->cHash; } ##################### # Blacklisting ##################### if (FrontendUtility::checkPageForBlacklist($blacklist)) { if ($strictMode) { if ($noMpMode && GeneralUtility::isMountpointInRootLine()) { // Mountpoint detected $linkParam = $GLOBALS['TSFE']->id; // Force removing of MP param $linkConf['addQueryString'] = 1; if (!empty($linkConf['addQueryString.']['exclude'])) { $linkConf['addQueryString.']['exclude'] .= ',id,MP,no_cache'; } else { $linkConf['addQueryString.']['exclude'] = ',id,MP,no_cache'; } // disable mount point linking $linkMpMode = true; } else { // force canonical-url to page url (without any parameters) $linkParam = $GLOBALS['TSFE']->id; } } else { // Blacklisted and no strict mode, we don't output canonical tag return null; } } ##################### # No cached pages ##################### if (!empty($GLOBALS['TSFE']->no_cache)) { if ($strictMode) { // force canonical-url to page url (without any parameters) $linkParam = $GLOBALS['TSFE']->id; } } ##################### # Content from PID ##################### if (!$linkParam && !empty($this->cObj->data['content_from_pid'])) { $linkParam = $this->cObj->data['content_from_pid']; } ##################### # Mountpoint ##################### if (!$linkParam && $noMpMode && GeneralUtility::isMountpointInRootLine()) { // Mountpoint detected $linkParam = $GLOBALS['TSFE']->id; // Force removing of MP param $linkConf['addQueryString'] = 1; if (!empty($linkConf['addQueryString.']['exclude'])) { $linkConf['addQueryString.']['exclude'] .= ',id,MP,no_cache'; } else { $linkConf['addQueryString.']['exclude'] = ',id,MP,no_cache'; } // disable mount point linking $linkMpMode = true; } ##################### # Normal page ##################### if (!$linkParam) { // Fetch pageUrl if ($pageHash !== null) { // Virtual plugin page, we have to use anchor or site script $linkParam = FrontendUtility::getCurrentUrl(); } else { $linkParam = $GLOBALS['TSFE']->id; } } ##################### # Fallback ##################### if ($strictMode && empty($linkParam)) { $linkParam = $GLOBALS['TSFE']->id; } return array($linkParam, $linkConf, $linkMpMode); }
php
protected function detectCanonicalPage(array $tsConfig = array()) { ##################### # Fetch typoscript config ##################### $strictMode = (bool)(int)$tsConfig['strict']; $noMpMode = (bool)(int)$tsConfig['noMP']; $linkConf = !empty($tsConfig['typolink.']) ? $tsConfig['typolink.'] : array(); $blacklist = !empty($tsConfig['blacklist.']) ? $tsConfig['blacklist.'] : array(); $linkParam = null; $linkMpMode = false; // Init link configuration if ($linkConf === null) { $linkConf = array(); } // Fetch chash $pageHash = null; if (!empty($GLOBALS['TSFE']->cHash)) { $pageHash = $GLOBALS['TSFE']->cHash; } ##################### # Blacklisting ##################### if (FrontendUtility::checkPageForBlacklist($blacklist)) { if ($strictMode) { if ($noMpMode && GeneralUtility::isMountpointInRootLine()) { // Mountpoint detected $linkParam = $GLOBALS['TSFE']->id; // Force removing of MP param $linkConf['addQueryString'] = 1; if (!empty($linkConf['addQueryString.']['exclude'])) { $linkConf['addQueryString.']['exclude'] .= ',id,MP,no_cache'; } else { $linkConf['addQueryString.']['exclude'] = ',id,MP,no_cache'; } // disable mount point linking $linkMpMode = true; } else { // force canonical-url to page url (without any parameters) $linkParam = $GLOBALS['TSFE']->id; } } else { // Blacklisted and no strict mode, we don't output canonical tag return null; } } ##################### # No cached pages ##################### if (!empty($GLOBALS['TSFE']->no_cache)) { if ($strictMode) { // force canonical-url to page url (without any parameters) $linkParam = $GLOBALS['TSFE']->id; } } ##################### # Content from PID ##################### if (!$linkParam && !empty($this->cObj->data['content_from_pid'])) { $linkParam = $this->cObj->data['content_from_pid']; } ##################### # Mountpoint ##################### if (!$linkParam && $noMpMode && GeneralUtility::isMountpointInRootLine()) { // Mountpoint detected $linkParam = $GLOBALS['TSFE']->id; // Force removing of MP param $linkConf['addQueryString'] = 1; if (!empty($linkConf['addQueryString.']['exclude'])) { $linkConf['addQueryString.']['exclude'] .= ',id,MP,no_cache'; } else { $linkConf['addQueryString.']['exclude'] = ',id,MP,no_cache'; } // disable mount point linking $linkMpMode = true; } ##################### # Normal page ##################### if (!$linkParam) { // Fetch pageUrl if ($pageHash !== null) { // Virtual plugin page, we have to use anchor or site script $linkParam = FrontendUtility::getCurrentUrl(); } else { $linkParam = $GLOBALS['TSFE']->id; } } ##################### # Fallback ##################### if ($strictMode && empty($linkParam)) { $linkParam = $GLOBALS['TSFE']->id; } return array($linkParam, $linkConf, $linkMpMode); }
[ "protected", "function", "detectCanonicalPage", "(", "array", "$", "tsConfig", "=", "array", "(", ")", ")", "{", "#####################", "# Fetch typoscript config", "#####################", "$", "strictMode", "=", "(", "bool", ")", "(", "int", ")", "$", "tsConfi...
Detect canonical page @param array $tsConfig TypoScript config setup @return null|array of (linkParam, linkConf, linkMpMode)
[ "Detect", "canonical", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L386-L501
40,029
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.advMetaTags
protected function advMetaTags(array &$metaTags, array $pageRecord, $sysLanguageId, array $customMetaTagList) { $pageRecordId = $pageRecord['uid']; $storeMeta = $this->getStoreMeta(); $advMetaTagCondition = array(); // ################# // External Og tags (from connector) // ################# if ($this->isAvailableExternalOgTags()) { // External OpenGraph support $advMetaTagCondition[] = 'tag_name NOT LIKE \'og:%\''; if (!empty($storeMeta['meta:og'])) { //overwrite known og tags $externalOgTags = $storeMeta['meta:og']; foreach ($externalOgTags as $tagName => $tagValue) { if (array_key_exists('og.' . $tagName, $metaTags)) { //_only_ known og tags $metaTags['og.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'property' => 'og:' . $tagName, 'content' => $tagValue, ), ); } } } } if ($this->isAvailableExternalOgCustomTags()) { $ogTagKeys = array(); if (!empty($storeMeta['custom:og'])) { $externalCustomOgTags = $storeMeta['custom:og']; foreach ($externalCustomOgTags as $tagName => $tagValue) { //take all tags $metaTags['og.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'property' => 'og:' . $tagName, 'content' => $tagValue, ), ); $ogTagKeys[] = 'og:' . $tagName; } } $advMetaTagCondition[] = DatabaseUtility::conditionNotIn('tag_name', $ogTagKeys, true); } // ################# // Adv meta tags (from editor) // ################# if (!empty($advMetaTagCondition)) { $advMetaTagCondition = '( ' . implode(') AND (', $advMetaTagCondition) . ' )'; } else { $advMetaTagCondition = '1=1'; } // Fetch list of meta tags from database $query = 'SELECT tag_name, tag_value FROM tx_metaseo_metatag WHERE pid = ' . (int)$pageRecordId . ' AND sys_language_uid = ' . (int)$sysLanguageId . ' AND ' . $advMetaTagCondition; $advMetaTagList = DatabaseUtility::getList($query); // Add metadata to tag list foreach ($advMetaTagList as $tagName => $tagValue) { if (substr($tagName, 0, 3) === 'og:') { $metaTags['og.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'property' => $tagName, 'content' => $tagValue, ), ); } else { $metaTags['adv.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'rel' => $tagName, //see https://github.com/webdevops/TYPO3-metaseo/issues/464 'href' => $tagValue, ), ); } } // ################# // Custom meta tags (from connector) // ################# foreach ($customMetaTagList as $tagName => $tagValue) { $metaTags['adv.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'rel' => $tagName, //see https://github.com/webdevops/TYPO3-metaseo/issues/464 'href' => $tagValue, ), ); } }
php
protected function advMetaTags(array &$metaTags, array $pageRecord, $sysLanguageId, array $customMetaTagList) { $pageRecordId = $pageRecord['uid']; $storeMeta = $this->getStoreMeta(); $advMetaTagCondition = array(); // ################# // External Og tags (from connector) // ################# if ($this->isAvailableExternalOgTags()) { // External OpenGraph support $advMetaTagCondition[] = 'tag_name NOT LIKE \'og:%\''; if (!empty($storeMeta['meta:og'])) { //overwrite known og tags $externalOgTags = $storeMeta['meta:og']; foreach ($externalOgTags as $tagName => $tagValue) { if (array_key_exists('og.' . $tagName, $metaTags)) { //_only_ known og tags $metaTags['og.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'property' => 'og:' . $tagName, 'content' => $tagValue, ), ); } } } } if ($this->isAvailableExternalOgCustomTags()) { $ogTagKeys = array(); if (!empty($storeMeta['custom:og'])) { $externalCustomOgTags = $storeMeta['custom:og']; foreach ($externalCustomOgTags as $tagName => $tagValue) { //take all tags $metaTags['og.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'property' => 'og:' . $tagName, 'content' => $tagValue, ), ); $ogTagKeys[] = 'og:' . $tagName; } } $advMetaTagCondition[] = DatabaseUtility::conditionNotIn('tag_name', $ogTagKeys, true); } // ################# // Adv meta tags (from editor) // ################# if (!empty($advMetaTagCondition)) { $advMetaTagCondition = '( ' . implode(') AND (', $advMetaTagCondition) . ' )'; } else { $advMetaTagCondition = '1=1'; } // Fetch list of meta tags from database $query = 'SELECT tag_name, tag_value FROM tx_metaseo_metatag WHERE pid = ' . (int)$pageRecordId . ' AND sys_language_uid = ' . (int)$sysLanguageId . ' AND ' . $advMetaTagCondition; $advMetaTagList = DatabaseUtility::getList($query); // Add metadata to tag list foreach ($advMetaTagList as $tagName => $tagValue) { if (substr($tagName, 0, 3) === 'og:') { $metaTags['og.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'property' => $tagName, 'content' => $tagValue, ), ); } else { $metaTags['adv.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'rel' => $tagName, //see https://github.com/webdevops/TYPO3-metaseo/issues/464 'href' => $tagValue, ), ); } } // ################# // Custom meta tags (from connector) // ################# foreach ($customMetaTagList as $tagName => $tagValue) { $metaTags['adv.' . $tagName] = array( 'tag' => 'meta', 'attributes' => array( 'rel' => $tagName, //see https://github.com/webdevops/TYPO3-metaseo/issues/464 'href' => $tagValue, ), ); } }
[ "protected", "function", "advMetaTags", "(", "array", "&", "$", "metaTags", ",", "array", "$", "pageRecord", ",", "$", "sysLanguageId", ",", "array", "$", "customMetaTagList", ")", "{", "$", "pageRecordId", "=", "$", "pageRecord", "[", "'uid'", "]", ";", "...
Advanced meta tags @param array $metaTags MetaTags @param array $pageRecord TSFE Page @param integer $sysLanguageId Sys Language ID @param array $customMetaTagList Custom Meta Tag list
[ "Advanced", "meta", "tags" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L511-L608
40,030
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.processMetaTags
protected function processMetaTags(array &$tags) { // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'metatagOutput', $this, $tags); // Add marker $markerList = array( '%YEAR%' => date('Y'), ); $keyList = array( 'meta.title', 'meta.description', 'meta.description.dc', 'meta.keywords', 'meta.keywords.dc', 'meta.copyright', 'meta.copyright.dc', 'meta.publisher.dc', ); foreach ($keyList as $key) { if (!empty($tags[$key]['attributes'])) { foreach ($markerList as $marker => $value) { foreach ($tags[$key]['attributes'] as &$metaTagAttribute) { // only replace markers if they are present if (strpos($metaTagAttribute, $marker) !== false) { $metaTagAttribute = str_replace($marker, $value, $metaTagAttribute); } } unset($metaTagAttribute); } } } }
php
protected function processMetaTags(array &$tags) { // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'metatagOutput', $this, $tags); // Add marker $markerList = array( '%YEAR%' => date('Y'), ); $keyList = array( 'meta.title', 'meta.description', 'meta.description.dc', 'meta.keywords', 'meta.keywords.dc', 'meta.copyright', 'meta.copyright.dc', 'meta.publisher.dc', ); foreach ($keyList as $key) { if (!empty($tags[$key]['attributes'])) { foreach ($markerList as $marker => $value) { foreach ($tags[$key]['attributes'] as &$metaTagAttribute) { // only replace markers if they are present if (strpos($metaTagAttribute, $marker) !== false) { $metaTagAttribute = str_replace($marker, $value, $metaTagAttribute); } } unset($metaTagAttribute); } } } }
[ "protected", "function", "processMetaTags", "(", "array", "&", "$", "tags", ")", "{", "// Call hook", "GeneralUtility", "::", "callHookAndSignal", "(", "__CLASS__", ",", "'metatagOutput'", ",", "$", "this", ",", "$", "tags", ")", ";", "// Add marker", "$", "ma...
Process meta tags @param array $tags
[ "Process", "meta", "tags" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L615-L649
40,031
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.renderMetaTags
protected function renderMetaTags(array $metaTags) { $ret = array(); $isXhtml = $this->isXhtml(); foreach ($metaTags as $metaTag) { $tag = $metaTag['tag']; $attributes = array(); foreach ($metaTag['attributes'] as $key => $value) { $attributes[] = $key . '="' . htmlspecialchars($value) . '"'; } if ($isXhtml) { $ret[] = '<' . $tag . ' ' . implode(' ', $attributes) . '/>'; } else { $ret[] = '<' . $tag . ' ' . implode(' ', $attributes) . '>'; } } $separator = "\n"; return $separator . implode($separator, $ret) . $separator; }
php
protected function renderMetaTags(array $metaTags) { $ret = array(); $isXhtml = $this->isXhtml(); foreach ($metaTags as $metaTag) { $tag = $metaTag['tag']; $attributes = array(); foreach ($metaTag['attributes'] as $key => $value) { $attributes[] = $key . '="' . htmlspecialchars($value) . '"'; } if ($isXhtml) { $ret[] = '<' . $tag . ' ' . implode(' ', $attributes) . '/>'; } else { $ret[] = '<' . $tag . ' ' . implode(' ', $attributes) . '>'; } } $separator = "\n"; return $separator . implode($separator, $ret) . $separator; }
[ "protected", "function", "renderMetaTags", "(", "array", "$", "metaTags", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "$", "isXhtml", "=", "$", "this", "->", "isXhtml", "(", ")", ";", "foreach", "(", "$", "metaTags", "as", "$", "metaTag", ")",...
Render meta tags @param array $metaTags List of metatags with configuration (tag, attributes) @return string
[ "Render", "meta", "tags" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L659-L684
40,032
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.collectMetaDataFromConnector
protected function collectMetaDataFromConnector() { $ret = array(); $storeMeta = $this->getStoreMeta(); // Std meta tags foreach ($storeMeta['meta'] as $metaKey => $metaValue) { if ($metaValue === null) { // Remove meta unset($this->tsSetupSeo[$metaKey]); } elseif (!empty($metaValue)) { $this->tsSetupSeo[$metaKey] = trim($metaValue); } } // Custom meta tags foreach ($storeMeta['custom'] as $metaKey => $metaValue) { if ($metaValue === null) { // Remove meta unset($ret[$metaKey]); } elseif (!empty($metaValue)) { $ret[$metaKey] = trim($metaValue); } } return $ret; }
php
protected function collectMetaDataFromConnector() { $ret = array(); $storeMeta = $this->getStoreMeta(); // Std meta tags foreach ($storeMeta['meta'] as $metaKey => $metaValue) { if ($metaValue === null) { // Remove meta unset($this->tsSetupSeo[$metaKey]); } elseif (!empty($metaValue)) { $this->tsSetupSeo[$metaKey] = trim($metaValue); } } // Custom meta tags foreach ($storeMeta['custom'] as $metaKey => $metaValue) { if ($metaValue === null) { // Remove meta unset($ret[$metaKey]); } elseif (!empty($metaValue)) { $ret[$metaKey] = trim($metaValue); } } return $ret; }
[ "protected", "function", "collectMetaDataFromConnector", "(", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "$", "storeMeta", "=", "$", "this", "->", "getStoreMeta", "(", ")", ";", "// Std meta tags", "foreach", "(", "$", "storeMeta", "[", "'meta'", "...
Collect metadata from connector @return mixed
[ "Collect", "metadata", "from", "connector" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L808-L835
40,033
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.generateGeoPosMetaTags
protected function generateGeoPosMetaTags() { // Geo-Position if (!empty($this->tsSetupSeo['geoPositionLatitude']) && !empty($this->tsSetupSeo['geoPositionLongitude'])) { $this->metaTagList['geo.icmb'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'ICBM', 'content' => $this->tsSetupSeo['geoPositionLatitude'] . ', ' . $this->tsSetupSeo['geoPositionLongitude'], ), ); $this->metaTagList['geo.position'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'geo.position', 'content' => $this->tsSetupSeo['geoPositionLatitude'] . ';' . $this->tsSetupSeo['geoPositionLongitude'], ), ); } // Geo-Region if (!empty($this->tsSetupSeo['geoRegion'])) { $this->metaTagList['geo.region'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'geo.region', 'content' => $this->tsSetupSeo['geoRegion'], ), ); } // Geo Placename if (!empty($this->tsSetupSeo['geoPlacename'])) { $this->metaTagList['geo.placename'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'geo.placename', 'content' => $this->tsSetupSeo['geoPlacename'], ), ); } }
php
protected function generateGeoPosMetaTags() { // Geo-Position if (!empty($this->tsSetupSeo['geoPositionLatitude']) && !empty($this->tsSetupSeo['geoPositionLongitude'])) { $this->metaTagList['geo.icmb'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'ICBM', 'content' => $this->tsSetupSeo['geoPositionLatitude'] . ', ' . $this->tsSetupSeo['geoPositionLongitude'], ), ); $this->metaTagList['geo.position'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'geo.position', 'content' => $this->tsSetupSeo['geoPositionLatitude'] . ';' . $this->tsSetupSeo['geoPositionLongitude'], ), ); } // Geo-Region if (!empty($this->tsSetupSeo['geoRegion'])) { $this->metaTagList['geo.region'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'geo.region', 'content' => $this->tsSetupSeo['geoRegion'], ), ); } // Geo Placename if (!empty($this->tsSetupSeo['geoPlacename'])) { $this->metaTagList['geo.placename'] = array( 'tag' => 'meta', 'attributes' => array( 'name' => 'geo.placename', 'content' => $this->tsSetupSeo['geoPlacename'], ), ); } }
[ "protected", "function", "generateGeoPosMetaTags", "(", ")", "{", "// Geo-Position", "if", "(", "!", "empty", "(", "$", "this", "->", "tsSetupSeo", "[", "'geoPositionLatitude'", "]", ")", "&&", "!", "empty", "(", "$", "this", "->", "tsSetupSeo", "[", "'geoPo...
Generate geo position MetaTags
[ "Generate", "geo", "position", "MetaTags" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L1104-L1147
40,034
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.generateUserAgentMetaTags
protected function generateUserAgentMetaTags() { if (!empty($this->tsSetupSeo['ieCompatibilityMode'])) { if (is_numeric($this->tsSetupSeo['ieCompatibilityMode'])) { $this->metaTagList['ua.msie.compat'] = array( 'tag' => 'meta', 'attributes' => array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EmulateIE' . (int)$this->tsSetupSeo['ieCompatibilityMode'], ), ); } else { $this->metaTagList['ua.msie.compat'] = array( 'tag' => 'meta', 'attributes' => array( 'http-equiv' => 'X-UA-Compatible', 'content' => $this->tsSetupSeo['ieCompatibilityMode'], ), ); } } }
php
protected function generateUserAgentMetaTags() { if (!empty($this->tsSetupSeo['ieCompatibilityMode'])) { if (is_numeric($this->tsSetupSeo['ieCompatibilityMode'])) { $this->metaTagList['ua.msie.compat'] = array( 'tag' => 'meta', 'attributes' => array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EmulateIE' . (int)$this->tsSetupSeo['ieCompatibilityMode'], ), ); } else { $this->metaTagList['ua.msie.compat'] = array( 'tag' => 'meta', 'attributes' => array( 'http-equiv' => 'X-UA-Compatible', 'content' => $this->tsSetupSeo['ieCompatibilityMode'], ), ); } } }
[ "protected", "function", "generateUserAgentMetaTags", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "tsSetupSeo", "[", "'ieCompatibilityMode'", "]", ")", ")", "{", "if", "(", "is_numeric", "(", "$", "this", "->", "tsSetupSeo", "[", "'ieCo...
Generate user agent metatags
[ "Generate", "user", "agent", "metatags" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L1214-L1235
40,035
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.generateCanonicalUrl
protected function generateCanonicalUrl() { $extCompat7 = ExtensionManagementUtility::isLoaded('compatibility7'); //User has specified a canonical URL in the page properties if (!empty($this->pageRecord['tx_metaseo_canonicalurl'])) { return $this->generateLink($this->pageRecord['tx_metaseo_canonicalurl']); } //Fallback to global settings to generate Url if (!empty($this->tsSetupSeo['canonicalUrl'])) { list($clUrl, $clLinkConf, $clDisableMpMode) = $this->detectCanonicalPage( $this->tsSetupSeo['canonicalUrl.'] ); if (!empty($clUrl) && isset($clLinkConf) && isset($clDisableMpMode)) { $url = $this->generateLink($clUrl, $clLinkConf, $clDisableMpMode); return $this->setFallbackProtocol( $extCompat7 ? $this->pageRecord['url_scheme'] : null, //page properties protocol selection $this->tsSetupSeo['canonicalUrl.']['fallbackProtocol'], $url ); } } return null; }
php
protected function generateCanonicalUrl() { $extCompat7 = ExtensionManagementUtility::isLoaded('compatibility7'); //User has specified a canonical URL in the page properties if (!empty($this->pageRecord['tx_metaseo_canonicalurl'])) { return $this->generateLink($this->pageRecord['tx_metaseo_canonicalurl']); } //Fallback to global settings to generate Url if (!empty($this->tsSetupSeo['canonicalUrl'])) { list($clUrl, $clLinkConf, $clDisableMpMode) = $this->detectCanonicalPage( $this->tsSetupSeo['canonicalUrl.'] ); if (!empty($clUrl) && isset($clLinkConf) && isset($clDisableMpMode)) { $url = $this->generateLink($clUrl, $clLinkConf, $clDisableMpMode); return $this->setFallbackProtocol( $extCompat7 ? $this->pageRecord['url_scheme'] : null, //page properties protocol selection $this->tsSetupSeo['canonicalUrl.']['fallbackProtocol'], $url ); } } return null; }
[ "protected", "function", "generateCanonicalUrl", "(", ")", "{", "$", "extCompat7", "=", "ExtensionManagementUtility", "::", "isLoaded", "(", "'compatibility7'", ")", ";", "//User has specified a canonical URL in the page properties", "if", "(", "!", "empty", "(", "$", "...
Generate CanonicalUrl for this page @return null|string Url or null if Url is empty
[ "Generate", "CanonicalUrl", "for", "this", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L1329-L1353
40,036
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.setFallbackProtocol
protected function setFallbackProtocol($pagePropertiesProtocol, $canonicalFallbackProtocol, $url) { $url = ltrim($url); if (empty($url)) { return null; } if (empty($canonicalFallbackProtocol)) { // Fallback not defined return $url; } if (!empty($pagePropertiesProtocol)) { // Protocol is well-defined via page properties (default is '0' with type string). // User cannot request with wrong protocol. Canonical URL cannot be wrong. return $url; } //get length of protocol substring $protocolLength = $this->getProtocolLength($url); if (is_null($protocolLength)) { //unknown protocol return $url; } //replace protocol prefix return substr_replace($url, $canonicalFallbackProtocol . '://', 0, $protocolLength); }
php
protected function setFallbackProtocol($pagePropertiesProtocol, $canonicalFallbackProtocol, $url) { $url = ltrim($url); if (empty($url)) { return null; } if (empty($canonicalFallbackProtocol)) { // Fallback not defined return $url; } if (!empty($pagePropertiesProtocol)) { // Protocol is well-defined via page properties (default is '0' with type string). // User cannot request with wrong protocol. Canonical URL cannot be wrong. return $url; } //get length of protocol substring $protocolLength = $this->getProtocolLength($url); if (is_null($protocolLength)) { //unknown protocol return $url; } //replace protocol prefix return substr_replace($url, $canonicalFallbackProtocol . '://', 0, $protocolLength); }
[ "protected", "function", "setFallbackProtocol", "(", "$", "pagePropertiesProtocol", ",", "$", "canonicalFallbackProtocol", ",", "$", "url", ")", "{", "$", "url", "=", "ltrim", "(", "$", "url", ")", ";", "if", "(", "empty", "(", "$", "url", ")", ")", "{",...
Replaces protocol in URL with a fallback protocol Missing or unknown protocol will not be replaced @param string $pagePropertiesProtocol protocol from page properties @param string $canonicalFallbackProtocol fallback protocol to go for if protocol in page properties is undefined @param string $url @return string|null
[ "Replaces", "protocol", "in", "URL", "with", "a", "fallback", "protocol", "Missing", "or", "unknown", "protocol", "will", "not", "be", "replaced" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L1365-L1392
40,037
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.getProtocolLength
protected function getProtocolLength($url) { if (substr_compare($url, 'http://', 0, 7, true) === 0) { return 7; } if (substr_compare($url, 'https://', 0, 8, true) === 0) { return 8; } if (substr_compare($url, '//', 0, 2, false) === 0) { return 2; } return null; }
php
protected function getProtocolLength($url) { if (substr_compare($url, 'http://', 0, 7, true) === 0) { return 7; } if (substr_compare($url, 'https://', 0, 8, true) === 0) { return 8; } if (substr_compare($url, '//', 0, 2, false) === 0) { return 2; } return null; }
[ "protected", "function", "getProtocolLength", "(", "$", "url", ")", "{", "if", "(", "substr_compare", "(", "$", "url", ",", "'http://'", ",", "0", ",", "7", ",", "true", ")", "===", "0", ")", "{", "return", "7", ";", "}", "if", "(", "substr_compare",...
Case-insensitive detection of the protocol used in an Url. Returns protocol length if found. @param $url @return int|null length of protocol or null for unknown protocol
[ "Case", "-", "insensitive", "detection", "of", "the", "protocol", "used", "in", "an", "Url", ".", "Returns", "protocol", "length", "if", "found", "." ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L1401-L1414
40,038
webdevops/TYPO3-metaseo
Classes/Page/Part/MetatagPart.php
MetatagPart.convertOpenGraphTypoScriptToMetaTags
protected function convertOpenGraphTypoScriptToMetaTags(array $prefixes, array $tsSetupSeoOg) { // Get list of tags (filtered array) $ogTagNameList = array_keys($tsSetupSeoOg); $ogTagNameList = array_unique( array_map( function ($item) { return rtrim($item, '.'); }, $ogTagNameList ) ); foreach ($ogTagNameList as $ogTagName) { $ogTagValue = null; // Check if TypoScript value is a simple one (eg. title = foo) // or it is a cObject if (!empty($tsSetupSeoOg[$ogTagName]) && !array_key_exists($ogTagName . '.', $tsSetupSeoOg)) { // Simple value $ogTagValue = $tsSetupSeoOg[$ogTagName]; } elseif (!empty($tsSetupSeoOg[$ogTagName])) { // Content object (eg. TEXT) $ogTagValue = $this->cObj->cObjGetSingle( $tsSetupSeoOg[$ogTagName], $tsSetupSeoOg[$ogTagName . '.'] ); } elseif (!array_key_exists($ogTagName, $tsSetupSeoOg) && array_key_exists($ogTagName . '.', $tsSetupSeoOg)) { // Nested object (e.g. image) array_push($prefixes, $ogTagName); $this->convertOpenGraphTypoScriptToMetaTags($prefixes, $tsSetupSeoOg[$ogTagName . '.']); array_pop($prefixes); } if ($ogTagValue !== null && strlen($ogTagValue) >= 1) { $path = $prefixes; $path[] = $ogTagName; $this->metaTagList[implode('.', $path)] = array( 'tag' => 'meta', 'attributes' => array( 'property' => implode(':', $path), 'content' => $ogTagValue, ), ); } } }
php
protected function convertOpenGraphTypoScriptToMetaTags(array $prefixes, array $tsSetupSeoOg) { // Get list of tags (filtered array) $ogTagNameList = array_keys($tsSetupSeoOg); $ogTagNameList = array_unique( array_map( function ($item) { return rtrim($item, '.'); }, $ogTagNameList ) ); foreach ($ogTagNameList as $ogTagName) { $ogTagValue = null; // Check if TypoScript value is a simple one (eg. title = foo) // or it is a cObject if (!empty($tsSetupSeoOg[$ogTagName]) && !array_key_exists($ogTagName . '.', $tsSetupSeoOg)) { // Simple value $ogTagValue = $tsSetupSeoOg[$ogTagName]; } elseif (!empty($tsSetupSeoOg[$ogTagName])) { // Content object (eg. TEXT) $ogTagValue = $this->cObj->cObjGetSingle( $tsSetupSeoOg[$ogTagName], $tsSetupSeoOg[$ogTagName . '.'] ); } elseif (!array_key_exists($ogTagName, $tsSetupSeoOg) && array_key_exists($ogTagName . '.', $tsSetupSeoOg)) { // Nested object (e.g. image) array_push($prefixes, $ogTagName); $this->convertOpenGraphTypoScriptToMetaTags($prefixes, $tsSetupSeoOg[$ogTagName . '.']); array_pop($prefixes); } if ($ogTagValue !== null && strlen($ogTagValue) >= 1) { $path = $prefixes; $path[] = $ogTagName; $this->metaTagList[implode('.', $path)] = array( 'tag' => 'meta', 'attributes' => array( 'property' => implode(':', $path), 'content' => $ogTagValue, ), ); } } }
[ "protected", "function", "convertOpenGraphTypoScriptToMetaTags", "(", "array", "$", "prefixes", ",", "array", "$", "tsSetupSeoOg", ")", "{", "// Get list of tags (filtered array)", "$", "ogTagNameList", "=", "array_keys", "(", "$", "tsSetupSeoOg", ")", ";", "$", "ogTa...
Convert nested TypoScript to OpenGraph MetaTags @param array $prefixes @param array $tsSetupSeoOg
[ "Convert", "nested", "TypoScript", "to", "OpenGraph", "MetaTags" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/MetatagPart.php#L1432-L1478
40,039
webdevops/TYPO3-metaseo
Classes/Utility/SitemapUtility.php
SitemapUtility.index
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; } }
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"...
Insert into sitemap @param array $pageData page information
[ "Insert", "into", "sitemap" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/SitemapUtility.php#L83-L155
40,040
webdevops/TYPO3-metaseo
Classes/Utility/SitemapUtility.php
SitemapUtility.expire
public static function expire() { // ##################### // Delete expired entries // ##################### $query = 'DELETE FROM tx_metaseo_sitemap WHERE is_blacklisted = 0 AND expire <= ' . (int)time(); DatabaseUtility::exec($query); // ##################### // Deleted or // excluded pages // ##################### $query = 'SELECT ts.uid FROM tx_metaseo_sitemap ts LEFT JOIN pages p ON p.uid = ts.page_uid AND p.deleted = 0 AND p.hidden = 0 AND p.tx_metaseo_is_exclude = 0 AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . ' WHERE p.uid IS NULL'; $deletedSitemapPages = DatabaseUtility::getColWithIndex($query); // delete pages if (!empty($deletedSitemapPages)) { $query = 'DELETE FROM tx_metaseo_sitemap WHERE uid IN (' . implode(',', $deletedSitemapPages) . ') AND is_blacklisted = 0'; DatabaseUtility::exec($query); } }
php
public static function expire() { // ##################### // Delete expired entries // ##################### $query = 'DELETE FROM tx_metaseo_sitemap WHERE is_blacklisted = 0 AND expire <= ' . (int)time(); DatabaseUtility::exec($query); // ##################### // Deleted or // excluded pages // ##################### $query = 'SELECT ts.uid FROM tx_metaseo_sitemap ts LEFT JOIN pages p ON p.uid = ts.page_uid AND p.deleted = 0 AND p.hidden = 0 AND p.tx_metaseo_is_exclude = 0 AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . ' WHERE p.uid IS NULL'; $deletedSitemapPages = DatabaseUtility::getColWithIndex($query); // delete pages if (!empty($deletedSitemapPages)) { $query = 'DELETE FROM tx_metaseo_sitemap WHERE uid IN (' . implode(',', $deletedSitemapPages) . ') AND is_blacklisted = 0'; DatabaseUtility::exec($query); } }
[ "public", "static", "function", "expire", "(", ")", "{", "// #####################", "// Delete expired entries", "// #####################", "$", "query", "=", "'DELETE FROM tx_metaseo_sitemap\n WHERE is_blacklisted = 0\n AND expire <= '", ...
Clear outdated and invalid pages from sitemap table
[ "Clear", "outdated", "and", "invalid", "pages", "from", "sitemap", "table" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/SitemapUtility.php#L160-L194
40,041
webdevops/TYPO3-metaseo
Classes/Utility/SitemapUtility.php
SitemapUtility.getList
public static function getList($rootPid, $languageId = null) { $sitemapList = array(); $pageList = array(); $typo3Pids = array(); $query = 'SELECT ts.* FROM tx_metaseo_sitemap ts INNER JOIN pages p ON p.uid = ts.page_uid AND p.deleted = 0 AND p.hidden = 0 AND p.tx_metaseo_is_exclude = 0 AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . ' WHERE ts.page_rootpid = ' . (int)$rootPid . ' AND ts.is_blacklisted = 0'; if ($languageId !== null) { $query .= ' AND ts.page_language = ' . (int)$languageId; } $query .= ' ORDER BY ts.page_depth ASC, p.pid ASC, p.sorting ASC'; $resultRows = DatabaseUtility::getAll($query); if (!$resultRows) { return self::getListArray(); //empty } foreach ($resultRows as $row) { $sitemapList[] = $row; $sitemapPageId = $row['page_uid']; $typo3Pids[$sitemapPageId] = (int)$sitemapPageId; } if (!empty($typo3Pids)) { $query = 'SELECT * FROM pages WHERE ' . DatabaseUtility::conditionIn('uid', $typo3Pids); $pageList = DatabaseUtility::getAllWithIndex($query, 'uid'); if (empty($pageList)) { return self::getListArray(); //empty } } return self::getListArray($sitemapList, $pageList); }
php
public static function getList($rootPid, $languageId = null) { $sitemapList = array(); $pageList = array(); $typo3Pids = array(); $query = 'SELECT ts.* FROM tx_metaseo_sitemap ts INNER JOIN pages p ON p.uid = ts.page_uid AND p.deleted = 0 AND p.hidden = 0 AND p.tx_metaseo_is_exclude = 0 AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . ' WHERE ts.page_rootpid = ' . (int)$rootPid . ' AND ts.is_blacklisted = 0'; if ($languageId !== null) { $query .= ' AND ts.page_language = ' . (int)$languageId; } $query .= ' ORDER BY ts.page_depth ASC, p.pid ASC, p.sorting ASC'; $resultRows = DatabaseUtility::getAll($query); if (!$resultRows) { return self::getListArray(); //empty } foreach ($resultRows as $row) { $sitemapList[] = $row; $sitemapPageId = $row['page_uid']; $typo3Pids[$sitemapPageId] = (int)$sitemapPageId; } if (!empty($typo3Pids)) { $query = 'SELECT * FROM pages WHERE ' . DatabaseUtility::conditionIn('uid', $typo3Pids); $pageList = DatabaseUtility::getAllWithIndex($query, 'uid'); if (empty($pageList)) { return self::getListArray(); //empty } } return self::getListArray($sitemapList, $pageList); }
[ "public", "static", "function", "getList", "(", "$", "rootPid", ",", "$", "languageId", "=", "null", ")", "{", "$", "sitemapList", "=", "array", "(", ")", ";", "$", "pageList", "=", "array", "(", ")", ";", "$", "typo3Pids", "=", "array", "(", ")", ...
Return list of sitemap pages @param integer $rootPid Root page id of tree @param integer $languageId Limit to language id @return array
[ "Return", "list", "of", "sitemap", "pages" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/SitemapUtility.php#L241-L293
40,042
webdevops/TYPO3-metaseo
Classes/Sitemap/Generator/AbstractGenerator.php
AbstractGenerator.pageCount
public function pageCount() { $pageLimit = GeneralUtility::getRootSettingValue('sitemap_page_limit', null); if (empty($pageLimit)) { $pageLimit = 1000; } $pageItems = count($this->sitemapPages); $pageCount = ceil($pageItems / $pageLimit); return $pageCount; }
php
public function pageCount() { $pageLimit = GeneralUtility::getRootSettingValue('sitemap_page_limit', null); if (empty($pageLimit)) { $pageLimit = 1000; } $pageItems = count($this->sitemapPages); $pageCount = ceil($pageItems / $pageLimit); return $pageCount; }
[ "public", "function", "pageCount", "(", ")", "{", "$", "pageLimit", "=", "GeneralUtility", "::", "getRootSettingValue", "(", "'sitemap_page_limit'", ",", "null", ")", ";", "if", "(", "empty", "(", "$", "pageLimit", ")", ")", "{", "$", "pageLimit", "=", "10...
Return page count @return integer
[ "Return", "page", "count" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Sitemap/Generator/AbstractGenerator.php#L131-L143
40,043
webdevops/TYPO3-metaseo
Classes/Hook/Extension/TtnewsExtension.php
TtnewsExtension.extraItemMarkerProcessor
public function extraItemMarkerProcessor(array $markerArray, array $row, array $lConf, AbstractPlugin $ttnewsObj) { $theCode = (string)strtoupper(trim($ttnewsObj->theCode)); $connector = GeneralUtility::makeInstance('Metaseo\\Metaseo\\Connector'); switch ($theCode) { case 'SINGLE': case 'SINGLE2': // Title if (!empty($row['title'])) { $connector->setMetaTag('title', $row['title']); } // Description if (!empty($row['short'])) { $connector->setMetaTag('description', $row['short']); } // Keywords if (!empty($row['keywords'])) { $connector->setMetaTag('keywords', $row['keywords']); } // Short/Description if (!empty($row['short'])) { $connector->setMetaTag('description', $row['short']); } // Author if (!empty($row['author'])) { $connector->setMetaTag('author', $row['author']); } // E-Mail if (!empty($row['author_email'])) { $connector->setMetaTag('email', $row['author_email']); } break; } return $markerArray; }
php
public function extraItemMarkerProcessor(array $markerArray, array $row, array $lConf, AbstractPlugin $ttnewsObj) { $theCode = (string)strtoupper(trim($ttnewsObj->theCode)); $connector = GeneralUtility::makeInstance('Metaseo\\Metaseo\\Connector'); switch ($theCode) { case 'SINGLE': case 'SINGLE2': // Title if (!empty($row['title'])) { $connector->setMetaTag('title', $row['title']); } // Description if (!empty($row['short'])) { $connector->setMetaTag('description', $row['short']); } // Keywords if (!empty($row['keywords'])) { $connector->setMetaTag('keywords', $row['keywords']); } // Short/Description if (!empty($row['short'])) { $connector->setMetaTag('description', $row['short']); } // Author if (!empty($row['author'])) { $connector->setMetaTag('author', $row['author']); } // E-Mail if (!empty($row['author_email'])) { $connector->setMetaTag('email', $row['author_email']); } break; } return $markerArray; }
[ "public", "function", "extraItemMarkerProcessor", "(", "array", "$", "markerArray", ",", "array", "$", "row", ",", "array", "$", "lConf", ",", "AbstractPlugin", "$", "ttnewsObj", ")", "{", "$", "theCode", "=", "(", "string", ")", "strtoupper", "(", "trim", ...
Extra item marker hook for metatag fetching @param array $markerArray Marker array @param array $row Current tt_news row @param array $lConf Local configuration @param AbstractPlugin $ttnewsObj Pi-object from tt_news @return array Marker array (not changed)
[ "Extra", "item", "marker", "hook", "for", "metatag", "fetching" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/Extension/TtnewsExtension.php#L48-L90
40,044
webdevops/TYPO3-metaseo
Classes/Sitemap/Generator/XmlGenerator.php
XmlGenerator.sitemapIndex
public function sitemapIndex() { $pageLimit = 10000; if (isset($this->tsSetup['pageLimit']) && $this->tsSetup['pageLimit'] != '') { $pageLimit = (int)$this->tsSetup['pageLimit']; } $sitemaps = array(); $pageItems = count($this->sitemapPages); $pageCount = ceil($pageItems / $pageLimit); $linkConf = array( 'parameter' => GeneralUtility::getCurrentPid() . ',' . $GLOBALS['TSFE']->type, 'additionalParams' => '', 'useCacheHash' => 1, ); for ($i = 0; $i < $pageCount; $i++) { if ($this->indexPathTemplate) { $link = GeneralUtility::fullUrl(str_replace('###PAGE###', $i, $this->indexPathTemplate)); $sitemaps[] = $link; } else { $linkConf['additionalParams'] = '&page=' . ($i + 1); $sitemaps[] = GeneralUtility::fullUrl($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf)); } } $ret = '<?xml version="1.0" encoding="UTF-8"?>'; $ret .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" ' . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'; $ret .= ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 ' . 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'; // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'sitemapXmlIndexSitemapList', $this, $sitemaps); foreach ($sitemaps as $sitemapPage) { $ret .= '<sitemap><loc>' . htmlspecialchars($sitemapPage) . '</loc></sitemap>'; } $ret .= '</sitemapindex>'; // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'sitemapXmlIndexOutput', $this, $ret); return $ret; }
php
public function sitemapIndex() { $pageLimit = 10000; if (isset($this->tsSetup['pageLimit']) && $this->tsSetup['pageLimit'] != '') { $pageLimit = (int)$this->tsSetup['pageLimit']; } $sitemaps = array(); $pageItems = count($this->sitemapPages); $pageCount = ceil($pageItems / $pageLimit); $linkConf = array( 'parameter' => GeneralUtility::getCurrentPid() . ',' . $GLOBALS['TSFE']->type, 'additionalParams' => '', 'useCacheHash' => 1, ); for ($i = 0; $i < $pageCount; $i++) { if ($this->indexPathTemplate) { $link = GeneralUtility::fullUrl(str_replace('###PAGE###', $i, $this->indexPathTemplate)); $sitemaps[] = $link; } else { $linkConf['additionalParams'] = '&page=' . ($i + 1); $sitemaps[] = GeneralUtility::fullUrl($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf)); } } $ret = '<?xml version="1.0" encoding="UTF-8"?>'; $ret .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" ' . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'; $ret .= ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 ' . 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'; // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'sitemapXmlIndexSitemapList', $this, $sitemaps); foreach ($sitemaps as $sitemapPage) { $ret .= '<sitemap><loc>' . htmlspecialchars($sitemapPage) . '</loc></sitemap>'; } $ret .= '</sitemapindex>'; // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'sitemapXmlIndexOutput', $this, $ret); return $ret; }
[ "public", "function", "sitemapIndex", "(", ")", "{", "$", "pageLimit", "=", "10000", ";", "if", "(", "isset", "(", "$", "this", "->", "tsSetup", "[", "'pageLimit'", "]", ")", "&&", "$", "this", "->", "tsSetup", "[", "'pageLimit'", "]", "!=", "''", ")...
Create sitemap index @return string
[ "Create", "sitemap", "index" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Sitemap/Generator/XmlGenerator.php#L46-L95
40,045
webdevops/TYPO3-metaseo
Classes/Page/SitemapXmlPage.php
SitemapXmlPage.build
protected function build() { $page = Typo3GeneralUtility::_GP('page'); /** @var \Metaseo\Metaseo\Sitemap\Generator\XmlGenerator $generator */ $generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator'); if (empty($page) || $page === 'index') { return $generator->sitemapIndex(); } else { return $generator->sitemap($page); } }
php
protected function build() { $page = Typo3GeneralUtility::_GP('page'); /** @var \Metaseo\Metaseo\Sitemap\Generator\XmlGenerator $generator */ $generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator'); if (empty($page) || $page === 'index') { return $generator->sitemapIndex(); } else { return $generator->sitemap($page); } }
[ "protected", "function", "build", "(", ")", "{", "$", "page", "=", "Typo3GeneralUtility", "::", "_GP", "(", "'page'", ")", ";", "/** @var \\Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator $generator */", "$", "generator", "=", "$", "this", "->", "objectManager", "-...
Build sitemap index or specific page @return string
[ "Build", "sitemap", "index", "or", "specific", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/SitemapXmlPage.php#L70-L82
40,046
webdevops/TYPO3-metaseo
Classes/Hook/SitemapIndexHook.php
SitemapIndexHook.getPageChangeFrequency
protected function getPageChangeFrequency(array $page) { $ret = 0; if (!empty($page['tx_metaseo_change_frequency'])) { $ret = (int)$page['tx_metaseo_change_frequency']; } elseif (!empty($this->conf['sitemap.']['changeFrequency'])) { $ret = (int)$this->conf['sitemap.']['changeFrequency']; } if (empty($pageChangeFrequency)) { $ret = 0; } return $ret; }
php
protected function getPageChangeFrequency(array $page) { $ret = 0; if (!empty($page['tx_metaseo_change_frequency'])) { $ret = (int)$page['tx_metaseo_change_frequency']; } elseif (!empty($this->conf['sitemap.']['changeFrequency'])) { $ret = (int)$this->conf['sitemap.']['changeFrequency']; } if (empty($pageChangeFrequency)) { $ret = 0; } return $ret; }
[ "protected", "function", "getPageChangeFrequency", "(", "array", "$", "page", ")", "{", "$", "ret", "=", "0", ";", "if", "(", "!", "empty", "(", "$", "page", "[", "'tx_metaseo_change_frequency'", "]", ")", ")", "{", "$", "ret", "=", "(", "int", ")", ...
Return page change frequency @param array $page Page data @return integer
[ "Return", "page", "change", "frequency" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/SitemapIndexHook.php#L214-L229
40,047
webdevops/TYPO3-metaseo
Classes/Hook/SitemapIndexHook.php
SitemapIndexHook.checkIfSitemapIndexingIsEnabled
protected function checkIfSitemapIndexingIsEnabled($indexingType) { // check if sitemap is enabled in root if (!GeneralUtility::getRootSettingValue('is_sitemap', true) || !GeneralUtility::getRootSettingValue('is_sitemap_' . $indexingType . '_indexer', true) ) { return false; } // check current page if (!$this->checkIfCurrentPageIsIndexable()) { return false; } return true; }
php
protected function checkIfSitemapIndexingIsEnabled($indexingType) { // check if sitemap is enabled in root if (!GeneralUtility::getRootSettingValue('is_sitemap', true) || !GeneralUtility::getRootSettingValue('is_sitemap_' . $indexingType . '_indexer', true) ) { return false; } // check current page if (!$this->checkIfCurrentPageIsIndexable()) { return false; } return true; }
[ "protected", "function", "checkIfSitemapIndexingIsEnabled", "(", "$", "indexingType", ")", "{", "// check if sitemap is enabled in root", "if", "(", "!", "GeneralUtility", "::", "getRootSettingValue", "(", "'is_sitemap'", ",", "true", ")", "||", "!", "GeneralUtility", "...
Check if sitemap indexing is enabled @param string $indexingType Indexing type (page or typolink) @return bool
[ "Check", "if", "sitemap", "indexing", "is", "enabled" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/SitemapIndexHook.php#L238-L253
40,048
webdevops/TYPO3-metaseo
Classes/Hook/SitemapIndexHook.php
SitemapIndexHook.checkIfCurrentPageIsIndexable
protected function checkIfCurrentPageIsIndexable() { // check caching status if ($this->pageIndexFlag !== null) { return $this->pageIndexFlag; } // by default page is not cacheable $this->pageIndexFlag = false; // ############################ // Basic checks // ############################ $cacheConf = array( 'allowNoStaticCachable' => (bool)$this->conf['sitemap.']['index.']['allowNoStaticCachable'], 'allowNoCache' => (bool)$this->conf['sitemap.']['index.']['allowNoCache'] ); if (!FrontendUtility::isCacheable($cacheConf)) { return false; } $tsfe = self::getTsfe(); // Check for type blacklisting (from typoscript PAGE object) if (in_array($tsfe->type, $this->pageTypeBlacklist)) { return false; } // Check if page is excluded from search engines if (!empty($tsfe->page['tx_metaseo_is_exclude'])) { return false; } // Check for doktype blacklisting (from current page record) if (in_array((int)$tsfe->page['doktype'], $this->doktypeBlacklist)) { return false; } // all checks successful, page is cacheable $this->pageIndexFlag = true; return true; }
php
protected function checkIfCurrentPageIsIndexable() { // check caching status if ($this->pageIndexFlag !== null) { return $this->pageIndexFlag; } // by default page is not cacheable $this->pageIndexFlag = false; // ############################ // Basic checks // ############################ $cacheConf = array( 'allowNoStaticCachable' => (bool)$this->conf['sitemap.']['index.']['allowNoStaticCachable'], 'allowNoCache' => (bool)$this->conf['sitemap.']['index.']['allowNoCache'] ); if (!FrontendUtility::isCacheable($cacheConf)) { return false; } $tsfe = self::getTsfe(); // Check for type blacklisting (from typoscript PAGE object) if (in_array($tsfe->type, $this->pageTypeBlacklist)) { return false; } // Check if page is excluded from search engines if (!empty($tsfe->page['tx_metaseo_is_exclude'])) { return false; } // Check for doktype blacklisting (from current page record) if (in_array((int)$tsfe->page['doktype'], $this->doktypeBlacklist)) { return false; } // all checks successful, page is cacheable $this->pageIndexFlag = true; return true; }
[ "protected", "function", "checkIfCurrentPageIsIndexable", "(", ")", "{", "// check caching status", "if", "(", "$", "this", "->", "pageIndexFlag", "!==", "null", ")", "{", "return", "$", "this", "->", "pageIndexFlag", ";", "}", "// by default page is not cacheable", ...
Check if current page is indexable Will do following checks: - REQUEST_METHOD (must be GET) - If there is a feuser session - Page type blacklisting - Exclusion from search engines - If page is static cacheable - If no_cache is not set (checks will be cached) @return bool
[ "Check", "if", "current", "page", "is", "indexable" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/SitemapIndexHook.php#L270-L315
40,049
webdevops/TYPO3-metaseo
Classes/Command/MetaseoCommandController.php
MetaseoCommandController.clearSitemapCommand
public function clearSitemapCommand($rootPageId) { $rootPageId = $this->getRootPageIdFromId($rootPageId); if ($rootPageId !== null) { $query = 'DELETE FROM tx_metaseo_sitemap WHERE page_rootpid = ' . DatabaseUtility::quote($rootPageId, 'tx_metaseo_sitemap') . ' AND is_blacklisted = 0'; DatabaseUtility::exec($query); ConsoleUtility::writeLine('Sitemap cleared'); } else { ConsoleUtility::writeErrorLine('No such root page found'); ConsoleUtility::terminate(1); } }
php
public function clearSitemapCommand($rootPageId) { $rootPageId = $this->getRootPageIdFromId($rootPageId); if ($rootPageId !== null) { $query = 'DELETE FROM tx_metaseo_sitemap WHERE page_rootpid = ' . DatabaseUtility::quote($rootPageId, 'tx_metaseo_sitemap') . ' AND is_blacklisted = 0'; DatabaseUtility::exec($query); ConsoleUtility::writeLine('Sitemap cleared'); } else { ConsoleUtility::writeErrorLine('No such root page found'); ConsoleUtility::terminate(1); } }
[ "public", "function", "clearSitemapCommand", "(", "$", "rootPageId", ")", "{", "$", "rootPageId", "=", "$", "this", "->", "getRootPageIdFromId", "(", "$", "rootPageId", ")", ";", "if", "(", "$", "rootPageId", "!==", "null", ")", "{", "$", "query", "=", "...
Clear sitemap for one root page @param string $rootPageId Site root page id or domain
[ "Clear", "sitemap", "for", "one", "root", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Command/MetaseoCommandController.php#L57-L72
40,050
webdevops/TYPO3-metaseo
Classes/Command/MetaseoCommandController.php
MetaseoCommandController.sitemapCommand
public function sitemapCommand($rootPageId) { $rootPageId = $this->getRootPageIdFromId($rootPageId); if ($rootPageId !== null) { $domain = RootPageUtility::getDomain($rootPageId); $query = 'SELECT page_url FROM tx_metaseo_sitemap WHERE page_rootpid = ' . DatabaseUtility::quote($rootPageId, 'tx_metaseo_sitemap') . ' AND is_blacklisted = 0'; $urlList = DatabaseUtility::getCol($query); foreach ($urlList as $url) { if ($domain) { $url = GeneralUtility::fullUrl($url, $domain); } ConsoleUtility::writeLine($url); } } else { ConsoleUtility::writeErrorLine('No such root page found'); ConsoleUtility::terminate(1); } }
php
public function sitemapCommand($rootPageId) { $rootPageId = $this->getRootPageIdFromId($rootPageId); if ($rootPageId !== null) { $domain = RootPageUtility::getDomain($rootPageId); $query = 'SELECT page_url FROM tx_metaseo_sitemap WHERE page_rootpid = ' . DatabaseUtility::quote($rootPageId, 'tx_metaseo_sitemap') . ' AND is_blacklisted = 0'; $urlList = DatabaseUtility::getCol($query); foreach ($urlList as $url) { if ($domain) { $url = GeneralUtility::fullUrl($url, $domain); } ConsoleUtility::writeLine($url); } } else { ConsoleUtility::writeErrorLine('No such root page found'); ConsoleUtility::terminate(1); } }
[ "public", "function", "sitemapCommand", "(", "$", "rootPageId", ")", "{", "$", "rootPageId", "=", "$", "this", "->", "getRootPageIdFromId", "(", "$", "rootPageId", ")", ";", "if", "(", "$", "rootPageId", "!==", "null", ")", "{", "$", "domain", "=", "Root...
Get whole list of sitemap entries @param string $rootPageId Site root page id or domain
[ "Get", "whole", "list", "of", "sitemap", "entries" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Command/MetaseoCommandController.php#L79-L103
40,051
webdevops/TYPO3-metaseo
Classes/Scheduler/Task/AbstractSitemapTask.php
AbstractSitemapTask.cleanupDirectory
protected function cleanupDirectory() { if (empty($this->sitemapDir)) { throw new \Exception('Basedir not set'); } $fullPath = PATH_site . '/' . $this->sitemapDir; if (!is_dir($fullPath)) { Typo3GeneralUtility::mkdir($fullPath); } foreach (new \DirectoryIterator($fullPath) as $file) { if ($file->isFile() && !$file->isDot()) { $fileName = $file->getFilename(); unlink($fullPath . '/' . $fileName); } } }
php
protected function cleanupDirectory() { if (empty($this->sitemapDir)) { throw new \Exception('Basedir not set'); } $fullPath = PATH_site . '/' . $this->sitemapDir; if (!is_dir($fullPath)) { Typo3GeneralUtility::mkdir($fullPath); } foreach (new \DirectoryIterator($fullPath) as $file) { if ($file->isFile() && !$file->isDot()) { $fileName = $file->getFilename(); unlink($fullPath . '/' . $fileName); } } }
[ "protected", "function", "cleanupDirectory", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "sitemapDir", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Basedir not set'", ")", ";", "}", "$", "fullPath", "=", "PATH_site", ".", "'/'"...
Cleanup sitemap directory
[ "Cleanup", "sitemap", "directory" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Scheduler/Task/AbstractSitemapTask.php#L84-L102
40,052
webdevops/TYPO3-metaseo
Classes/Scheduler/Task/AbstractSitemapTask.php
AbstractSitemapTask.generateSitemapLinkTemplate
protected function generateSitemapLinkTemplate($template) { $ret = null; // Set link template for index file $linkConf = array( 'parameter' => $this->sitemapDir . '/' . $template, ); if (strlen($GLOBALS['TSFE']->baseUrl) > 1) { $ret = $GLOBALS['TSFE']->baseUrlWrap($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf)); } elseif (strlen($GLOBALS['TSFE']->absRefPrefix) > 1) { $ret = $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf); } else { $ret = $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf); } return $ret; }
php
protected function generateSitemapLinkTemplate($template) { $ret = null; // Set link template for index file $linkConf = array( 'parameter' => $this->sitemapDir . '/' . $template, ); if (strlen($GLOBALS['TSFE']->baseUrl) > 1) { $ret = $GLOBALS['TSFE']->baseUrlWrap($GLOBALS['TSFE']->cObj->typoLink_URL($linkConf)); } elseif (strlen($GLOBALS['TSFE']->absRefPrefix) > 1) { $ret = $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf); } else { $ret = $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf); } return $ret; }
[ "protected", "function", "generateSitemapLinkTemplate", "(", "$", "template", ")", "{", "$", "ret", "=", "null", ";", "// Set link template for index file", "$", "linkConf", "=", "array", "(", "'parameter'", "=>", "$", "this", "->", "sitemapDir", ".", "'/'", "."...
Generate sitemap link template @param string $template File link template @return string
[ "Generate", "sitemap", "link", "template" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Scheduler/Task/AbstractSitemapTask.php#L124-L142
40,053
webdevops/TYPO3-metaseo
Classes/Scheduler/Task/AbstractTask.php
AbstractTask.initLanguages
protected function initLanguages() { $this->languageIdList[0] = 0; $query = 'SELECT uid FROM sys_language WHERE hidden = 0'; $langIdList = DatabaseUtility::getColWithIndex($query); $this->languageIdList = $langIdList; }
php
protected function initLanguages() { $this->languageIdList[0] = 0; $query = 'SELECT uid FROM sys_language WHERE hidden = 0'; $langIdList = DatabaseUtility::getColWithIndex($query); $this->languageIdList = $langIdList; }
[ "protected", "function", "initLanguages", "(", ")", "{", "$", "this", "->", "languageIdList", "[", "0", "]", "=", "0", ";", "$", "query", "=", "'SELECT uid\n FROM sys_language\n WHERE hidden = 0'", ";", "$", "langIdList", "...
Get list of root pages in current typo3
[ "Get", "list", "of", "root", "pages", "in", "current", "typo3" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Scheduler/Task/AbstractTask.php#L97-L107
40,054
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getLanguageId
public static function getLanguageId() { $ret = 0; if (!empty($GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid'])) { $ret = (int)$GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid']; } return $ret; }
php
public static function getLanguageId() { $ret = 0; if (!empty($GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid'])) { $ret = (int)$GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid']; } return $ret; }
[ "public", "static", "function", "getLanguageId", "(", ")", "{", "$", "ret", "=", "0", ";", "if", "(", "!", "empty", "(", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "tmpl", "->", "setup", "[", "'config.'", "]", "[", "'sys_language_uid'", "]", ")", ")",...
Get current language id @return integer
[ "Get", "current", "language", "id" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L65-L74
40,055
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.isMountpointInRootLine
public static function isMountpointInRootLine($uid = null) { $ret = false; // Performance check, there must be an MP-GET value if (Typo3GeneralUtility::_GET('MP')) { // Possible mount point detected, let's check the rootline foreach (self::getRootLine($uid) as $page) { if (!empty($page['_MOUNT_OL'])) { // Mountpoint detected in rootline $ret = true; } } } return $ret; }
php
public static function isMountpointInRootLine($uid = null) { $ret = false; // Performance check, there must be an MP-GET value if (Typo3GeneralUtility::_GET('MP')) { // Possible mount point detected, let's check the rootline foreach (self::getRootLine($uid) as $page) { if (!empty($page['_MOUNT_OL'])) { // Mountpoint detected in rootline $ret = true; } } } return $ret; }
[ "public", "static", "function", "isMountpointInRootLine", "(", "$", "uid", "=", "null", ")", "{", "$", "ret", "=", "false", ";", "// Performance check, there must be an MP-GET value", "if", "(", "Typo3GeneralUtility", "::", "_GET", "(", "'MP'", ")", ")", "{", "/...
Check if there is any mountpoint in rootline @param integer|null $uid Page UID @return boolean
[ "Check", "if", "there", "is", "any", "mountpoint", "in", "rootline" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L93-L109
40,056
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getRootLine
public static function getRootLine($uid = null) { if ($uid === null) { ################# # Current rootline ################# if (empty(self::$rootlineCache['__CURRENT__'])) { // Current rootline $rootline = $GLOBALS['TSFE']->tmpl->rootLine; // Filter rootline by siteroot $rootline = self::filterRootlineBySiteroot((array)$rootline); self::$rootlineCache['__CURRENT__'] = $rootline; } $ret = self::$rootlineCache['__CURRENT__']; } else { ################# # Other rootline ################# if (empty(self::$rootlineCache[$uid])) { // Fetch full rootline to TYPO3 root (0) $rootline = self::getSysPageObj()->getRootLine($uid); // Filter rootline by siteroot $rootline = self::filterRootlineBySiteroot((array)$rootline); self::$rootlineCache[$uid] = $rootline; } $ret = self::$rootlineCache[$uid]; } return $ret; }
php
public static function getRootLine($uid = null) { if ($uid === null) { ################# # Current rootline ################# if (empty(self::$rootlineCache['__CURRENT__'])) { // Current rootline $rootline = $GLOBALS['TSFE']->tmpl->rootLine; // Filter rootline by siteroot $rootline = self::filterRootlineBySiteroot((array)$rootline); self::$rootlineCache['__CURRENT__'] = $rootline; } $ret = self::$rootlineCache['__CURRENT__']; } else { ################# # Other rootline ################# if (empty(self::$rootlineCache[$uid])) { // Fetch full rootline to TYPO3 root (0) $rootline = self::getSysPageObj()->getRootLine($uid); // Filter rootline by siteroot $rootline = self::filterRootlineBySiteroot((array)$rootline); self::$rootlineCache[$uid] = $rootline; } $ret = self::$rootlineCache[$uid]; } return $ret; }
[ "public", "static", "function", "getRootLine", "(", "$", "uid", "=", "null", ")", "{", "if", "(", "$", "uid", "===", "null", ")", "{", "#################", "# Current rootline", "#################", "if", "(", "empty", "(", "self", "::", "$", "rootlineCache"...
Get current root line @param integer|null $uid Page UID @return array
[ "Get", "current", "root", "line" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L118-L153
40,057
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.filterRootlineBySiteroot
protected static function filterRootlineBySiteroot(array $rootline) { $ret = array(); // Make sure sorting is right (first root, last page) ksort($rootline, SORT_NUMERIC); //reverse rootline $rootline = array_reverse($rootline); foreach ($rootline as $page) { $ret[] = $page; if (!empty($page['is_siteroot'])) { break; } } $ret = array_reverse($ret); return $ret; }
php
protected static function filterRootlineBySiteroot(array $rootline) { $ret = array(); // Make sure sorting is right (first root, last page) ksort($rootline, SORT_NUMERIC); //reverse rootline $rootline = array_reverse($rootline); foreach ($rootline as $page) { $ret[] = $page; if (!empty($page['is_siteroot'])) { break; } } $ret = array_reverse($ret); return $ret; }
[ "protected", "static", "function", "filterRootlineBySiteroot", "(", "array", "$", "rootline", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "// Make sure sorting is right (first root, last page)", "ksort", "(", "$", "rootline", ",", "SORT_NUMERIC", ")", ";", ...
Filter rootline to get the real one up to siteroot page @param $rootline @return array
[ "Filter", "rootline", "to", "get", "the", "real", "one", "up", "to", "siteroot", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L162-L181
40,058
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getSysPageObj
protected static function getSysPageObj() { if (self::$sysPageObj === null) { /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ $objectManager = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPageObj */ $sysPageObj = $objectManager->get('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); self::$sysPageObj = $sysPageObj; } return self::$sysPageObj; }
php
protected static function getSysPageObj() { if (self::$sysPageObj === null) { /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ $objectManager = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPageObj */ $sysPageObj = $objectManager->get('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); self::$sysPageObj = $sysPageObj; } return self::$sysPageObj; }
[ "protected", "static", "function", "getSysPageObj", "(", ")", "{", "if", "(", "self", "::", "$", "sysPageObj", "===", "null", ")", "{", "/** @var \\TYPO3\\CMS\\Extbase\\Object\\ObjectManager $objectManager */", "$", "objectManager", "=", "Typo3GeneralUtility", "::", "ma...
Get sys page object @return \TYPO3\CMS\Frontend\Page\PageRepository
[ "Get", "sys", "page", "object" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L188-L203
40,059
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getRootPid
public static function getRootPid($uid = null) { static $cache = array(); $ret = null; if ($uid === null) { ################# # Current root PID ################# $rootline = self::getRootLine(); if (!empty($rootline[0])) { $ret = $rootline[0]['uid']; } } else { ################# # Other root PID ################# if (!isset($cache[$uid])) { $cache[$uid] = null; $rootline = self::getRootLine($uid); if (!empty($rootline[0])) { $cache[$uid] = $rootline[0]['uid']; } } $ret = $cache[$uid]; } return $ret; }
php
public static function getRootPid($uid = null) { static $cache = array(); $ret = null; if ($uid === null) { ################# # Current root PID ################# $rootline = self::getRootLine(); if (!empty($rootline[0])) { $ret = $rootline[0]['uid']; } } else { ################# # Other root PID ################# if (!isset($cache[$uid])) { $cache[$uid] = null; $rootline = self::getRootLine($uid); if (!empty($rootline[0])) { $cache[$uid] = $rootline[0]['uid']; } } $ret = $cache[$uid]; } return $ret; }
[ "public", "static", "function", "getRootPid", "(", "$", "uid", "=", "null", ")", "{", "static", "$", "cache", "=", "array", "(", ")", ";", "$", "ret", "=", "null", ";", "if", "(", "$", "uid", "===", "null", ")", "{", "#################", "# Current r...
Get current root pid @param integer|null $uid Page UID @return integer
[ "Get", "current", "root", "pid" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L238-L268
40,060
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getRootSettingValue
public static function getRootSettingValue($name, $defaultValue = null, $rootPid = null) { $setting = self::getRootSetting($rootPid); if (isset($setting[$name])) { $ret = $setting[$name]; } else { $ret = $defaultValue; } return $ret; }
php
public static function getRootSettingValue($name, $defaultValue = null, $rootPid = null) { $setting = self::getRootSetting($rootPid); if (isset($setting[$name])) { $ret = $setting[$name]; } else { $ret = $defaultValue; } return $ret; }
[ "public", "static", "function", "getRootSettingValue", "(", "$", "name", ",", "$", "defaultValue", "=", "null", ",", "$", "rootPid", "=", "null", ")", "{", "$", "setting", "=", "self", "::", "getRootSetting", "(", "$", "rootPid", ")", ";", "if", "(", "...
Get root setting value @param string $name Name of configuration @param mixed|NULL $defaultValue Default value @param integer|NULL $rootPid Root Page Id @return array
[ "Get", "root", "setting", "value" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L279-L290
40,061
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getRootSetting
public static function getRootSetting($rootPid = null) { static $ret = null; if ($ret !== null) { return $ret; } if ($rootPid === null) { $rootPid = self::getRootPid(); } $query = 'SELECT * FROM tx_metaseo_setting_root WHERE pid = ' . (int)$rootPid . ' AND deleted = 0 LIMIT 1'; $ret = DatabaseUtility::getRow($query); return $ret; }
php
public static function getRootSetting($rootPid = null) { static $ret = null; if ($ret !== null) { return $ret; } if ($rootPid === null) { $rootPid = self::getRootPid(); } $query = 'SELECT * FROM tx_metaseo_setting_root WHERE pid = ' . (int)$rootPid . ' AND deleted = 0 LIMIT 1'; $ret = DatabaseUtility::getRow($query); return $ret; }
[ "public", "static", "function", "getRootSetting", "(", "$", "rootPid", "=", "null", ")", "{", "static", "$", "ret", "=", "null", ";", "if", "(", "$", "ret", "!==", "null", ")", "{", "return", "$", "ret", ";", "}", "if", "(", "$", "rootPid", "===", ...
Get root setting row @param integer $rootPid Root Page Id @return array
[ "Get", "root", "setting", "row" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L299-L319
40,062
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.getExtConf
public static function getExtConf($name, $default = null) { static $conf = null; $ret = $default; if ($conf === null) { // Load ext conf $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['metaseo']); if (!is_array($conf)) { $conf = array(); } } if (isset($conf[$name])) { $ret = $conf[$name]; } return $ret; }
php
public static function getExtConf($name, $default = null) { static $conf = null; $ret = $default; if ($conf === null) { // Load ext conf $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['metaseo']); if (!is_array($conf)) { $conf = array(); } } if (isset($conf[$name])) { $ret = $conf[$name]; } return $ret; }
[ "public", "static", "function", "getExtConf", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "static", "$", "conf", "=", "null", ";", "$", "ret", "=", "$", "default", ";", "if", "(", "$", "conf", "===", "null", ")", "{", "// Load ext...
Get extension configuration @param string $name Name of config @param boolean $default Default value @return mixed
[ "Get", "extension", "configuration" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L329-L348
40,063
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.callHookAndSignal
public static function callHookAndSignal($class, $name, $obj, &$args = null) { static $hookConf = null; static $signalSlotDispatcher = null; // Fetch hooks config for metaseo, minimize array lookups if ($hookConf === null) { $hookConf = array(); if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['metaseo']['hooks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['metaseo']['hooks']) ) { $hookConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['metaseo']['hooks']; } } // Call hooks if (!empty($hookConf[$name]) && is_array($hookConf[$name])) { foreach ($hookConf[$name] as $_funcRef) { if ($_funcRef) { Typo3GeneralUtility::callUserFunction($_funcRef, $args, $obj); } } } // Call signal if ($signalSlotDispatcher === null) { /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ $objectManager = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); /** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */ $signalSlotDispatcher = $objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); } list($args) = $signalSlotDispatcher->dispatch($class, $name, array($args, $obj)); }
php
public static function callHookAndSignal($class, $name, $obj, &$args = null) { static $hookConf = null; static $signalSlotDispatcher = null; // Fetch hooks config for metaseo, minimize array lookups if ($hookConf === null) { $hookConf = array(); if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['metaseo']['hooks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['metaseo']['hooks']) ) { $hookConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['metaseo']['hooks']; } } // Call hooks if (!empty($hookConf[$name]) && is_array($hookConf[$name])) { foreach ($hookConf[$name] as $_funcRef) { if ($_funcRef) { Typo3GeneralUtility::callUserFunction($_funcRef, $args, $obj); } } } // Call signal if ($signalSlotDispatcher === null) { /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ $objectManager = Typo3GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' ); /** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */ $signalSlotDispatcher = $objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); } list($args) = $signalSlotDispatcher->dispatch($class, $name, array($args, $obj)); }
[ "public", "static", "function", "callHookAndSignal", "(", "$", "class", ",", "$", "name", ",", "$", "obj", ",", "&", "$", "args", "=", "null", ")", "{", "static", "$", "hookConf", "=", "null", ";", "static", "$", "signalSlotDispatcher", "=", "null", ";...
Call hook and signal @param string $class Name of the class containing the signal @param string $name Name of hook @param mixed $obj Reference to be passed along (typically "$this" - being a reference to the calling object) (REFERENCE!) @param mixed|NULL $args Args
[ "Call", "hook", "and", "signal" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L359-L394
40,064
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.fullUrl
public static function fullUrl($url, $domain = null) { if (!preg_match('/^https?:\/\//i', $url)) { // Fix for root page link if ($url === '/') { $url = ''; } // remove first / if (strpos($url, '/') === 0) { $url = substr($url, 1); } if ($domain !== null) { // specified domain $url = 'http://' . $domain . '/' . $url; } else { // domain from env $url = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $url; } } // Fix url stuff $url = str_replace('?&', '?', $url); return $url; }
php
public static function fullUrl($url, $domain = null) { if (!preg_match('/^https?:\/\//i', $url)) { // Fix for root page link if ($url === '/') { $url = ''; } // remove first / if (strpos($url, '/') === 0) { $url = substr($url, 1); } if ($domain !== null) { // specified domain $url = 'http://' . $domain . '/' . $url; } else { // domain from env $url = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $url; } } // Fix url stuff $url = str_replace('?&', '?', $url); return $url; }
[ "public", "static", "function", "fullUrl", "(", "$", "url", ",", "$", "domain", "=", "null", ")", "{", "if", "(", "!", "preg_match", "(", "'/^https?:\\/\\//i'", ",", "$", "url", ")", ")", "{", "// Fix for root page link", "if", "(", "$", "url", "===", ...
Generate full url Makes sure the url is absolute (http://....) @param string $url URL @param string $domain Domain @return string
[ "Generate", "full", "url" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L407-L433
40,065
webdevops/TYPO3-metaseo
Classes/Utility/GeneralUtility.php
GeneralUtility.checkUrlForBlacklisting
public static function checkUrlForBlacklisting($url, array $blacklistConf) { // check for valid url if (empty($url)) { return true; } $blacklistConf = (array)$blacklistConf; foreach ($blacklistConf as $blacklistRegExp) { if (preg_match($blacklistRegExp, $url)) { return true; } } return false; }
php
public static function checkUrlForBlacklisting($url, array $blacklistConf) { // check for valid url if (empty($url)) { return true; } $blacklistConf = (array)$blacklistConf; foreach ($blacklistConf as $blacklistRegExp) { if (preg_match($blacklistRegExp, $url)) { return true; } } return false; }
[ "public", "static", "function", "checkUrlForBlacklisting", "(", "$", "url", ",", "array", "$", "blacklistConf", ")", "{", "// check for valid url", "if", "(", "empty", "(", "$", "url", ")", ")", "{", "return", "true", ";", "}", "$", "blacklistConf", "=", "...
Check if url is blacklisted @param string $url URL @param array $blacklistConf Blacklist configuration (list of regexp) @return bool
[ "Check", "if", "url", "is", "blacklisted" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/GeneralUtility.php#L447-L462
40,066
webdevops/TYPO3-metaseo
Classes/Page/RobotsTxtPage.php
RobotsTxtPage.main
public function main() { $ret = ''; $settings = GeneralUtility::getRootSetting(); // INIT $this->tsSetup = $GLOBALS['TSFE']->tmpl->setup; $this->cObj = $GLOBALS['TSFE']->cObj; $this->rootPid = GeneralUtility::getRootPid(); $this->tsSetupSeo = null; if (!empty($this->tsSetup['plugin.']['metaseo.']['robotsTxt.'])) { $this->tsSetupSeo = $this->tsSetup['plugin.']['metaseo.']['robotsTxt.']; } // check if sitemap is enabled in root if (!GeneralUtility::getRootSettingValue('is_robotstxt', true)) { return true; } $this->linkToStaticSitemap = GeneralUtility::getRootSettingValue('is_robotstxt_sitemap_static', false); // Language lock $this->sitemapLanguageLock = GeneralUtility::getRootSettingValue('is_sitemap_language_lock', false); $this->languageId = GeneralUtility::getLanguageId(); // ############################### // Fetch robots.txt content // ############################### $settings['robotstxt'] = trim($settings['robotstxt']); if (!empty($settings['robotstxt'])) { // Custom Robots.txt $ret .= $settings['robotstxt']; } elseif ($this->tsSetupSeo) { // Default robots.txt $ret .= $this->cObj->cObjGetSingle($this->tsSetupSeo['default'], $this->tsSetupSeo['default.']); } // ############################### // Fetch extra robots.txt content // ############################### // User additional if (!empty($settings['robotstxt_additional'])) { $ret .= "\n\n" . $settings['robotstxt_additional']; } // Setup additional if ($this->tsSetupSeo) { // Default robots.txt $tmp = $this->cObj->cObjGetSingle($this->tsSetupSeo['extra'], $this->tsSetupSeo['extra.']); if (!empty($tmp)) { $ret .= "\n\n" . $tmp; } } // ############################### // Marker // ############################### if (!empty($this->tsSetupSeo['marker.'])) { $ret = $this->applyMarker($ret); } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'robotsTxtOutput', $this, $ret); return $ret; }
php
public function main() { $ret = ''; $settings = GeneralUtility::getRootSetting(); // INIT $this->tsSetup = $GLOBALS['TSFE']->tmpl->setup; $this->cObj = $GLOBALS['TSFE']->cObj; $this->rootPid = GeneralUtility::getRootPid(); $this->tsSetupSeo = null; if (!empty($this->tsSetup['plugin.']['metaseo.']['robotsTxt.'])) { $this->tsSetupSeo = $this->tsSetup['plugin.']['metaseo.']['robotsTxt.']; } // check if sitemap is enabled in root if (!GeneralUtility::getRootSettingValue('is_robotstxt', true)) { return true; } $this->linkToStaticSitemap = GeneralUtility::getRootSettingValue('is_robotstxt_sitemap_static', false); // Language lock $this->sitemapLanguageLock = GeneralUtility::getRootSettingValue('is_sitemap_language_lock', false); $this->languageId = GeneralUtility::getLanguageId(); // ############################### // Fetch robots.txt content // ############################### $settings['robotstxt'] = trim($settings['robotstxt']); if (!empty($settings['robotstxt'])) { // Custom Robots.txt $ret .= $settings['robotstxt']; } elseif ($this->tsSetupSeo) { // Default robots.txt $ret .= $this->cObj->cObjGetSingle($this->tsSetupSeo['default'], $this->tsSetupSeo['default.']); } // ############################### // Fetch extra robots.txt content // ############################### // User additional if (!empty($settings['robotstxt_additional'])) { $ret .= "\n\n" . $settings['robotstxt_additional']; } // Setup additional if ($this->tsSetupSeo) { // Default robots.txt $tmp = $this->cObj->cObjGetSingle($this->tsSetupSeo['extra'], $this->tsSetupSeo['extra.']); if (!empty($tmp)) { $ret .= "\n\n" . $tmp; } } // ############################### // Marker // ############################### if (!empty($this->tsSetupSeo['marker.'])) { $ret = $this->applyMarker($ret); } // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'robotsTxtOutput', $this, $ret); return $ret; }
[ "public", "function", "main", "(", ")", "{", "$", "ret", "=", "''", ";", "$", "settings", "=", "GeneralUtility", "::", "getRootSetting", "(", ")", ";", "// INIT", "$", "this", "->", "tsSetup", "=", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "tmpl", "-...
Fetch and build robots.txt
[ "Fetch", "and", "build", "robots", ".", "txt" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/RobotsTxtPage.php#L90-L159
40,067
webdevops/TYPO3-metaseo
Classes/Page/RobotsTxtPage.php
RobotsTxtPage.applyMarker
protected function applyMarker($robotsTxt) { $ret = $robotsTxt; $markerList = array(); $markerConfList = array(); foreach ($this->tsSetupSeo['marker.'] as $name => $data) { if (strpos($name, '.') === false) { $markerConfList[$name] = null; } } if ($this->linkToStaticSitemap) { // remove sitemap-marker because we link to static url unset($markerConfList['sitemap']); } // Fetch marker content foreach ($markerConfList as $name => $conf) { $markerList['%' . $name . '%'] = $this->cObj->cObjGetSingle( $this->tsSetupSeo['marker.'][$name], $this->tsSetupSeo['marker.'][$name . '.'] ); } // generate sitemap-static marker if ($this->linkToStaticSitemap) { if ($this->sitemapLanguageLock) { $path = 'uploads/tx_metaseo/sitemap_xml/index-r' . (int)$this->rootPid . '-l' . (int)$this->languageId . '.xml.gz'; } else { $path = 'uploads/tx_metaseo/sitemap_xml/index-r' . (int)$this->rootPid . '.xml.gz'; } $conf = array( 'parameter' => $path ); $markerList['%sitemap%'] = $this->cObj->typoLink_URL($conf); } // Fix sitemap-marker url (add prefix if needed) $markerList['%sitemap%'] = GeneralUtility::fullUrl($markerList['%sitemap%']); // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'robotsTxtMarker', $this, $markerList); // Apply marker list if (!empty($markerList)) { $ret = strtr($ret, $markerList); } return $ret; }
php
protected function applyMarker($robotsTxt) { $ret = $robotsTxt; $markerList = array(); $markerConfList = array(); foreach ($this->tsSetupSeo['marker.'] as $name => $data) { if (strpos($name, '.') === false) { $markerConfList[$name] = null; } } if ($this->linkToStaticSitemap) { // remove sitemap-marker because we link to static url unset($markerConfList['sitemap']); } // Fetch marker content foreach ($markerConfList as $name => $conf) { $markerList['%' . $name . '%'] = $this->cObj->cObjGetSingle( $this->tsSetupSeo['marker.'][$name], $this->tsSetupSeo['marker.'][$name . '.'] ); } // generate sitemap-static marker if ($this->linkToStaticSitemap) { if ($this->sitemapLanguageLock) { $path = 'uploads/tx_metaseo/sitemap_xml/index-r' . (int)$this->rootPid . '-l' . (int)$this->languageId . '.xml.gz'; } else { $path = 'uploads/tx_metaseo/sitemap_xml/index-r' . (int)$this->rootPid . '.xml.gz'; } $conf = array( 'parameter' => $path ); $markerList['%sitemap%'] = $this->cObj->typoLink_URL($conf); } // Fix sitemap-marker url (add prefix if needed) $markerList['%sitemap%'] = GeneralUtility::fullUrl($markerList['%sitemap%']); // Call hook GeneralUtility::callHookAndSignal(__CLASS__, 'robotsTxtMarker', $this, $markerList); // Apply marker list if (!empty($markerList)) { $ret = strtr($ret, $markerList); } return $ret; }
[ "protected", "function", "applyMarker", "(", "$", "robotsTxt", ")", "{", "$", "ret", "=", "$", "robotsTxt", ";", "$", "markerList", "=", "array", "(", ")", ";", "$", "markerConfList", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "t...
Apply marker to robots.txt @param string $robotsTxt Content of robots.txt @return string
[ "Apply", "marker", "to", "robots", ".", "txt" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/RobotsTxtPage.php#L168-L222
40,068
webdevops/TYPO3-metaseo
Classes/Hook/SitemapIndexPageHook.php
SitemapIndexPageHook.addPageToSitemapIndex
public function addPageToSitemapIndex() { if (!$this->checkIfSitemapIndexingIsEnabled('page')) { return; } if (!$this->checkIfNoLanguageFallback()) { // got content in fallback language => don't index return; } $pageUrl = $this->getPageUrl(); // check blacklisting if (GeneralUtility::checkUrlForBlacklisting($pageUrl, $this->blacklistConf)) { return; } // Index page $pageData = $this->generateSitemapPageData($pageUrl); if (!empty($pageData)) { SitemapUtility::index($pageData); } }
php
public function addPageToSitemapIndex() { if (!$this->checkIfSitemapIndexingIsEnabled('page')) { return; } if (!$this->checkIfNoLanguageFallback()) { // got content in fallback language => don't index return; } $pageUrl = $this->getPageUrl(); // check blacklisting if (GeneralUtility::checkUrlForBlacklisting($pageUrl, $this->blacklistConf)) { return; } // Index page $pageData = $this->generateSitemapPageData($pageUrl); if (!empty($pageData)) { SitemapUtility::index($pageData); } }
[ "public", "function", "addPageToSitemapIndex", "(", ")", "{", "if", "(", "!", "$", "this", "->", "checkIfSitemapIndexingIsEnabled", "(", "'page'", ")", ")", "{", "return", ";", "}", "if", "(", "!", "$", "this", "->", "checkIfNoLanguageFallback", "(", ")", ...
Add Page to sitemap table @return void
[ "Add", "Page", "to", "sitemap", "table" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/SitemapIndexPageHook.php#L88-L111
40,069
webdevops/TYPO3-metaseo
Classes/Hook/SitemapIndexPageHook.php
SitemapIndexPageHook.checkIfNoLanguageFallback
protected function checkIfNoLanguageFallback() { $tsfe = self::getTsfe(); // Check if we have fallen back to a default language if (GeneralUtility::getLanguageId() !== $tsfe->sys_language_uid) { return false; //don't index untranslated page } return true; }
php
protected function checkIfNoLanguageFallback() { $tsfe = self::getTsfe(); // Check if we have fallen back to a default language if (GeneralUtility::getLanguageId() !== $tsfe->sys_language_uid) { return false; //don't index untranslated page } return true; }
[ "protected", "function", "checkIfNoLanguageFallback", "(", ")", "{", "$", "tsfe", "=", "self", "::", "getTsfe", "(", ")", ";", "// Check if we have fallen back to a default language", "if", "(", "GeneralUtility", "::", "getLanguageId", "(", ")", "!==", "$", "tsfe", ...
Returns True if language chosen by L= parameter matches language of content Returns False if content is in fallback language @return bool
[ "Returns", "True", "if", "language", "chosen", "by", "L", "=", "parameter", "matches", "language", "of", "content", "Returns", "False", "if", "content", "is", "in", "fallback", "language" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Hook/SitemapIndexPageHook.php#L119-L127
40,070
webdevops/TYPO3-metaseo
Classes/Page/Part/PagetitlePart.php
PagetitlePart.checkIfPageTitleCachingEnabled
protected function checkIfPageTitleCachingEnabled() { $cachingEnabled = !empty($GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['pageTitle.']['caching']); // Ajax: disable pagetitle caching when in backend mode if (defined('TYPO3_MODE') && TYPO3_MODE == 'BE') { $cachingEnabled = false; } // Enable caching only if caching is enabled in SetupTS // And if there is any USER_INT on the current page // // -> USER_INT will break Connector pagetitle setting // because the plugin output is cached but not the whole // page. so the Connector will not be called again // and the default page title will be shown // which is wrong // -> if the page is fully cacheable we don't have anything // to do return $cachingEnabled && !FrontendUtility::isCacheable(); }
php
protected function checkIfPageTitleCachingEnabled() { $cachingEnabled = !empty($GLOBALS['TSFE']->tmpl->setup['plugin.']['metaseo.']['pageTitle.']['caching']); // Ajax: disable pagetitle caching when in backend mode if (defined('TYPO3_MODE') && TYPO3_MODE == 'BE') { $cachingEnabled = false; } // Enable caching only if caching is enabled in SetupTS // And if there is any USER_INT on the current page // // -> USER_INT will break Connector pagetitle setting // because the plugin output is cached but not the whole // page. so the Connector will not be called again // and the default page title will be shown // which is wrong // -> if the page is fully cacheable we don't have anything // to do return $cachingEnabled && !FrontendUtility::isCacheable(); }
[ "protected", "function", "checkIfPageTitleCachingEnabled", "(", ")", "{", "$", "cachingEnabled", "=", "!", "empty", "(", "$", "GLOBALS", "[", "'TSFE'", "]", "->", "tmpl", "->", "setup", "[", "'plugin.'", "]", "[", "'metaseo.'", "]", "[", "'pageTitle.'", "]",...
Check if page title caching is enabled @return bool
[ "Check", "if", "page", "title", "caching", "is", "enabled" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Page/Part/PagetitlePart.php#L162-L182
40,071
webdevops/TYPO3-metaseo
Classes/Controller/Ajax/PageSeo/AdvancedController.php
AdvancedController.clearMetaTags
protected function clearMetaTags($pid, $sysLanguage) { $query = 'DELETE FROM tx_metaseo_metatag WHERE pid = ' . (int)$pid . ' AND sys_language_uid = ' . (int)$sysLanguage; DatabaseUtility::exec($query); }
php
protected function clearMetaTags($pid, $sysLanguage) { $query = 'DELETE FROM tx_metaseo_metatag WHERE pid = ' . (int)$pid . ' AND sys_language_uid = ' . (int)$sysLanguage; DatabaseUtility::exec($query); }
[ "protected", "function", "clearMetaTags", "(", "$", "pid", ",", "$", "sysLanguage", ")", "{", "$", "query", "=", "'DELETE FROM tx_metaseo_metatag\n WHERE pid = '", ".", "(", "int", ")", "$", "pid", ".", "'\n AND sys_language...
Clear all meta tags for one page @param integer $pid PID @param integer|null $sysLanguage system language id
[ "Clear", "all", "meta", "tags", "for", "one", "page" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Controller/Ajax/PageSeo/AdvancedController.php#L133-L139
40,072
webdevops/TYPO3-metaseo
Classes/Utility/FrontendUtility.php
FrontendUtility.isCacheable
public static function isCacheable($conf = null) { $TSFE = self::getTsfe(); if ($_SERVER['REQUEST_METHOD'] !== 'GET' || !empty($TSFE->fe_user->user['uid'])) { return false; } // don't parse if page is not cacheable if (empty($conf['allowNoStaticCachable']) && !$TSFE->isStaticCacheble()) { return false; } // Skip no_cache-pages if (empty($conf['allowNoCache']) && !empty($TSFE->no_cache)) { return false; } return true; }
php
public static function isCacheable($conf = null) { $TSFE = self::getTsfe(); if ($_SERVER['REQUEST_METHOD'] !== 'GET' || !empty($TSFE->fe_user->user['uid'])) { return false; } // don't parse if page is not cacheable if (empty($conf['allowNoStaticCachable']) && !$TSFE->isStaticCacheble()) { return false; } // Skip no_cache-pages if (empty($conf['allowNoCache']) && !empty($TSFE->no_cache)) { return false; } return true; }
[ "public", "static", "function", "isCacheable", "(", "$", "conf", "=", "null", ")", "{", "$", "TSFE", "=", "self", "::", "getTsfe", "(", ")", ";", "if", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", "!==", "'GET'", "||", "!", "empty", "(", "$", ...
Check if frontend page is cacheable @param array|null $conf Configuration @return bool
[ "Check", "if", "frontend", "page", "is", "cacheable" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/FrontendUtility.php#L164-L183
40,073
webdevops/TYPO3-metaseo
Classes/Utility/FrontendUtility.php
FrontendUtility.getCurrentUrl
public static function getCurrentUrl() { //former $TSFE->anchorPrefix got deprecated in TYPO3 7.x $tsfeAnchorPrefix = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_SCRIPT'); if ($tsfeAnchorPrefix !== false && !empty($tsfeAnchorPrefix)) { return $tsfeAnchorPrefix; } else { return (string) self::getTsfe()->siteScript; } }
php
public static function getCurrentUrl() { //former $TSFE->anchorPrefix got deprecated in TYPO3 7.x $tsfeAnchorPrefix = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_SCRIPT'); if ($tsfeAnchorPrefix !== false && !empty($tsfeAnchorPrefix)) { return $tsfeAnchorPrefix; } else { return (string) self::getTsfe()->siteScript; } }
[ "public", "static", "function", "getCurrentUrl", "(", ")", "{", "//former $TSFE->anchorPrefix got deprecated in TYPO3 7.x", "$", "tsfeAnchorPrefix", "=", "Typo3GeneralUtility", "::", "getIndpEnv", "(", "'TYPO3_SITE_SCRIPT'", ")", ";", "if", "(", "$", "tsfeAnchorPrefix", "...
Return current URL @return string
[ "Return", "current", "URL" ]
bd5cd757b519795d761a67e944b5c7ccaeabb38c
https://github.com/webdevops/TYPO3-metaseo/blob/bd5cd757b519795d761a67e944b5c7ccaeabb38c/Classes/Utility/FrontendUtility.php#L190-L200
40,074
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/style.cls.php
Style.get_font_family
function get_font_family() { $DEBUGCSS=DEBUGCSS; //=DEBUGCSS; Allow override of global setting for ad hoc debug // Select the appropriate font. First determine the subtype, then check // the specified font-families for a candidate. // Resolve font-weight $weight = $this->__get("font_weight"); if ( is_numeric($weight) ) { if ( $weight < 600 ) $weight = "normal"; else $weight = "bold"; } else if ( $weight === "bold" || $weight === "bolder" ) { $weight = "bold"; } else { $weight = "normal"; } // Resolve font-style $font_style = $this->__get("font_style"); if ( $weight === "bold" && ($font_style === "italic" || $font_style === "oblique") ) $subtype = "bold_italic"; else if ( $weight === "bold" && $font_style !== "italic" && $font_style !== "oblique" ) $subtype = "bold"; else if ( $weight !== "bold" && ($font_style === "italic" || $font_style === "oblique") ) $subtype = "italic"; else $subtype = "normal"; // Resolve the font family if ($DEBUGCSS) { print "<pre>[get_font_family:"; print '('.$this->_props["font_family"].'.'.$font_style.'.'.$this->__get("font_weight").'.'.$weight.'.'.$subtype.')'; } $families = explode(",", $this->_props["font_family"]); $families = array_map('trim',$families); reset($families); $font = null; while ( current($families) ) { list(,$family) = each($families); //remove leading and trailing string delimiters, e.g. on font names with spaces; //remove leading and trailing whitespace $family = trim($family, " \t\n\r\x0B\"'"); if ($DEBUGCSS) print '('.$family.')'; $font = Font_Metrics::get_font($family, $subtype); if ( $font ) { if ($DEBUGCSS) print '('.$font.")get_font_family]\n</pre>"; return $font; } } $family = null; if ($DEBUGCSS) print '(default)'; $font = Font_Metrics::get_font($family, $subtype); if ( $font ) { if ($DEBUGCSS) print '('.$font.")get_font_family]\n</pre>"; return $font; } throw new DOMPDF_Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] ."'"); }
php
function get_font_family() { $DEBUGCSS=DEBUGCSS; //=DEBUGCSS; Allow override of global setting for ad hoc debug // Select the appropriate font. First determine the subtype, then check // the specified font-families for a candidate. // Resolve font-weight $weight = $this->__get("font_weight"); if ( is_numeric($weight) ) { if ( $weight < 600 ) $weight = "normal"; else $weight = "bold"; } else if ( $weight === "bold" || $weight === "bolder" ) { $weight = "bold"; } else { $weight = "normal"; } // Resolve font-style $font_style = $this->__get("font_style"); if ( $weight === "bold" && ($font_style === "italic" || $font_style === "oblique") ) $subtype = "bold_italic"; else if ( $weight === "bold" && $font_style !== "italic" && $font_style !== "oblique" ) $subtype = "bold"; else if ( $weight !== "bold" && ($font_style === "italic" || $font_style === "oblique") ) $subtype = "italic"; else $subtype = "normal"; // Resolve the font family if ($DEBUGCSS) { print "<pre>[get_font_family:"; print '('.$this->_props["font_family"].'.'.$font_style.'.'.$this->__get("font_weight").'.'.$weight.'.'.$subtype.')'; } $families = explode(",", $this->_props["font_family"]); $families = array_map('trim',$families); reset($families); $font = null; while ( current($families) ) { list(,$family) = each($families); //remove leading and trailing string delimiters, e.g. on font names with spaces; //remove leading and trailing whitespace $family = trim($family, " \t\n\r\x0B\"'"); if ($DEBUGCSS) print '('.$family.')'; $font = Font_Metrics::get_font($family, $subtype); if ( $font ) { if ($DEBUGCSS) print '('.$font.")get_font_family]\n</pre>"; return $font; } } $family = null; if ($DEBUGCSS) print '(default)'; $font = Font_Metrics::get_font($family, $subtype); if ( $font ) { if ($DEBUGCSS) print '('.$font.")get_font_family]\n</pre>"; return $font; } throw new DOMPDF_Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] ."'"); }
[ "function", "get_font_family", "(", ")", "{", "$", "DEBUGCSS", "=", "DEBUGCSS", ";", "//=DEBUGCSS; Allow override of global setting for ad hoc debug", "// Select the appropriate font. First determine the subtype, then check", "// the specified font-families for a candidate.", "// Resolve ...
Getter for the 'font-family' CSS property. Uses the {@link Font_Metrics} class to resolve the font family into an actual font file. @link http://www.w3.org/TR/CSS21/fonts.html#propdef-font-family @return string
[ "Getter", "for", "the", "font", "-", "family", "CSS", "property", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/style.cls.php#L736-L807
40,075
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/style.cls.php
Style.get_border_properties
function get_border_properties() { return array("top" => array("width" => $this->__get("border_top_width"), "style" => $this->__get("border_top_style"), "color" => $this->__get("border_top_color")), "bottom" => array("width" => $this->__get("border_bottom_width"), "style" => $this->__get("border_bottom_style"), "color" => $this->__get("border_bottom_color")), "right" => array("width" => $this->__get("border_right_width"), "style" => $this->__get("border_right_style"), "color" => $this->__get("border_right_color")), "left" => array("width" => $this->__get("border_left_width"), "style" => $this->__get("border_left_style"), "color" => $this->__get("border_left_color"))); }
php
function get_border_properties() { return array("top" => array("width" => $this->__get("border_top_width"), "style" => $this->__get("border_top_style"), "color" => $this->__get("border_top_color")), "bottom" => array("width" => $this->__get("border_bottom_width"), "style" => $this->__get("border_bottom_style"), "color" => $this->__get("border_bottom_color")), "right" => array("width" => $this->__get("border_right_width"), "style" => $this->__get("border_right_style"), "color" => $this->__get("border_right_color")), "left" => array("width" => $this->__get("border_left_width"), "style" => $this->__get("border_left_style"), "color" => $this->__get("border_left_color"))); }
[ "function", "get_border_properties", "(", ")", "{", "return", "array", "(", "\"top\"", "=>", "array", "(", "\"width\"", "=>", "$", "this", "->", "__get", "(", "\"border_top_width\"", ")", ",", "\"style\"", "=>", "$", "this", "->", "__get", "(", "\"border_top...
Return an array of all border properties. The returned array has the following structure: <code> array("top" => array("width" => [border-width], "style" => [border-style], "color" => [border-color (array)]), "bottom" ... ) </code> @return array
[ "Return", "an", "array", "of", "all", "border", "properties", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/style.cls.php#L1146-L1159
40,076
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/style.cls.php
Style.set_font
function set_font($val) { $this->__font_size_calculated = false; //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["font"] = null; $this->_props["font"] = $val; $important = isset($this->_important_props["font"]); if ( preg_match("/^(italic|oblique|normal)\s*(.*)$/i",$val,$match) ) { $this->_set_style("font_style", $match[1], $important); $val = $match[2]; } else { $this->_set_style("font_style", self::$_defaults["font_style"], $important); } if ( preg_match("/^(small-caps|normal)\s*(.*)$/i",$val,$match) ) { $this->_set_style("font_variant", $match[1], $important); $val = $match[2]; } else { $this->_set_style("font_variant", self::$_defaults["font_variant"], $important); } //matching numeric value followed by unit -> this is indeed a subsequent font size. Skip! if ( preg_match("/^(bold|bolder|lighter|100|200|300|400|500|600|700|800|900|normal)\s*(.*)$/i",$val,$match) && !preg_match("/^(?:pt|px|pc|em|ex|in|cm|mm|%)/",$match[2]) ) { $this->_set_style("font_weight", $match[1], $important); $val = $match[2]; } else { $this->_set_style("font_weight", self::$_defaults["font_weight"], $important); } if ( preg_match("/^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger|\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) { $this->_set_style("font_size", $match[1], $important); $val = $match[2]; if (preg_match("/^\/\s*(\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) { $this->_set_style("line_height", $match[1], $important); $val = $match[2]; } else { $this->_set_style("line_height", self::$_defaults["line_height"], $important); } } else { $this->_set_style("font_size", self::$_defaults["font_size"], $important); $this->_set_style("line_height", self::$_defaults["line_height"], $important); } if(strlen($val) != 0) { $this->_set_style("font_family", $val, $important); } else { $this->_set_style("font_family", self::$_defaults["font_family"], $important); } }
php
function set_font($val) { $this->__font_size_calculated = false; //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["font"] = null; $this->_props["font"] = $val; $important = isset($this->_important_props["font"]); if ( preg_match("/^(italic|oblique|normal)\s*(.*)$/i",$val,$match) ) { $this->_set_style("font_style", $match[1], $important); $val = $match[2]; } else { $this->_set_style("font_style", self::$_defaults["font_style"], $important); } if ( preg_match("/^(small-caps|normal)\s*(.*)$/i",$val,$match) ) { $this->_set_style("font_variant", $match[1], $important); $val = $match[2]; } else { $this->_set_style("font_variant", self::$_defaults["font_variant"], $important); } //matching numeric value followed by unit -> this is indeed a subsequent font size. Skip! if ( preg_match("/^(bold|bolder|lighter|100|200|300|400|500|600|700|800|900|normal)\s*(.*)$/i",$val,$match) && !preg_match("/^(?:pt|px|pc|em|ex|in|cm|mm|%)/",$match[2]) ) { $this->_set_style("font_weight", $match[1], $important); $val = $match[2]; } else { $this->_set_style("font_weight", self::$_defaults["font_weight"], $important); } if ( preg_match("/^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger|\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) { $this->_set_style("font_size", $match[1], $important); $val = $match[2]; if (preg_match("/^\/\s*(\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) { $this->_set_style("line_height", $match[1], $important); $val = $match[2]; } else { $this->_set_style("line_height", self::$_defaults["line_height"], $important); } } else { $this->_set_style("font_size", self::$_defaults["font_size"], $important); $this->_set_style("line_height", self::$_defaults["line_height"], $important); } if(strlen($val) != 0) { $this->_set_style("font_family", $val, $important); } else { $this->_set_style("font_family", self::$_defaults["font_family"], $important); } }
[ "function", "set_font", "(", "$", "val", ")", "{", "$", "this", "->", "__font_size_calculated", "=", "false", ";", "//see __set and __get, on all assignments clear cache, not needed on direct set through __set", "$", "this", "->", "_prop_cache", "[", "\"font\"", "]", "=",...
Sets the font style combined attributes set individual attributes also, respecting !important mark exactly this order, separate by space. Multiple fonts separated by comma: font-style, font-variant, font-weight, font-size, line-height, font-family Other than with border and list, existing partial attributes should reset when starting here, even when not mentioned. If individual attribute is !important and explicite or implicite replacement is not, keep individual attribute require whitespace as delimiters for single value attributes On delimiter "/" treat first as font height, second as line height treat all remaining at the end of line as font font-style, font-variant, font-weight, font-size, line-height, font-family missing font-size and font-family might be not allowed, but accept it here and use default (medium size, enpty font name) @link http://www.w3.org/TR/CSS21/generate.html#propdef-list-style @param $val
[ "Sets", "the", "font", "style" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/style.cls.php#L1569-L1620
40,077
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/style.cls.php
Style.set_transform_origin
function set_transform_origin($val) { $values = preg_split("/\s+/", $val); if ( count($values) === 0) { return; } foreach($values as &$value) { if ( in_array($value, array("top", "left")) ) { $value = 0; } if ( in_array($value, array("bottom", "right")) ) { $value = "100%"; } } if ( !isset($values[1]) ) { $values[1] = $values[0]; } //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["transform_origin"] = null; $this->_props["transform_origin"] = $values; }
php
function set_transform_origin($val) { $values = preg_split("/\s+/", $val); if ( count($values) === 0) { return; } foreach($values as &$value) { if ( in_array($value, array("top", "left")) ) { $value = 0; } if ( in_array($value, array("bottom", "right")) ) { $value = "100%"; } } if ( !isset($values[1]) ) { $values[1] = $values[0]; } //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["transform_origin"] = null; $this->_props["transform_origin"] = $values; }
[ "function", "set_transform_origin", "(", "$", "val", ")", "{", "$", "values", "=", "preg_split", "(", "\"/\\s+/\"", ",", "$", "val", ")", ";", "if", "(", "count", "(", "$", "values", ")", "===", "0", ")", "{", "return", ";", "}", "foreach", "(", "$...
Sets the CSS3 transform-origin property @link http://www.w3.org/TR/css3-2d-transforms/#transform-origin @param string $val
[ "Sets", "the", "CSS3", "transform", "-", "origin", "property" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/style.cls.php#L2095-L2119
40,078
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/renderer.cls.php
Renderer._check_callbacks
protected function _check_callbacks($event, $frame) { if (!isset($this->_callbacks)) { $this->_callbacks = $this->_dompdf->get_callbacks(); } if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) { $info = array(0 => $this->_canvas, "canvas" => $this->_canvas, 1 => $frame, "frame" => $frame); $fs = $this->_callbacks[$event]; foreach ($fs as $f) { if (is_callable($f)) { if (is_array($f)) { $f[0]->$f[1]($info); } else { $f($info); } } } } }
php
protected function _check_callbacks($event, $frame) { if (!isset($this->_callbacks)) { $this->_callbacks = $this->_dompdf->get_callbacks(); } if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) { $info = array(0 => $this->_canvas, "canvas" => $this->_canvas, 1 => $frame, "frame" => $frame); $fs = $this->_callbacks[$event]; foreach ($fs as $f) { if (is_callable($f)) { if (is_array($f)) { $f[0]->$f[1]($info); } else { $f($info); } } } } }
[ "protected", "function", "_check_callbacks", "(", "$", "event", ",", "$", "frame", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_callbacks", ")", ")", "{", "$", "this", "->", "_callbacks", "=", "$", "this", "->", "_dompdf", "->", "get_...
Check for callbacks that need to be performed when a given event gets triggered on a frame @param string $event the type of event @param Frame $frame the frame that event is triggered on
[ "Check", "for", "callbacks", "that", "need", "to", "be", "performed", "when", "a", "given", "event", "gets", "triggered", "on", "a", "frame" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/renderer.cls.php#L210-L229
40,079
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/frame.cls.php
Frame.get_containing_block
function get_containing_block($i = null) { if ( isset($i) ) { return $this->_containing_block[$i]; } return $this->_containing_block; }
php
function get_containing_block($i = null) { if ( isset($i) ) { return $this->_containing_block[$i]; } return $this->_containing_block; }
[ "function", "get_containing_block", "(", "$", "i", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "i", ")", ")", "{", "return", "$", "this", "->", "_containing_block", "[", "$", "i", "]", ";", "}", "return", "$", "this", "->", "_containing_bloc...
Containing block dimensions @param $i string The key of the wanted containing block's dimension (x, y, x, h) @return array|float
[ "Containing", "block", "dimensions" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/frame.cls.php#L388-L393
40,080
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/frame.cls.php
Frame.is_text_node
function is_text_node() { if ( isset($this->_is_cache["text_node"]) ) { return $this->_is_cache["text_node"]; } return $this->_is_cache["text_node"] = ($this->get_node()->nodeName === "#text"); }
php
function is_text_node() { if ( isset($this->_is_cache["text_node"]) ) { return $this->_is_cache["text_node"]; } return $this->_is_cache["text_node"] = ($this->get_node()->nodeName === "#text"); }
[ "function", "is_text_node", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_is_cache", "[", "\"text_node\"", "]", ")", ")", "{", "return", "$", "this", "->", "_is_cache", "[", "\"text_node\"", "]", ";", "}", "return", "$", "this", "->", ...
Tells if the frame is a text node @return bool
[ "Tells", "if", "the", "frame", "is", "a", "text", "node" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/frame.cls.php#L624-L630
40,081
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/frame.cls.php
Frame.append_child
function append_child(Frame $child, $update_node = true) { if ( $update_node ) $this->_node->appendChild($child->_node); // Remove the child from its parent if ( $child->_parent ) $child->_parent->remove_child($child, false); $child->_parent = $this; $child->_next_sibling = null; // Handle the first child if ( !$this->_last_child ) { $this->_first_child = $child; $this->_last_child = $child; $child->_prev_sibling = null; } else { $this->_last_child->_next_sibling = $child; $child->_prev_sibling = $this->_last_child; $this->_last_child = $child; } }
php
function append_child(Frame $child, $update_node = true) { if ( $update_node ) $this->_node->appendChild($child->_node); // Remove the child from its parent if ( $child->_parent ) $child->_parent->remove_child($child, false); $child->_parent = $this; $child->_next_sibling = null; // Handle the first child if ( !$this->_last_child ) { $this->_first_child = $child; $this->_last_child = $child; $child->_prev_sibling = null; } else { $this->_last_child->_next_sibling = $child; $child->_prev_sibling = $this->_last_child; $this->_last_child = $child; } }
[ "function", "append_child", "(", "Frame", "$", "child", ",", "$", "update_node", "=", "true", ")", "{", "if", "(", "$", "update_node", ")", "$", "this", "->", "_node", "->", "appendChild", "(", "$", "child", "->", "_node", ")", ";", "// Remove the child ...
Inserts a new child at the end of the Frame @param $child Frame The new Frame to insert @param $update_node boolean Whether or not to update the DOM
[ "Inserts", "a", "new", "child", "at", "the", "end", "of", "the", "Frame" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/frame.cls.php#L724-L745
40,082
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/frame.cls.php
Frame.insert_child_before
function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) { if ( $ref === $this->_first_child ) { $this->prepend_child($new_child, $update_node); return; } if ( is_null($ref) ) { $this->append_child($new_child, $update_node); return; } if ( $ref->_parent !== $this ) throw new DOMPDF_Exception("Reference child is not a child of this node."); // Update the node if ( $update_node ) $this->_node->insertBefore($new_child->_node, $ref->_node); // Remove the child from its parent if ( $new_child->_parent ) $new_child->_parent->remove_child($new_child, false); $new_child->_parent = $this; $new_child->_next_sibling = $ref; $new_child->_prev_sibling = $ref->_prev_sibling; if ( $ref->_prev_sibling ) $ref->_prev_sibling->_next_sibling = $new_child; $ref->_prev_sibling = $new_child; }
php
function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) { if ( $ref === $this->_first_child ) { $this->prepend_child($new_child, $update_node); return; } if ( is_null($ref) ) { $this->append_child($new_child, $update_node); return; } if ( $ref->_parent !== $this ) throw new DOMPDF_Exception("Reference child is not a child of this node."); // Update the node if ( $update_node ) $this->_node->insertBefore($new_child->_node, $ref->_node); // Remove the child from its parent if ( $new_child->_parent ) $new_child->_parent->remove_child($new_child, false); $new_child->_parent = $this; $new_child->_next_sibling = $ref; $new_child->_prev_sibling = $ref->_prev_sibling; if ( $ref->_prev_sibling ) $ref->_prev_sibling->_next_sibling = $new_child; $ref->_prev_sibling = $new_child; }
[ "function", "insert_child_before", "(", "Frame", "$", "new_child", ",", "Frame", "$", "ref", ",", "$", "update_node", "=", "true", ")", "{", "if", "(", "$", "ref", "===", "$", "this", "->", "_first_child", ")", "{", "$", "this", "->", "prepend_child", ...
Inserts a new child immediately before the specified frame @param $new_child Frame The new Frame to insert @param $ref Frame The Frame after the new Frame @param $update_node boolean Whether or not to update the DOM
[ "Inserts", "a", "new", "child", "immediately", "before", "the", "specified", "frame" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/frame.cls.php#L754-L784
40,083
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/frame.cls.php
Frame.insert_child_after
function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) { if ( $ref === $this->_last_child ) { $this->append_child($new_child, $update_node); return; } if ( is_null($ref) ) { $this->prepend_child($new_child, $update_node); return; } if ( $ref->_parent !== $this ) throw new DOMPDF_Exception("Reference child is not a child of this node."); // Update the node if ( $update_node ) { if ( $ref->_next_sibling ) { $next_node = $ref->_next_sibling->_node; $this->_node->insertBefore($new_child->_node, $next_node); } else { $new_child->_node = $this->_node->appendChild($new_child); } } // Remove the child from its parent if ( $new_child->_parent) $new_child->_parent->remove_child($new_child, false); $new_child->_parent = $this; $new_child->_prev_sibling = $ref; $new_child->_next_sibling = $ref->_next_sibling; if ( $ref->_next_sibling ) $ref->_next_sibling->_prev_sibling = $new_child; $ref->_next_sibling = $new_child; }
php
function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) { if ( $ref === $this->_last_child ) { $this->append_child($new_child, $update_node); return; } if ( is_null($ref) ) { $this->prepend_child($new_child, $update_node); return; } if ( $ref->_parent !== $this ) throw new DOMPDF_Exception("Reference child is not a child of this node."); // Update the node if ( $update_node ) { if ( $ref->_next_sibling ) { $next_node = $ref->_next_sibling->_node; $this->_node->insertBefore($new_child->_node, $next_node); } else { $new_child->_node = $this->_node->appendChild($new_child); } } // Remove the child from its parent if ( $new_child->_parent) $new_child->_parent->remove_child($new_child, false); $new_child->_parent = $this; $new_child->_prev_sibling = $ref; $new_child->_next_sibling = $ref->_next_sibling; if ( $ref->_next_sibling ) $ref->_next_sibling->_prev_sibling = $new_child; $ref->_next_sibling = $new_child; }
[ "function", "insert_child_after", "(", "Frame", "$", "new_child", ",", "Frame", "$", "ref", ",", "$", "update_node", "=", "true", ")", "{", "if", "(", "$", "ref", "===", "$", "this", "->", "_last_child", ")", "{", "$", "this", "->", "append_child", "("...
Inserts a new child immediately after the specified frame @param $new_child Frame The new Frame to insert @param $ref Frame The Frame before the new Frame @param $update_node boolean Whether or not to update the DOM
[ "Inserts", "a", "new", "child", "immediately", "after", "the", "specified", "frame" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/frame.cls.php#L793-L829
40,084
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/frame.cls.php
Frame.remove_child
function remove_child(Frame $child, $update_node = true) { if ( $child->_parent !== $this ) throw new DOMPDF_Exception("Child not found in this frame"); if ( $update_node ) $this->_node->removeChild($child->_node); if ( $child === $this->_first_child ) $this->_first_child = $child->_next_sibling; if ( $child === $this->_last_child ) $this->_last_child = $child->_prev_sibling; if ( $child->_prev_sibling ) $child->_prev_sibling->_next_sibling = $child->_next_sibling; if ( $child->_next_sibling ) $child->_next_sibling->_prev_sibling = $child->_prev_sibling; $child->_next_sibling = null; $child->_prev_sibling = null; $child->_parent = null; return $child; }
php
function remove_child(Frame $child, $update_node = true) { if ( $child->_parent !== $this ) throw new DOMPDF_Exception("Child not found in this frame"); if ( $update_node ) $this->_node->removeChild($child->_node); if ( $child === $this->_first_child ) $this->_first_child = $child->_next_sibling; if ( $child === $this->_last_child ) $this->_last_child = $child->_prev_sibling; if ( $child->_prev_sibling ) $child->_prev_sibling->_next_sibling = $child->_next_sibling; if ( $child->_next_sibling ) $child->_next_sibling->_prev_sibling = $child->_prev_sibling; $child->_next_sibling = null; $child->_prev_sibling = null; $child->_parent = null; return $child; }
[ "function", "remove_child", "(", "Frame", "$", "child", ",", "$", "update_node", "=", "true", ")", "{", "if", "(", "$", "child", "->", "_parent", "!==", "$", "this", ")", "throw", "new", "DOMPDF_Exception", "(", "\"Child not found in this frame\"", ")", ";",...
Remove a child frame @param $child Frame @param $update_node boolean Whether or not to remove the DOM node @return Frame The removed child frame
[ "Remove", "a", "child", "frame" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/frame.cls.php#L839-L862
40,085
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/cellmap.cls.php
Cellmap.set_frame_heights
function set_frame_heights($table_height, $content_height) { // Distribute the increased height proportionally amongst each row foreach ( $this->_frames as $arr ) { $frame = $arr["frame"]; $h = 0; foreach ($arr["rows"] as $row ) { if ( !isset($this->_rows[$row]) ) continue; $h += $this->_rows[$row]["height"]; } if ( $content_height > 0 ) $new_height = ($h / $content_height) * $table_height; else $new_height = 0; if ( $frame instanceof Table_Cell_Frame_Decorator ) $frame->set_cell_height($new_height); else $frame->get_style()->height = $new_height; } }
php
function set_frame_heights($table_height, $content_height) { // Distribute the increased height proportionally amongst each row foreach ( $this->_frames as $arr ) { $frame = $arr["frame"]; $h = 0; foreach ($arr["rows"] as $row ) { if ( !isset($this->_rows[$row]) ) continue; $h += $this->_rows[$row]["height"]; } if ( $content_height > 0 ) $new_height = ($h / $content_height) * $table_height; else $new_height = 0; if ( $frame instanceof Table_Cell_Frame_Decorator ) $frame->set_cell_height($new_height); else $frame->get_style()->height = $new_height; } }
[ "function", "set_frame_heights", "(", "$", "table_height", ",", "$", "content_height", ")", "{", "// Distribute the increased height proportionally amongst each row", "foreach", "(", "$", "this", "->", "_frames", "as", "$", "arr", ")", "{", "$", "frame", "=", "$", ...
Re-adjust frame height if the table height is larger than its content
[ "Re", "-", "adjust", "frame", "height", "if", "the", "table", "height", "is", "larger", "than", "its", "content" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/cellmap.cls.php#L677-L703
40,086
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/table_row_frame_decorator.cls.php
Table_Row_Frame_Decorator.normalise
function normalise() { // Find our table parent $p = Table_Frame_Decorator::find_parent_table($this); $erroneous_frames = array(); foreach ($this->get_children() as $child) { $display = $child->get_style()->display; if ( $display !== "table-cell" ) $erroneous_frames[] = $child; } // dump the extra nodes after the table. foreach ($erroneous_frames as $frame) $p->move_after($frame); }
php
function normalise() { // Find our table parent $p = Table_Frame_Decorator::find_parent_table($this); $erroneous_frames = array(); foreach ($this->get_children() as $child) { $display = $child->get_style()->display; if ( $display !== "table-cell" ) $erroneous_frames[] = $child; } // dump the extra nodes after the table. foreach ($erroneous_frames as $frame) $p->move_after($frame); }
[ "function", "normalise", "(", ")", "{", "// Find our table parent", "$", "p", "=", "Table_Frame_Decorator", "::", "find_parent_table", "(", "$", "this", ")", ";", "$", "erroneous_frames", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "get_c...
Remove all non table-cell frames from this row and move them after the table.
[ "Remove", "all", "non", "table", "-", "cell", "frames", "from", "this", "row", "and", "move", "them", "after", "the", "table", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/table_row_frame_decorator.cls.php#L30-L46
40,087
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/lib/html5lib/TreeBuilder.php
HTML5_TreeBuilder.strConst
private function strConst($number) { static $lookup; if (!$lookup) { $lookup = array(); $r = new ReflectionClass('HTML5_TreeBuilder'); $consts = $r->getConstants(); foreach ($consts as $const => $num) { if (!is_int($num)) continue; $lookup[$num] = $const; } } return $lookup[$number]; }
php
private function strConst($number) { static $lookup; if (!$lookup) { $lookup = array(); $r = new ReflectionClass('HTML5_TreeBuilder'); $consts = $r->getConstants(); foreach ($consts as $const => $num) { if (!is_int($num)) continue; $lookup[$num] = $const; } } return $lookup[$number]; }
[ "private", "function", "strConst", "(", "$", "number", ")", "{", "static", "$", "lookup", ";", "if", "(", "!", "$", "lookup", ")", "{", "$", "lookup", "=", "array", "(", ")", ";", "$", "r", "=", "new", "ReflectionClass", "(", "'HTML5_TreeBuilder'", "...
Converts a magic number to a readable name. Use for debugging.
[ "Converts", "a", "magic", "number", "to", "a", "readable", "name", ".", "Use", "for", "debugging", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/lib/html5lib/TreeBuilder.php#L107-L119
40,088
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/lib/html5lib/Tokenizer.php
HTML5_Tokenizer.emitToken
protected function emitToken($token, $checkStream = true, $dry = false) { if ($checkStream) { // Emit errors from input stream. while ($this->stream->errors) { $this->emitToken(array_shift($this->stream->errors), false); } } if($token['type'] === self::ENDTAG && !empty($token['attr'])) { for ($i = 0; $i < count($token['attr']); $i++) { $this->emitToken(array( 'type' => self::PARSEERROR, 'data' => 'attributes-in-end-tag' )); } } if($token['type'] === self::ENDTAG && !empty($token['self-closing'])) { $this->emitToken(array( 'type' => self::PARSEERROR, 'data' => 'self-closing-flag-on-end-tag', )); } if($token['type'] === self::STARTTAG) { // This could be changed to actually pass the tree-builder a hash $hash = array(); foreach ($token['attr'] as $keypair) { if (isset($hash[$keypair['name']])) { $this->emitToken(array( 'type' => self::PARSEERROR, 'data' => 'duplicate-attribute', )); } else { $hash[$keypair['name']] = $keypair['value']; } } } if(!$dry) { // the current structure of attributes is not a terribly good one $this->tree->emitToken($token); } if(!$dry && is_int($this->tree->content_model)) { $this->content_model = $this->tree->content_model; $this->tree->content_model = null; } elseif($token['type'] === self::ENDTAG) { $this->content_model = self::PCDATA; } }
php
protected function emitToken($token, $checkStream = true, $dry = false) { if ($checkStream) { // Emit errors from input stream. while ($this->stream->errors) { $this->emitToken(array_shift($this->stream->errors), false); } } if($token['type'] === self::ENDTAG && !empty($token['attr'])) { for ($i = 0; $i < count($token['attr']); $i++) { $this->emitToken(array( 'type' => self::PARSEERROR, 'data' => 'attributes-in-end-tag' )); } } if($token['type'] === self::ENDTAG && !empty($token['self-closing'])) { $this->emitToken(array( 'type' => self::PARSEERROR, 'data' => 'self-closing-flag-on-end-tag', )); } if($token['type'] === self::STARTTAG) { // This could be changed to actually pass the tree-builder a hash $hash = array(); foreach ($token['attr'] as $keypair) { if (isset($hash[$keypair['name']])) { $this->emitToken(array( 'type' => self::PARSEERROR, 'data' => 'duplicate-attribute', )); } else { $hash[$keypair['name']] = $keypair['value']; } } } if(!$dry) { // the current structure of attributes is not a terribly good one $this->tree->emitToken($token); } if(!$dry && is_int($this->tree->content_model)) { $this->content_model = $this->tree->content_model; $this->tree->content_model = null; } elseif($token['type'] === self::ENDTAG) { $this->content_model = self::PCDATA; } }
[ "protected", "function", "emitToken", "(", "$", "token", ",", "$", "checkStream", "=", "true", ",", "$", "dry", "=", "false", ")", "{", "if", "(", "$", "checkStream", ")", "{", "// Emit errors from input stream.", "while", "(", "$", "this", "->", "stream",...
Emits a token, passing it on to the tree builder.
[ "Emits", "a", "token", "passing", "it", "on", "to", "the", "tree", "builder", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/lib/html5lib/Tokenizer.php#L2379-L2427
40,089
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/lib/html5lib/Data.php
HTML5_Data.utf8chr
public static function utf8chr($code) { /* We don't care: we live dangerously * if($code > 0x10FFFF or $code < 0x0 or ($code >= 0xD800 and $code <= 0xDFFF) ) { // bits are set outside the "valid" range as defined // by UNICODE 4.1.0 return "\xEF\xBF\xBD"; }*/ $x = $y = $z = $w = 0; if ($code < 0x80) { // regular ASCII character $x = $code; } else { // set up bits for UTF-8 $x = ($code & 0x3F) | 0x80; if ($code < 0x800) { $y = (($code & 0x7FF) >> 6) | 0xC0; } else { $y = (($code & 0xFC0) >> 6) | 0x80; if($code < 0x10000) { $z = (($code >> 12) & 0x0F) | 0xE0; } else { $z = (($code >> 12) & 0x3F) | 0x80; $w = (($code >> 18) & 0x07) | 0xF0; } } } // set up the actual character $ret = ''; if($w) $ret .= chr($w); if($z) $ret .= chr($z); if($y) $ret .= chr($y); $ret .= chr($x); return $ret; }
php
public static function utf8chr($code) { /* We don't care: we live dangerously * if($code > 0x10FFFF or $code < 0x0 or ($code >= 0xD800 and $code <= 0xDFFF) ) { // bits are set outside the "valid" range as defined // by UNICODE 4.1.0 return "\xEF\xBF\xBD"; }*/ $x = $y = $z = $w = 0; if ($code < 0x80) { // regular ASCII character $x = $code; } else { // set up bits for UTF-8 $x = ($code & 0x3F) | 0x80; if ($code < 0x800) { $y = (($code & 0x7FF) >> 6) | 0xC0; } else { $y = (($code & 0xFC0) >> 6) | 0x80; if($code < 0x10000) { $z = (($code >> 12) & 0x0F) | 0xE0; } else { $z = (($code >> 12) & 0x3F) | 0x80; $w = (($code >> 18) & 0x07) | 0xF0; } } } // set up the actual character $ret = ''; if($w) $ret .= chr($w); if($z) $ret .= chr($z); if($y) $ret .= chr($y); $ret .= chr($x); return $ret; }
[ "public", "static", "function", "utf8chr", "(", "$", "code", ")", "{", "/* We don't care: we live dangerously\n * if($code > 0x10FFFF or $code < 0x0 or\n ($code >= 0xD800 and $code <= 0xDFFF) ) {\n // bits are set outside the \"valid\" range as defined\n // b...
Converts a Unicode codepoint to sequence of UTF-8 bytes. @note Shamelessly stolen from HTML Purifier, which is also shamelessly stolen from Feyd (which is in public domain).
[ "Converts", "a", "Unicode", "codepoint", "to", "sequence", "of", "UTF", "-", "8", "bytes", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/lib/html5lib/Data.php#L76-L112
40,090
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/list_bullet_frame_decorator.cls.php
List_Bullet_Frame_Decorator.get_margin_height
function get_margin_height() { $style = $this->_frame->get_style(); if ( $style->list_style_type === "none" ) { return 0; } return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING; }
php
function get_margin_height() { $style = $this->_frame->get_style(); if ( $style->list_style_type === "none" ) { return 0; } return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING; }
[ "function", "get_margin_height", "(", ")", "{", "$", "style", "=", "$", "this", "->", "_frame", "->", "get_style", "(", ")", ";", "if", "(", "$", "style", "->", "list_style_type", "===", "\"none\"", ")", "{", "return", "0", ";", "}", "return", "$", "...
hits only on "inset" lists items, to increase height of box
[ "hits", "only", "on", "inset", "lists", "items", "to", "increase", "height", "of", "box" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/list_bullet_frame_decorator.cls.php#L47-L55
40,091
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php
PDFLib_Adapter.close_object
function close_object() { $this->_pdf->restore(); $this->_pdf->end_template(); $this->_pdf->resume_page("pagenumber=".$this->_page_number); }
php
function close_object() { $this->_pdf->restore(); $this->_pdf->end_template(); $this->_pdf->resume_page("pagenumber=".$this->_page_number); }
[ "function", "close_object", "(", ")", "{", "$", "this", "->", "_pdf", "->", "restore", "(", ")", ";", "$", "this", "->", "_pdf", "->", "end_template", "(", ")", ";", "$", "this", "->", "_pdf", "->", "resume_page", "(", "\"pagenumber=\"", ".", "$", "t...
Close the current template @see PDFLib_Adapter::open_object()
[ "Close", "the", "current", "template" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php#L297-L301
40,092
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php
PDFLib_Adapter.add_object
function add_object($object, $where = 'all') { if ( mb_strpos($where, "next") !== false ) { $this->_objs[$object]["start_page"]++; $where = str_replace("next", "", $where); if ( $where == "" ) $where = "add"; } $this->_objs[$object]["where"] = $where; }
php
function add_object($object, $where = 'all') { if ( mb_strpos($where, "next") !== false ) { $this->_objs[$object]["start_page"]++; $where = str_replace("next", "", $where); if ( $where == "" ) $where = "add"; } $this->_objs[$object]["where"] = $where; }
[ "function", "add_object", "(", "$", "object", ",", "$", "where", "=", "'all'", ")", "{", "if", "(", "mb_strpos", "(", "$", "where", ",", "\"next\"", ")", "!==", "false", ")", "{", "$", "this", "->", "_objs", "[", "$", "object", "]", "[", "\"start_p...
Adds the specified object to the document $where can be one of: - 'add' add to current page only - 'all' add to every page from the current one onwards - 'odd' add to all odd numbered pages from now on - 'even' add to all even numbered pages from now on - 'next' add the object to the next page only - 'nextodd' add to all odd numbered pages from the next one - 'nexteven' add to all even numbered pages from the next one @param int $object the object handle returned by open_object() @param string $where
[ "Adds", "the", "specified", "object", "to", "the", "document" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php#L318-L328
40,093
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php
PDFLib_Adapter.stop_object
function stop_object($object) { if ( !isset($this->_objs[$object]) ) return; $start = $this->_objs[$object]["start_page"]; $where = $this->_objs[$object]["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($object,0,0,""); $this->_objs[$object] = null; unset($this->_objs[$object]); }
php
function stop_object($object) { if ( !isset($this->_objs[$object]) ) return; $start = $this->_objs[$object]["start_page"]; $where = $this->_objs[$object]["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($object,0,0,""); $this->_objs[$object] = null; unset($this->_objs[$object]); }
[ "function", "stop_object", "(", "$", "object", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_objs", "[", "$", "object", "]", ")", ")", "return", ";", "$", "start", "=", "$", "this", "->", "_objs", "[", "$", "object", "]", "[", "\...
Stops the specified template from appearing in the document. The object will stop being displayed on the page following the current one. @param int $object
[ "Stops", "the", "specified", "template", "from", "appearing", "in", "the", "document", "." ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php#L338-L355
40,094
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php
PDFLib_Adapter._set_stroke_color
protected function _set_stroke_color($color) { if($this->_last_stroke_color == $color) return; $this->_last_stroke_color = $color; if (isset($color[3])) { $type = "cmyk"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], $color[3]); } elseif (isset($color[2])) { $type = "rgb"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], null); } else { $type = "gray"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], null, null); } $this->_pdf->setcolor("stroke", $type, $c1, $c2, $c3, $c4); }
php
protected function _set_stroke_color($color) { if($this->_last_stroke_color == $color) return; $this->_last_stroke_color = $color; if (isset($color[3])) { $type = "cmyk"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], $color[3]); } elseif (isset($color[2])) { $type = "rgb"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], null); } else { $type = "gray"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], null, null); } $this->_pdf->setcolor("stroke", $type, $c1, $c2, $c3, $c4); }
[ "protected", "function", "_set_stroke_color", "(", "$", "color", ")", "{", "if", "(", "$", "this", "->", "_last_stroke_color", "==", "$", "color", ")", "return", ";", "$", "this", "->", "_last_stroke_color", "=", "$", "color", ";", "if", "(", "isset", "(...
Sets the line color @param array $color array(r,g,b)
[ "Sets", "the", "line", "color" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php#L451-L471
40,095
thujohn/pdf-l4
src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php
PDFLib_Adapter._set_fill_color
protected function _set_fill_color($color) { if($this->_last_fill_color == $color) return; $this->_last_fill_color = $color; if (isset($color[3])) { $type = "cmyk"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], $color[3]); } elseif (isset($color[2])) { $type = "rgb"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], null); } else { $type = "gray"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], null, null); } $this->_pdf->setcolor("fill", $type, $c1, $c2, $c3, $c4); }
php
protected function _set_fill_color($color) { if($this->_last_fill_color == $color) return; $this->_last_fill_color = $color; if (isset($color[3])) { $type = "cmyk"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], $color[3]); } elseif (isset($color[2])) { $type = "rgb"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], $color[2], null); } else { $type = "gray"; list($c1, $c2, $c3, $c4) = array($color[0], $color[1], null, null); } $this->_pdf->setcolor("fill", $type, $c1, $c2, $c3, $c4); }
[ "protected", "function", "_set_fill_color", "(", "$", "color", ")", "{", "if", "(", "$", "this", "->", "_last_fill_color", "==", "$", "color", ")", "return", ";", "$", "this", "->", "_last_fill_color", "=", "$", "color", ";", "if", "(", "isset", "(", "...
Sets the fill color @param array $color array(r,g,b)
[ "Sets", "the", "fill", "color" ]
e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9
https://github.com/thujohn/pdf-l4/blob/e42bc4aff4512b742c8b7e9a2eb493b92ed9c5e9/src/Thujohn/Pdf/dompdf/include/pdflib_adapter.cls.php#L478-L498
40,096
claroline/Distribution
main/core/Manager/AuthenticationManager.php
AuthenticationManager.getService
public function getService($driver) { $parts = $driver = explode(':', $driver); $driver = explode('.', $parts[0]); if (isset($driver[1])) { $serviceName = $driver[0].'.'.$driver[1].'_bundle.manager.'.$driver[1].'_manager'; if ($this->container->has($serviceName)) { return $this->container->get($serviceName); } } }
php
public function getService($driver) { $parts = $driver = explode(':', $driver); $driver = explode('.', $parts[0]); if (isset($driver[1])) { $serviceName = $driver[0].'.'.$driver[1].'_bundle.manager.'.$driver[1].'_manager'; if ($this->container->has($serviceName)) { return $this->container->get($serviceName); } } }
[ "public", "function", "getService", "(", "$", "driver", ")", "{", "$", "parts", "=", "$", "driver", "=", "explode", "(", "':'", ",", "$", "driver", ")", ";", "$", "driver", "=", "explode", "(", "'.'", ",", "$", "parts", "[", "0", "]", ")", ";", ...
Return authentication driver manager. @param $driver The name of the driver including the server, example: claroline.ldap:server1
[ "Return", "authentication", "driver", "manager", "." ]
a2d9762eddba5732447a2915c977a3ce859103b6
https://github.com/claroline/Distribution/blob/a2d9762eddba5732447a2915c977a3ce859103b6/main/core/Manager/AuthenticationManager.php#L91-L102
40,097
claroline/Distribution
main/core/Twig/SerializerExtension.php
SerializerExtension.apiSerialize
public function apiSerialize($object, $options = []) { if (!empty($object)) { return $this->serializerProvider->serialize($object, $options); } return $object; }
php
public function apiSerialize($object, $options = []) { if (!empty($object)) { return $this->serializerProvider->serialize($object, $options); } return $object; }
[ "public", "function", "apiSerialize", "(", "$", "object", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "object", ")", ")", "{", "return", "$", "this", "->", "serializerProvider", "->", "serialize", "(", "$", "objec...
Serializes data to JSON using the SerializerProvider. @param mixed $object @param array $options @return mixed
[ "Serializes", "data", "to", "JSON", "using", "the", "SerializerProvider", "." ]
a2d9762eddba5732447a2915c977a3ce859103b6
https://github.com/claroline/Distribution/blob/a2d9762eddba5732447a2915c977a3ce859103b6/main/core/Twig/SerializerExtension.php#L70-L77
40,098
claroline/Distribution
main/core/Twig/SerializerExtension.php
SerializerExtension.serialize
public function serialize($data, $group = null) { $context = new SerializationContext(); if ($group) { $context->setGroups($group); } return $this->serializer->serialize($data, 'json', $context); }
php
public function serialize($data, $group = null) { $context = new SerializationContext(); if ($group) { $context->setGroups($group); } return $this->serializer->serialize($data, 'json', $context); }
[ "public", "function", "serialize", "(", "$", "data", ",", "$", "group", "=", "null", ")", "{", "$", "context", "=", "new", "SerializationContext", "(", ")", ";", "if", "(", "$", "group", ")", "{", "$", "context", "->", "setGroups", "(", "$", "group",...
Serializes data to JSON, optionally filtering on a serialization group. @param mixed $data @param string $group @deprecated serialization should be handled by SerializerProvider
[ "Serializes", "data", "to", "JSON", "optionally", "filtering", "on", "a", "serialization", "group", "." ]
a2d9762eddba5732447a2915c977a3ce859103b6
https://github.com/claroline/Distribution/blob/a2d9762eddba5732447a2915c977a3ce859103b6/main/core/Twig/SerializerExtension.php#L87-L96
40,099
claroline/Distribution
plugin/blog/Controller/API/BlogController.php
BlogController.getOptionsAction
public function getOptionsAction(Request $request, Blog $blog) { $this->checkPermission('EDIT', $blog->getResourceNode(), [], true); return new JsonResponse($this->blogOptionsSerializer->serialize($blog, $blog->getOptions(), $this->blogManager->getPanelInfos())); }
php
public function getOptionsAction(Request $request, Blog $blog) { $this->checkPermission('EDIT', $blog->getResourceNode(), [], true); return new JsonResponse($this->blogOptionsSerializer->serialize($blog, $blog->getOptions(), $this->blogManager->getPanelInfos())); }
[ "public", "function", "getOptionsAction", "(", "Request", "$", "request", ",", "Blog", "$", "blog", ")", "{", "$", "this", "->", "checkPermission", "(", "'EDIT'", ",", "$", "blog", "->", "getResourceNode", "(", ")", ",", "[", "]", ",", "true", ")", ";"...
Get blog options. @EXT\Route("options", name="apiv2_blog_options") @EXT\Method("GET") @param Blog $blog @return array
[ "Get", "blog", "options", "." ]
a2d9762eddba5732447a2915c977a3ce859103b6
https://github.com/claroline/Distribution/blob/a2d9762eddba5732447a2915c977a3ce859103b6/plugin/blog/Controller/API/BlogController.php#L83-L88