phpQueryObject::markupOuter PHP Method

markupOuter() public method

jQuey difference.
public markupOuter ( $callback1 = null, $callback2 = null, $callback3 = null ) : unknown_type
return unknown_type
    public function markupOuter($callback1 = null, $callback2 = null, $callback3 = null)
    {
        $args = func_get_args();
        if ($this->documentWrapper->isXML) {
            return call_user_func_array(array($this, 'xmlOuter'), $args);
        } else {
            return call_user_func_array(array($this, 'htmlOuter'), $args);
        }
    }

Usage Example

Esempio n. 1
0
/**
 * Utilize RegEx to find the values of attributes given a specific element.
 * Bug libxml2 2.6.28 and previous with regards to selecting attributes with colons in their name
 *
 * @param phpQueryObject $element Element to preform the search on
 * @param string $element_name Name of the element to search for
 * @param string $attribute_name Name of the attribute to search for
 * @return string Value of the attribute for a given element, empty string otherwise
 *
 */
function anno_get_attribute_value_regex($element, $element_name, $attribute_name)
{
    $outer_html = $element->markupOuter();
    // We only want to match everything in the media tag. Non greedy RegEx.
    if (preg_match('/<' . $element_name . ' .*?>/', $outer_html, $element_match)) {
        // $media_match[0] should now just contain the opening media tag and its attribute
        // Match on attribute name where wrapping quotes can be any combination of ', ", or lack there of
        if (preg_match('/ ' . $attribute_name . '=["\']?((?:.(?!["\']?\\s+(?:\\S+)=|[>"\']))+.)["\']?/', $element_match[0], $attribute_match)) {
            // $matches[1] should match data contained in parenthesis above
            if (isset($attribute_match[1])) {
                return $attribute_match[1];
            }
        }
    }
    return '';
}