/** * Calculates the URL from the given path. * * @since 1.3.3.2 * @since 1.3.3.8 FIxed an issue that /./ gets inserted. * @static * @access public * @return string The source url */ public static function getSRCFromPath($sFilePath) { $oWPStyles = new WP_Styles(); // It doesn't matter whether the file is a style or not. Just use the built-in WordPress class to calculate the SRC URL. $sRelativePath = FetchTweets_Utilities::getRelativePath(ABSPATH, $sFilePath); $sRelativePath = preg_replace("/^\\.[\\/\\\\]/", '', $sRelativePath, 1); // removes the heading ./ or .\ $sHref = trailingslashit($oWPStyles->base_url) . $sRelativePath; unset($oWPStyles); // for PHP 5.2.x or below return esc_url($sHref); }
/** * Make the passed template array compatible with the format of v2.3.8 or below. * * @return array|false The formatted template array or false if the necessary file paths do not exist. */ private function _formatTemplateArrayLegacy(array $aTemplate) { $aTemplate = $aTemplate + self::$aStructure_Template_Legacy; $aTemplate['strDirPath'] = $aTemplate['strDirPath'] ? $aTemplate['strDirPath'] : dirname($aTemplate['strCSSPath']); $aTemplate['strTemplatePath'] = $aTemplate['strTemplatePath'] ? $aTemplate['strTemplatePath'] : dirname($aTemplate['strCSSPath']) . DIRECTORY_SEPARATOR . 'template.php'; $aTemplate['strDirRelativePath'] = $aTemplate['strDirRelativePath'] ? $aTemplate['strDirRelativePath'] : str_replace('\\', '/', untrailingslashit(FetchTweets_Utilities::getRelativePath(ABSPATH, $aTemplate['strDirPath']))); return $aTemplate; }
/** * Returns the relative path to ABSPATH. * @since 2.3.9 */ public function getRelativeDirPath() { if (isset($this->aData['sRelativeDirPath'])) { return $this->aData['sRelativeDirPath']; } if (isset($this->aData['sDirPath'])) { $_sRelativeDirPath = str_replace('\\', '/', untrailingslashit(FetchTweets_Utilities::getRelativePath(ABSPATH, $this->aData['sDirPath']))); $this->aData['sRelativeDirPath'] = $_sRelativeDirPath; // update it return $_sRelativeDirPath; } return ''; }