You appear to be a bot. Output may be restricted
Description
Parse the link from this ugly string
[link] => </wp40/wp-json/posts/?page=2>; rel="next",
- <http://qw/wp40/wp-json/posts/503>; rel="item"; title="sb in shortcode",
- <http://qw/wp40/wp-json/posts/497>; rel="item"; title="Premium plugins",
<http://qw/wp40/wp-json/posts/495>; rel="item"; title="cookies", <http://qw/wp40/wp-json/posts/493>; rel="item"; title="bbboing tested", <http://qw/wp40/wp-json/posts/480>; rel="item"; title="Use oik-css v0.6 for inline shortcodes", <http://qw/wp40/wp-json/posts/477>; rel="item"; title="Demonstrating the diy shortcode", <http://qw/wp40/wp-json/posts/463>; rel="item"; title="bw_plug oik-external-link-warning", <http://qw/wp40/wp-json/posts/454>; rel="item"; title="[bw_users]", <http://qw/wp40/wp-json/posts/450>; rel="item"; title="attachments", <http://qw/wp40/wp-json/posts/447>; rel="item"; title="bw_logo" } code copied and cobbled from client-cli/lib/locator.php
Usage
oik_clone_parse_links( $links );
Parameters
- $links
- ( mixed ) required –
Returns
void
Source
File name: oik-clone/admin/oik-clone-wp-api.php
Lines:
function oik_clone_parse_links( $links ) { if ( ! is_array( $links ) ) { $links = explode( ',', $links ); } $real_links = array(); foreach ( $links as $link ) { $parts = explode( ';', $link ); $link_vars = array(); foreach ( $parts as $part ) { $part = trim( $part, ' ' ); if ( ! strpos( $part, '=' ) ) { $link_vars['url'] = trim( $part, '<>' ); continue; } list( $key, $val ) = explode( '=', $part ); $real_val = trim( $val, '\'" ' ); $link_vars[ $key ] = $real_val; } $real_links[] = $link_vars; } $url = get_rel_link( $real_links ); return( $url ); }