# friends/4.3.1/templates/admin/opml.php

Friends, version 4.3.1. 35 lines.

- Page: https://pluginprobe.com/plugins/friends/4.3.1/code/templates/admin/opml.php
- Raw: https://pluginprobe.com/plugins/friends/4.3.1/raw/templates/admin/opml.php
- Modified: 2024-10-16T15:42:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/friends/4.3.1/code/templates/admin/opml.php#L10-L20`.

```php
<?php
/**
 * This template generates the OPML to read your friend posts in a feed reader.
 *
 * @version 1.0
 * @package Friends
 */

header( 'Content-Disposition: attachment; filename=' . $args['filename'] );
header( 'Content-Type: text/opml+xml' );

echo '<' . '?xml version="1.0" encoding="utf-8"?' . '>';

?>
<opml version="2.0">
	<head>
		<title><?php echo esc_html( $args['title'] ); ?></title>
		<dateCreated><?php echo esc_html( gmdate( 'r' ) ); ?></dateCreated>
		<ownerName><?php echo esc_html( wp_get_current_user()->display_name ); ?></ownerName>
	</head>
	<body>
<?php
foreach ( $args['feeds'] as $_role => $users ) {
	?>
	<outline text="<?php echo esc_attr( $_role ); ?>">
<?php foreach ( $users as $user ) : /* phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect */ ?>
<?php foreach ( $user['feeds'] as $feed ) : /* phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect */ ?>
		<outline text="<?php echo esc_attr( $user['friend_user']->display_name ); ?>" htmlUrl="<?php echo esc_url( $feed['html_url'] ); ?>" title="<?php echo esc_attr( $feed['title'] ); ?>" type="<?php echo esc_attr( $feed['type'] ); ?>" xmlUrl="<?php echo esc_url( $feed['xml_url'] ); ?>"/>
<?php endforeach; ?>
<?php endforeach; ?>
	</outline>
<?php } ?>
	</body>
</opml>

```
