all repos — blogroll2email @ 5e900733658b0c87e430cbabe5e9455d3e8266c9

0.3.2
Peter Molnar hello@petermolnar.eu
Sat, 09 Jul 2016 20:28:18 +0000
commit

5e900733658b0c87e430cbabe5e9455d3e8266c9

parent

860a172661e87a97a6c06b53458e6ab41c70b517

A .gitignore

@@ -0,0 +1,1 @@

+composer.lock
M blogroll2email.phpblogroll2email.php

@@ -4,14 +4,17 @@ /*

Plugin Name: blogroll2email Plugin URI: https://github.com/petermolnar/blogroll2email Description: Pulls RSS, Atom and microformats entries from blogroll links and sends them as email -Version: 0.3.1 +Version: 0.3.2 Author: Peter Molnar <hello@petermolnar.eu> Author URI: http://petermolnar.eu/ License: GPLv3 -Required minimum PHP version: 5.3 */ // Copyright 2015 Peter Molnar ( hello@petermolnar.eu ) + +/* +javascript:void(linkmanpopup=window.open('$url/wp-admin/link-add.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus(); +*/ if ( !class_exists('Mf2\Parser') ) { require (__DIR__ . '/vendor/autoload.php');

@@ -44,6 +47,9 @@ // re-enable the links manager

add_filter( 'pre_option_link_manager_enabled', '__return_true' ); // add our own action for the scheduler to call it add_action( static::schedule, array( &$this, 'worker' ) ); + + + add_action( 'wp_mail_failed', array( &$this, 'wp_mail_failed' ) ); if (!is_dir($this->cachedir)) mkdir ($this->cachedir);

@@ -132,10 +138,10 @@ [link_rss] => http://devopsreactions.tumblr.com/rss

) */ - if ( $currowner != $bookmark->link_owner) { - $currowner = $bookmark->link_owner; - $owner = get_userdata($currowner); - $owner = $owner->data; + //if ( $currowner != $bookmark->link_owner) { + $currowner = $bookmark->link_owner; + $owner = get_userdata($currowner); + $owner = $owner->data; /* print_r ( $owner ); stdClass Object (

@@ -151,7 +157,7 @@ [user_status] => 0

[display_name] => Peter Molnar ) */ - } + //} $export_yaml[ $owner->user_nicename ][] = array ( 'name' => $bookmark->link_name,

@@ -237,16 +243,14 @@ * @param string $content

* * */ - protected function send ( $to, $link, $title, $fromname, $sourceurl, $content, $time, $dry = false ) { + protected function send ( $to, $link, $title, $from, $sourceurl, $content, $time ) { + $return = false; // enable HTML mail add_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type') ); // build a more readable body $body = '<html><head></head><h1><a href="'. $link .'">'. $title .'</a></h1><body>'. $content . '<p>URL: <a href="'.$link.'">'.$link.'</a></p></body></html>'; - // this is to set the sender mail from our own domain - $sitedomain = parse_url( get_bloginfo('url'), PHP_URL_HOST); - // additional header, for potential sieve backwards compatibility // with http://www.aaronsw.com/weblog/001148 $headers = array (

@@ -254,16 +258,12 @@ 'X-RSS-ID: ' . $link,

'X-RSS-URL: ' . $link, 'X-RSS-Feed: ' . $sourceurl, 'User-Agent: blogroll2email', - 'From: "' . $fromname .'" <'. static::schedule . '@'. $sitedomain .'>', + 'From: ' . $from, 'Date: ' . date( 'r', $time ), ); static::debug('sending ' . $title . ' to ' . $to, 5 ); - - // for debung & specific reasons, there is a dry run mode - if ( !$dry ) - $return = wp_mail( $to, $title, $body, $headers ); - + $return = wp_mail( $to, $title, $body, $headers ); // disable HTML mail remove_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type') );

@@ -305,6 +305,20 @@ }

/** * + * @param string $to + * @param string $link + * @param string $message + * + * + */ + public function wp_mail_failed ( $err ) { + static::debug( $err->get_error_message() ); + return $err; + } + + + /** + * * @param object $bookmark * @param object $owner */

@@ -377,12 +391,22 @@ // U stands for Unix Time

$date = $item->get_date( 'U' ); if ( $date > $last_updated ) { - $from = $feed_title; + $fromname = $feed_title; $author = $item->get_author(); if ($author) - $from = $from . ': ' . $author->get_name(); + $fromname = $fromname . ': ' . $author->get_name(); elseif ( $feed_author ) - $from = $from . ': ' . $feed_author->get_name(); + $fromname = $fromname . ': ' . $feed_author->get_name(); + + + // this is to set the sender mail from our own domain + $frommail = get_user_meta ( $owner->ID, 'blogroll2email_email', true ); + if ( ! $frommail ) { + $sitedomain = parse_url( get_bloginfo('url'), PHP_URL_HOST); + $frommail = static::schedule . '@'. $sitedomain; + } + + $from = $fromname . '<' . $frommail . '>'; $content = $item->get_content();

@@ -505,6 +529,15 @@ return false;

$last_updated_ = 0; + // this is to set the sender mail from our own domain + $frommail = get_user_meta ( $owner->ID, 'blogroll2email_email', true ); + if ( ! $frommail ) { + $sitedomain = parse_url( get_bloginfo('url'), PHP_URL_HOST); + $frommail = static::schedule . '@'. $sitedomain; + } + + $from = $bookmark->link_name . '<' . $frommail . '>'; + static::debug(" looping items", 6); foreach ( $items as $time => $item ) { if ( $time > $last_updated ) {

@@ -512,7 +545,7 @@ if ($this->send (

$owner->user_email, $item['url'], $item['title'], - $bookmark->link_name, + $from, $item['url'], $item['content'], $time
M readme.txtreadme.txt

@@ -2,9 +2,9 @@ === blogroll2email ===

Contributors: cadeyrn Donate link: https://paypal.me/petermolnar/3 Tags: blogroll, links, rss, email, reader -Requires at least: 3.0 -Tested up to: 4.4.2 -Stable tag: 0.3.1 +Requires at least: 4.2 +Tested up to: 4.5.3 +Stable tag: 0.3.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html Required minimum PHP version: 5.3

@@ -46,6 +46,12 @@

* every A. indicates BIG changes. * every .B version indicates new features. * every ..C indicates bugfixes for A.B version. + += 0.3.2 = +*2016-07-09* + +* bugfix: if sender didn't contain valid looking mail, mail was not sent + = 0.3.1 = *2016-03-08*
M vendor/composer/ClassLoader.phpvendor/composer/ClassLoader.php

@@ -147,7 +147,7 @@ * Registers a set of PSR-4 directories for a given namespace, either

* appending or prepending to the ones previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-0 base directories + * @param array|string $paths The PSR-4 base directories * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException
M vendor/composer/LICENSEvendor/composer/LICENSE

@@ -1,5 +1,5 @@

-Copyright (c) 2015 Nils Adermann, Jordi Boggiano +Copyright (c) 2016 Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal