本文整理汇总了PHP中FrmFieldsHelper::allowed_shortcodes方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFieldsHelper::allowed_shortcodes方法的具体用法?PHP FrmFieldsHelper::allowed_shortcodes怎么用?PHP FrmFieldsHelper::allowed_shortcodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFieldsHelper
的用法示例。
在下文中一共展示了FrmFieldsHelper::allowed_shortcodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_shortcodes
public static function get_shortcodes($content, $form_id)
{
if (empty($form_id) || strpos($content, '[') === false) {
// don't continue if there are no shortcodes to check
return array(array());
}
$tagregexp = array('deletelink', 'detaillink', 'evenodd', 'get', 'entry_count', 'event_date');
$form_id = (int) $form_id;
$form_ids = array($form_id);
//get linked form ids
$fields = FrmProFormsHelper::has_repeat_field($form_id, false);
foreach ($fields as $field) {
if (FrmField::is_option_true($field, 'form_select')) {
$form_ids[] = $field->field_options['form_select'];
$tagregexp[] = $field->id;
$tagregexp[] = $field->field_key;
}
unset($field);
}
foreach ($form_ids as $form_id) {
$fields = FrmField::get_all_for_form($form_id, '', 'include');
foreach ($fields as $field) {
$tagregexp[] = $field->id;
$tagregexp[] = $field->field_key;
}
}
$tagregexp = implode('|', $tagregexp) . '|';
$tagregexp .= FrmFieldsHelper::allowed_shortcodes();
if (!ini_get('safe_mode')) {
// make sure the backtrack limit is as least at the default
$backtrack_limit = ini_get('pcre.backtrack_limit');
if ($backtrack_limit < 1000000) {
ini_set('pcre.backtrack_limit', 1000000);
}
}
preg_match_all("/\\[(if |foreach )?({$tagregexp})\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\])?/s", $content, $matches, PREG_PATTERN_ORDER);
// run conditional and foreach first
$new_order = $matches[0];
$move_up = array();
foreach ($new_order as $short_key => $tag) {
$conditional = preg_match('/^\\[if/s', $matches[0][$short_key]) ? true : false;
$foreach = preg_match('/^\\[foreach/s', $matches[0][$short_key]) ? true : false;
if ($conditional || $foreach) {
$move_up[$short_key] = $tag;
}
}
if (!empty($move_up)) {
$matches[0] = $move_up + $matches[0];
}
return $matches;
}