本文整理汇总了PHP中ocp_tempcode::parse_from方法的典型用法代码示例。如果您正苦于以下问题:PHP ocp_tempcode::parse_from方法的具体用法?PHP ocp_tempcode::parse_from怎么用?PHP ocp_tempcode::parse_from使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocp_tempcode
的用法示例。
在下文中一共展示了ocp_tempcode::parse_from方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_menu_branch
//.........这里部分代码省略.........
if ($zone_name == $users_current_zone) {
global $ZONE;
$v = $ZONE['zone_default_page'];
}
}
$pv = get_param($k, $k == 'page' ? $dp : NULL, true);
if ($pv !== $v && ($k != 'page' || is_null($REDIRECTED_TO) || !is_null($REDIRECTED_TO) && ($v !== $REDIRECTED_TO['r_to_page'] || $zone_name != $REDIRECTED_TO['r_to_zone'])) && ($k != 'type' || $v != 'misc') && ($v != $dp || $k != 'page' || get_param('page', '') != '') && substr($k, 0, 5) != 'keep_') {
$current_page = false;
break;
}
}
}
} else {
$page_link = '';
$sym_pos = mixed();
$sym_pos = is_null($url) ? false : strpos($url, '{$');
if ($sym_pos !== false) {
$_url = new ocp_tempcode();
$len = strlen($url);
$prev = 0;
do {
$p_len = $sym_pos + 1;
$balance = 1;
while ($p_len < $len && $balance != 0) {
if ($url[$p_len] == '{') {
$balance++;
} elseif ($url[$p_len] == '}') {
$balance--;
}
$p_len++;
}
$_url->attach(substr($url, $prev, $sym_pos - $prev));
$_ret = new ocp_tempcode();
$_ret->parse_from($url, $sym_pos, $p_len);
$_url->attach($_ret);
$prev = $p_len;
$sym_pos = strpos($url, '{$', $sym_pos + 1);
} while ($sym_pos !== false);
$_url->attach(substr($url, $prev));
$url = $_url;
}
}
} else {
$page_link = NULL;
}
// Children
$children = new ocp_tempcode();
$display = 'block';
if ($branch['type'] == 'drawer') {
$new_children = array();
foreach ($branch['children'] as $i => $child) {
list($children2, $_expand_this) = render_menu_branch($child, $codename, $source_member, $level + 1, $type, $as_admin, $all_branches, $the_level + 1);
if ($_expand_this) {
$expand_this = true;
}
if ($children2 !== '' && !is_null($children2)) {
$new_children[] = $children2;
}
}
$num = count($new_children);
foreach ($new_children as $i => $child) {
if (is_object($child)) {
$children->attach($child);
} else {
$children->attach(do_template('MENU_BRANCH_' . filter_naughty_harsh($type), $child + array('POSITION' => strval($i), 'LAST' => $i == $num - 1, 'BRETHREN_COUNT' => strval($num)), NULL, false, 'MENU_BRANCH_tree'));
}
示例2: comcode_text_to_tempcode
//.........这里部分代码省略.........
}
$p_len = 1;
while ($pos + $p_len < $len) {
$p_portion = substr($comcode, $pos - 1, $p_len);
if (substr_count(str_replace('{', ' { ', $p_portion), '{') == substr_count(str_replace('}', ' } ', $p_portion), '}')) {
break;
}
// str_replace is to workaround a Quercus bug #4494
$p_len++;
}
$p_len--;
$p_portion = substr($comcode, $pos + $p_len, $p_end - ($pos + $p_len));
require_code('tempcode_compiler');
$ret = template_to_tempcode(substr($comcode, $pos - 1, $p_len + 1) . '{DIRECTIVE_EMBEDMENT}' . substr($comcode, $p_end, 6));
$attaches_before = count($COMCODE_ATTACHMENTS[$pass_id]);
$ret->singular_bind('DIRECTIVE_EMBEDMENT', comcode_text_to_tempcode($p_portion, $source_member, $as_admin, $wrap_pos, $pass_id, $connection, $semiparse_mode, $preparse_mode, $in_semihtml, $structure_sweep, $check_only, $highlight_bits, $on_behalf_of_member));
for ($attach_inspect = $attaches_before; $attach_inspect < count($COMCODE_ATTACHMENTS[$pass_id]); $attach_inspect++) {
$COMCODE_ATTACHMENTS[$pass_id][$attach_inspect]['marker'] += $pos + $p_len;
}
$pos = $p_end + 6;
} elseif ($comcode[$pos] == '!') {
$p_len = $pos;
$balance = 1;
while ($p_len < $len && $balance != 0) {
if ($comcode[$p_len] == '{') {
$balance++;
} elseif ($comcode[$p_len] == '}') {
$balance--;
}
$p_len++;
}
$ret = new ocp_tempcode();
$less_pos = $pos - 1;
$ret->parse_from($comcode, $less_pos, $p_len);
$pos = $p_len;
if ($ret->parameterless(0) && $pos < $len) {
$matches = array();
if (preg_match('#\\{\\!([\\w\\d\\_\\:]+)(\\}|$)#U', substr($comcode, $less_pos, $p_len - $less_pos), $matches) != 0) {
$temp_lang_string = $matches[1];
$ret = comcode_lang_string($temp_lang_string);
// Recreate as a Comcode lang string
}
}
} else {
$p_len = $pos;
$balance = 1;
while ($p_len < $len && $balance != 0) {
if ($comcode[$p_len] == '{') {
$balance++;
} elseif ($comcode[$p_len] == '}') {
$balance--;
}
$p_len++;
}
$ret = new ocp_tempcode();
$less_pos = $pos - 1;
$ret->parse_from($comcode, $less_pos, $p_len);
$pos = $p_len;
}
$differented = true;
if ($pos <= $len || !$lax) {
$tag_output->attach($ret);
}
}
} else {
if ($comcode[$pos] == '$' && $pos < $len - 2 && $comcode[$pos + 1] == ',' && strpos($comcode, '}', $pos) !== false) {