function motopressCEWrapOuterCode($content) { global $motopressCELibrary; $grid = $motopressCELibrary->getGridObjects(); $content = stripslashes($content); if (isset($grid['span']['type']) && $grid['span']['type'] === 'multiple') { $fullSpanShortcodeName = end($grid['span']['shortcode']); reset($grid['span']['shortcode']); $fullSpanShortcode = '[' . $fullSpanShortcodeName . ']'; $fullSpanCloseShortcode = '[/' . $fullSpanShortcodeName . ']'; } else { $fullSpanShortcode = '[' . $grid['span']['shortcode'] . ' ' . $grid['span']['attr'] . '="' . $grid['row']['col'] . '"]'; $fullSpanCloseShortcode = '[/' . $grid['span']['shortcode'] . ']'; } if (!preg_match('/.*?\\[' . $grid['row']['shortcode'] . '\\s?.*\\].*\\[\\/' . $grid['row']['shortcode'] . '\\].*/s', $content)) { $content = '[' . $grid['row']['shortcode'] . ']' . $fullSpanShortcode . $content . $fullSpanCloseShortcode . '[/' . $grid['row']['shortcode'] . ']'; } preg_match('/(\\A.*?)((?:<p>)?\\[' . $grid['row']['shortcode'] . '\\s?.*\\].*\\[\\/' . $grid['row']['shortcode'] . '\\](?:<\\/p>)?)(.*\\Z)/s', $content, $matches); $result = ''; $beforeContent = !empty($matches[1]) ? '[' . $grid['row']['shortcode'] . ']' . $fullSpanShortcode . $matches[1] . $fullSpanCloseShortcode . '[/' . $grid['row']['shortcode'] . ']' : ''; $result .= motopressCEMoreHandlerBubbling($beforeContent); $result .= $matches[2]; $afterContent = !empty($matches[3]) ? '[' . $grid['row']['shortcode'] . ']' . $fullSpanShortcode . $matches[3] . $fullSpanCloseShortcode . '[/' . $grid['row']['shortcode'] . ']' : ''; $result .= motopressCEMoreHandlerBubbling($afterContent); return $result; }
function motopressCEWrapOuterCode($content) { $content = stripslashes($content); if (!preg_match('/.*?\\[mp_row\\s?.*\\].*\\[\\/mp_row\\].*/s', $content)) { $content = '[mp_row][mp_span col="12"]' . $content . '[/mp_span][/mp_row]'; } preg_match('/(\\A.*?)(\\[mp_row\\s?.*\\].*\\[\\/mp_row\\])(.*\\Z)/s', $content, $matches); $result = ''; $beforeContent = !empty($matches[1]) ? '[mp_row][mp_span col="12"]' . $matches[1] . '[/mp_span][/mp_row]' : ''; $result .= motopressCEMoreHandlerBubbling($beforeContent); $result .= $matches[2]; $afterContent = !empty($matches[3]) ? '[mp_row][mp_span col="12"]' . $matches[3] . '[/mp_span][/mp_row]' : ''; $result .= motopressCEMoreHandlerBubbling($afterContent); return $result; }