本文整理汇总了PHP中CRM_Utils_System::relativeURL方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::relativeURL方法的具体用法?PHP CRM_Utils_System::relativeURL怎么用?PHP CRM_Utils_System::relativeURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::relativeURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeDirectoryOrURLPreferences
/**
* @param $params
* @param string $type
*/
static function storeDirectoryOrURLPreferences(&$params, $type = 'directory')
{
$optionName = $type == 'directory' ? 'directory_preferences' : 'url_preferences';
$sql = "\nUPDATE civicrm_option_value v,\n civicrm_option_group g\nSET v.value = %1,\n v.is_active = 1\nWHERE g.name = %2\nAND v.option_group_id = g.id\nAND v.name = %3\n";
foreach ($params as $name => $value) {
// always try to store relative directory or url from CMS root
if ($type == 'directory') {
$value = CRM_Utils_File::relativeDirectory($value);
} else {
$value = CRM_Utils_System::relativeURL($value);
}
$sqlParams = array(1 => array($value, 'String'), 2 => array($optionName, 'String'), 3 => array($name, 'String'));
CRM_Core_DAO::executeQuery($sql, $sqlParams);
}
}
示例2: storeDirectoryOrURLPreferences
/**
* @param array $params
* @param $group
*/
public static function storeDirectoryOrURLPreferences(&$params, $group)
{
foreach ($params as $name => $value) {
// always try to store relative directory or url from CMS root
$value = $group == self::DIRECTORY_PREFERENCES_NAME ? CRM_Utils_File::relativeDirectory($value) : CRM_Utils_System::relativeURL($value);
self::setItem($value, $group, $name);
}
}