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); } } }
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); } } }
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; }