Yoast\WP\SEO\Builders
Indexable_Link_Builder::gather_images()
Gathers all images from content.
Метод класса: Indexable_Link_Builder{}
Хуков нет.
Возвращает
Строку[]
. An array of urls.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->gather_images( $content );
- $content(строка) (обязательный)
- The content.
Код Indexable_Link_Builder::gather_images() Indexable Link Builder::gather images Yoast 19.14
protected function gather_images( $content ) { if ( \strpos( $content, 'src' ) === false ) { // Nothing to do. return []; } $images = []; $regexp = '<img\s[^>]*src=("??)([^" >]*?)\\1[^>]*>'; // Used modifiers iU to match case insensitive and make greedy quantifiers lazy. if ( \preg_match_all( "/$regexp/iU", $content, $matches, \PREG_SET_ORDER ) ) { foreach ( $matches as $match ) { $images[] = \trim( $match[2], "'" ); } } return $images; }