本文整理汇总了PHP中JCckDev::toSafeID方法的典型用法代码示例。如果您正苦于以下问题:PHP JCckDev::toSafeID方法的具体用法?PHP JCckDev::toSafeID怎么用?PHP JCckDev::toSafeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCckDev
的用法示例。
在下文中一共展示了JCckDev::toSafeID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCCK_Field_TypoBeforeRenderContent
public static function onCCK_Field_TypoBeforeRenderContent($process, &$fields, &$storages, &$config = array())
{
$name = $process['name'];
if (count($process['matches'][1])) {
foreach ($process['matches'][1] as $k => $v) {
$fieldname = $process['matches'][2][$k];
$target = strtolower($v);
$value = '';
if (strpos($fieldname, ',') !== false) {
$fieldname = explode(',', $fieldname);
if (count($fieldname) == 3) {
if ($fields[$fieldname[0]]->value[$fieldname[1]][$fieldname[2]]) {
$value = $fields[$fieldname[0]]->value[$fieldname[1]][$fieldname[2]]->{$target};
}
} else {
if ($fields[$fieldname[0]]->value[$fieldname[1]]) {
$value = $fields[$fieldname[0]]->value[$fieldname[1]]->{$target};
}
}
} else {
$pos = strpos($target, 'safe');
if ($pos !== false && $pos == 0) {
$target = substr($target, 4);
$value = $fields[$fieldname]->{$target};
$value = JCckDev::toSafeID($value);
} else {
$value = $fields[$fieldname]->{$target};
}
}
$fields[$name]->typo = str_replace($process['matches'][0][$k], $value, $fields[$name]->typo);
}
}
}
示例2: g_setCustomVars
public static function g_setCustomVars($process, &$fields, $name)
{
foreach ($process['matches'][1] as $k => $v) {
$fieldname = $process['matches'][2][$k];
$target = strtolower($v);
$pos = strpos($target, 'safe');
if ($pos !== false && $pos == 0) {
$target = substr($target, 4);
$replace = $fields[$fieldname]->{$target};
$replace = JCckDev::toSafeID($replace);
} else {
$replace = $fields[$fieldname]->{$target};
}
$fields[$name]->link = str_replace($process['matches'][0][$k], $replace, $fields[$name]->link);
if (isset($fields[$name]->form)) {
$fields[$name]->form = str_replace($process['matches'][0][$k], $replace, $fields[$name]->form);
}
if (isset($fields[$name]->html)) {
$fields[$name]->html = str_replace($process['matches'][0][$k], $replace, $fields[$name]->html);
}
if (isset($fields[$name]->typo)) {
$fields[$name]->typo = str_replace($process['matches'][0][$k], $replace, $fields[$name]->typo);
}
}
}
示例3: _prepare
protected static function _prepare($target, $process, &$fields)
{
$id = $process['id'];
$label = $process['label'];
$name = $process['name'];
$group_id = $process['group_id'];
$value = $process['value'];
static $groups = array();
if (!isset($groups[$group_id])) {
$groups[$group_id] = array('active' => $value, 'current' => 0, 'identifier' => $process['identifier'], 'url_actions' => $process['url_actions']);
}
if ($groups[$group_id]['identifier']) {
$id = JCckDev::toSafeID($label);
}
if ($fields[$name]->bool == 2) {
$html = JCckDevTabs::end();
} elseif ($fields[$name]->bool == 1) {
$html = JCckDevTabs::open($group_id, $id, $label);
if ($target == 'form') {
$html = str_replace('class="tab-pane', 'class="tab-pane cck-tab-pane', $html);
}
$js = '';
if ($groups[$group_id]['current'] == $groups[$group_id]['active']) {
$js = '$("#' . $group_id . 'Tabs > li,#' . $group_id . 'Content > div").removeClass("active"); $("#' . $group_id . 'Tabs > li:eq(' . (int) $groups[$group_id]['active'] . '),#' . $id . '").addClass("active");';
}
if ($groups[$group_id]['url_actions']) {
$js = 'var cur = window.location.hash; if(cur!="" && $(cur).length) { $("a[href=\'"+cur+"\']").tab("show"); }';
if ($groups[$group_id]['url_actions'] == 2) {
$js .= ' $("a[data-toggle=\'tab\']").on("shown", function(e) {window.location.hash = e.target.hash;})';
}
}
if ($js) {
$js = '(function($){ $(document).ready(function() { ' . $js . ' }); })(jQuery);';
JFactory::getDocument()->addScriptDeclaration($js);
}
} else {
$html = JCckDevTabs::start($group_id, $id, $label, array('active' => $id));
if ($target == 'form') {
$html = str_replace('class="nav nav-tabs"', 'class="nav nav-tabs cck-tabs"', $html);
$html = str_replace('class="tab-pane', 'class="tab-pane cck-tab-pane', $html);
}
}
$groups[$group_id]['current']++;
$fields[$name]->{$target} = $html;
}