本文整理汇总了PHP中bx_ltrim_str函数的典型用法代码示例。如果您正苦于以下问题:PHP bx_ltrim_str函数的具体用法?PHP bx_ltrim_str怎么用?PHP bx_ltrim_str使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bx_ltrim_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bxMockFree
function bxMockFree(&$o)
{
$sClassName = bx_ltrim_str(get_class($o), 'Mock_');
$sClassName = preg_replace('/_[A-Za-z0-9]+$/', '', $sClassName);
unset($GLOBALS['bxDolClasses'][$sClassName]);
unset($o);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->aInstallPermissions = array('inc', 'cache', 'cache_public', 'logs', 'tmp', 'storage', defined('BX_SYSTEM_FFMPEG') ? bx_ltrim_str(BX_SYSTEM_FFMPEG, BX_DIRECTORY_PATH_ROOT) : 'plugins/ffmpeg/ffmpeg.exe');
// remove 'inc' folder if script is already installed
if (defined('BX_DOL')) {
array_shift($this->aInstallPermissions);
}
$this->aPostInstallPermissions = array();
if (defined('BX_DOL_INSTALL') && BX_DOL_INSTALL) {
$this->bInstallScript = true;
$this->sRootPath = BX_INSTALL_URL_ROOT;
} else {
$this->bInstallScript = false;
$this->sRootPath = BX_DOL_URL_ROOT;
}
}
示例3: _callbackParseUrl
/**
* Private callback function for CSS compiler.
*
* @param string $sPath CSS file absolute path.
* @param array $aMatches matched parts of image's URL.
* @return string converted image's URL.
*/
function _callbackParseUrl($sPath, $aMatches)
{
$sFile = basename($aMatches[1]);
$sDirectory = dirname($aMatches[1]);
$sRootPath = realpath(BX_DIRECTORY_PATH_ROOT);
$sAbsolutePath = realpath($sPath . $sDirectory) . DIRECTORY_SEPARATOR . $sFile;
$sRootPath = str_replace(DIRECTORY_SEPARATOR, '/', $sRootPath);
$sAbsolutePath = str_replace(DIRECTORY_SEPARATOR, '/', $sAbsolutePath);
return 'url(' . bx_ltrim_str($sAbsolutePath, $sRootPath, BX_DOL_URL_ROOT) . ')';
}
示例4: _lessCss
/**
* Less CSS
*
* @param mixed $mixed CSS string to process with Less compiler or an array with CSS file's Path and URL.
* @return mixed string or an array with CSS file's Path and URL.
*/
function _lessCss($mixed)
{
require_once BX_DIRECTORY_PATH_PLUGINS . 'lessphp/lessc.inc.php';
$oLess = new lessc();
$oLess->setVariables($this->_oConfigTemplate->aLessConfig);
if (is_array($mixed) && isset($mixed['url']) && isset($mixed['path'])) {
$sPathFile = realpath($mixed['path']);
$aInfoFile = pathinfo($sPathFile);
if (!isset($aInfoFile['extension']) || $aInfoFile['extension'] != 'less') {
return $mixed;
}
$sPathRoot = realpath(BX_DIRECTORY_PATH_ROOT);
$sFile = $this->_sLessCachePrefix . trim(str_replace(array('.' . $aInfoFile['extension'], DIRECTORY_SEPARATOR), array('', '_'), bx_ltrim_str($sPathFile, $sPathRoot)), '_') . '.css';
$oLess->checkedCompile($mixed['path'], $this->_sCachePublicFolderPath . $sFile);
return array('url' => $this->_sCachePublicFolderUrl . $sFile, 'path' => $this->_sCachePublicFolderPath . $sFile);
}
return $oLess->compile($mixed);
}
示例5: getDataReturnUrl
function getDataReturnUrl($bSsl = false)
{
$sResult = BX_DOL_URL_ROOT . $this->_sDataReturnUrl;
if ($bSsl && strpos($sResult, 'https://') === false) {
$sResult = 'https://' . bx_ltrim_str($sResult, 'http://');
}
return $sResult;
}
示例6: filePathWithoutBase
protected function filePathWithoutBase($sPath)
{
return bx_ltrim_str($sPath, $this->_sModulePath);
}
示例7: actionChangePermissions
function actionChangePermissions($bInstall = true)
{
$aPermissions = $bInstall ? $this->_aConfig['install_permissions'] : $this->_aConfig['uninstall_permissions'];
$aResult = $aChangeItems = array();
foreach ($aPermissions as $sPermissions => $aFiles) {
$sCheckFunction = 'is' . ucfirst($sPermissions);
foreach ($aFiles as $sFile) {
$sPath = bx_ltrim_str($this->_sModulePath . $sFile, BX_DIRECTORY_PATH_ROOT);
if (BxDolInstallerUtils::$sCheckFunction($sPath)) {
continue;
}
$aResult[] = array('path' => $this->_sModulePath . $sFile, 'permissions' => $sPermissions);
$aChangeItems[] = array('file' => $sFile, 'path' => $sPath, 'permissions' => $sPermissions);
}
}
if (empty($aChangeItems)) {
return BX_DOL_INSTALLER_SUCCESS;
}
bx_import('BxDolFtp');
$oFile = new BxDolFtp($_SERVER['HTTP_HOST'], getParam('sys_ftp_login'), getParam('sys_ftp_password'), getParam('sys_ftp_dir'));
if (!$oFile->connect()) {
return array('code' => BX_DOL_INSTALLER_FAILED, 'content_msg' => '_adm_txt_modules_wrong_permissions_change_cannot_connect_to_ftp', 'content_data' => $aResult);
}
if (!$oFile->isDolphin()) {
return array('code' => BX_DOL_INSTALLER_FAILED, 'content_msg' => '_adm_txt_modules_wrong_permissions_change_destination_not_valid', 'content_data' => $aResult);
}
$aResult = array();
foreach ($aChangeItems as $aChangeItem) {
if (!$oFile->setPermissions($aChangeItem['path'], $aChangeItem['permissions'])) {
$aResult[] = array('path' => $this->_sModulePath . $aChangeItem['file'], 'permissions' => $aChangeItem['permissions']);
}
}
return empty($aResult) ? BX_DOL_INSTALLER_SUCCESS : array('code' => BX_DOL_INSTALLER_FAILED, 'content_msg' => '_adm_txt_modules_wrong_permissions_change', 'content_data' => $aResult);
}
示例8: bx_instance
/**
* Gets an instance of class pathing necessary parameters if it's necessary.
*
* @param string $sClassName class name.
* @param array $aParams an array of parameters to be pathed to the constructor of the class.
* @param array $aModule an array with module description. Is used when the requested class is located in some module.
* @return unknown
*/
function bx_instance($sClassName, $aParams = array(), $mixedModule = array())
{
if (isset($GLOBALS['bxDolClasses'][$sClassName])) {
return $GLOBALS['bxDolClasses'][$sClassName];
}
if ($mixedModule) {
if (!is_array($mixedModule)) {
$o = BxDolModule::getInstance($mixedModule);
$mixedModule = $o->_aModule;
}
$sClassName = bx_ltrim_str($sClassName, $mixedModule['class_prefix']);
bx_import($sClassName, $mixedModule);
$sClassName = $mixedModule['class_prefix'] . $sClassName;
}
$oClass = new ReflectionClass($sClassName);
$GLOBALS['bxDolClasses'][$sClassName] = empty($aParams) ? $oClass->newInstance() : $oClass->newInstanceArgs($aParams);
return $GLOBALS['bxDolClasses'][$sClassName];
}
示例9: bx_ltrim_str
{
return $this->sMarker;
}
}
global $_page, $glHeader, $glFooter, $logged, $_ni;
$GLOBALS['name_index'] = $_page['name_index'] = 55;
$_page['header'] = $gConf['def_title'];
$_page['header_text'] = $gConf['def_title'];
$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = '-=++=-';
global $gConf;
$sCssPathUrl = bx_ltrim_str($gConf['url']['css'], BX_DOL_URL_ROOT);
$sCssPathDir = bx_ltrim_str("{$gConf['dir']['layouts']}{$gConf['skin']}/css/", BX_DIRECTORY_PATH_ROOT);
$GLOBALS['oSysTemplate']->addCss("{$sCssPathDir}|{$sCssPathUrl}|main.css");
$sJsPathUrl = bx_ltrim_str($gConf['url']['js'], BX_DOL_URL_ROOT);
$sJsPathDir = bx_ltrim_str($gConf['dir']['js'], BX_DIRECTORY_PATH_ROOT);
$GLOBALS['oSysTemplate']->addJs(array('history.js', "{$sJsPathDir}|{$sJsPathUrl}|util.js", "{$sJsPathDir}|{$sJsPathUrl}|BxError.js", "{$sJsPathDir}|{$sJsPathUrl}|BxXmlRequest.js", "{$sJsPathDir}|{$sJsPathUrl}|BxXslTransform.js", "{$sJsPathDir}|{$sJsPathUrl}|BxForum.js", "{$sJsPathDir}|{$sJsPathUrl}|BxHistory.js", "{$sJsPathDir}|{$sJsPathUrl}|BxLogin.js", "{$sJsPathDir}|{$sJsPathUrl}|BxAdmin.js"));
$GLOBALS['BxDolTemplateInjections']['page_' . $_ni]['injection_body'][] = array('type' => 'text', 'data' => 'id="body" onload="if(!document.body) { document.body = document.getElementById(\'body\'); }; h = new BxHistory(\'' . $gConf['url']['base'] . '\'); document.h = h; return h.init(\'h\'); "');
if (BX_ORCA_INTEGRATION == 'dolphin') {
$aVars = array('ForumBaseUrl' => $gConf['url']['base']);
$GLOBALS['oTopMenu']->setCustomSubActions($aVars, 'bx_forum_title', false);
}
if (isLogged()) {
bx_import('BxDolEditor');
$oEditor = BxDolEditor::getObjectInstance();
$sEditorId = isset($_REQUEST['new_topic']) ? '#tinyEditor' : '#fakeEditor';
if ($oEditor) {
if ('sys_tinymce' == $oEditor->getObjectName()) {
$oEditor->setCustomConf('setup :
function(ed) {
ed.on("init", function(e) {
示例10: _compileCss
/**
* Compile CSS files' structure(@see @import css_file_path) in one file.
*
* @param string $sAbsolutePath CSS file absolute path(full URL for external CSS/JS files).
* @param array $aIncluded an array of already included CSS files.
* @return string result of operation.
*/
function _compileCss($sAbsolutePath, &$aIncluded)
{
if (isset($aIncluded[$sAbsolutePath])) {
return '';
}
$bExternal = strpos($sAbsolutePath, "http://") !== false || strpos($sAbsolutePath, "https://") !== false;
if ($bExternal) {
$sPath = $sAbsolutePath;
$sName = '';
$sContent = bx_file_get_contents($sAbsolutePath);
} else {
$aFileInfo = pathinfo($sAbsolutePath);
$sPath = $aFileInfo['dirname'] . DIRECTORY_SEPARATOR;
$sName = $aFileInfo['basename'];
$sContent = file_get_contents($sPath . $sName);
}
if (empty($sContent)) {
return '';
}
$sUrl = bx_ltrim_str($sPath, realpath(BX_DIRECTORY_PATH_ROOT), BX_DOL_URL_ROOT);
$sUrl = str_replace(DIRECTORY_SEPARATOR, '/', $sUrl);
$sContent = "\r\n/*--- BEGIN: " . $sUrl . $sName . "---*/\r\n" . $sContent . "\r\n/*--- END: " . $sUrl . $sName . "---*/\r\n";
$aIncluded[$sAbsolutePath] = 1;
$sContent = str_replace(array("\n\r", "\r\n", "\r"), "\n", $sContent);
if ($bExternal) {
$sContent = preg_replace(array("'@import\\s+url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/_-]+)\\s*[\\'|\"]*\\s*\\)\\s*;'", "'url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/\\?\\#_=-]+)\\s*[\\'|\"]*\\s*\\)'"), array("", "'url('" . $sPath . "'\\1)'"), $sContent);
} else {
try {
$oTemplate =& $this;
$sContent = preg_replace_callback("'@import\\s+url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/_-]+)\\s*[\\'|\"]*\\s*\\)\\s*;'", function ($aMatches) use($oTemplate, $sPath, $aIncluded) {
return $oTemplate->_compileCss(realpath($sPath . dirname($aMatches[1])) . DIRECTORY_SEPARATOR . basename($aMatches[1]), $aIncluded);
}, $sContent);
$sContent = preg_replace_callback("'url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/\\?\\#_=-]+)\\s*[\\'|\"]*\\s*\\)'", function ($aMatches) use($oTemplate, $sPath) {
$sFile = basename($aMatches[1]);
$sDirectory = dirname($aMatches[1]);
$sRootPath = realpath(BX_DIRECTORY_PATH_ROOT);
$sAbsolutePath = realpath(addslashes($sPath) . $sDirectory) . DIRECTORY_SEPARATOR . $sFile;
$sRootPath = str_replace(DIRECTORY_SEPARATOR, '/', $sRootPath);
$sAbsolutePath = str_replace(DIRECTORY_SEPARATOR, '/', $sAbsolutePath);
return 'url(' . bx_ltrim_str($sAbsolutePath, $sRootPath, BX_DOL_URL_ROOT) . ')';
}, $sContent);
} catch (Exception $oException) {
return '';
}
}
return $sContent;
}
示例11: getRepostedLanguageKey
function getRepostedLanguageKey($sType, $sAction, $mixedObjectId, $bTitle = false)
{
$sLanguageKey = '_wall_reposted_';
if ($bTitle) {
$sLanguageKey .= 'title_';
}
$sLanguageKey .= bx_ltrim_str($sType, $this->_oConfig->getPrefix('common_post'), '');
if (!empty($sAction)) {
$sLanguageKey .= '_' . $sAction;
}
if ($this->_oConfig->isGrouped($sType, $sAction, $mixedObjectId)) {
$sLanguageKey .= '_grouped';
}
return $sLanguageKey;
}
示例12: actionChangePermissions
function actionChangePermissions($bInstall = true)
{
$aPermissions = $bInstall ? $this->_aConfig['install_permissions'] : $this->_aConfig['uninstall_permissions'];
$aResult = array();
foreach ($aPermissions as $sPermissions => $aFiles) {
$sCheckFunction = 'is' . ucfirst($sPermissions);
$sCptPermissions = _t('_adm_txt_modules_' . $sPermissions);
foreach ($aFiles as $sFile) {
if (!BxDolInstallerUtils::$sCheckFunction(bx_ltrim_str($this->_sModulePath . $sFile, BX_DIRECTORY_PATH_ROOT))) {
$aResult[] = array('path' => $this->_sModulePath . $sFile, 'permissions' => $sCptPermissions);
}
}
}
return empty($aResult) ? BX_DOL_INSTALLER_SUCCESS : array('code' => BX_DOL_INSTALLER_FAILED, 'content' => $aResult);
}
示例13: setTransientUpgradeCronJob
public function setTransientUpgradeCronJob($sUnpackedPath)
{
$sUnpackedPath = rtrim($sUnpackedPath, '/') . '/';
bx_import('BxDolCronQuery');
return BxDolCronQuery::getInstance()->addTransientJobClass('sys_perform_upgrade', 'BxDolUpgradeCron', bx_ltrim_str($sUnpackedPath, BX_DIRECTORY_PATH_ROOT) . 'BxDolUpgradeCron.php');
}
示例14: bx_mkdir_r
function bx_mkdir_r($sDirName, $rights = 0777)
{
$sDirName = bx_ltrim_str($sDirName, BX_DIRECTORY_PATH_ROOT);
$aDirs = explode('/', $sDirName);
$sDir = '';
foreach ($aDirs as $sPart) {
$sDir .= $sPart . '/';
if (!is_dir(BX_DIRECTORY_PATH_ROOT . $sDir) && strlen(BX_DIRECTORY_PATH_ROOT . $sDir) > 0 && !file_exists(BX_DIRECTORY_PATH_ROOT . $sDir)) {
if (!mkdir(BX_DIRECTORY_PATH_ROOT . $sDir, $rights)) {
return false;
}
}
}
return true;
}
示例15: filePathWithoutBase
protected function filePathWithoutBase($sPath)
{
return bx_ltrim_str($sPath, BX_DIRECTORY_PATH_ROOT);
}