From d5438c37e1e66b9b7a00fc7695066bec651f07a4 Mon Sep 17 00:00:00 2001
From: lucha <lucha@paranoici.org>
Date: Sun, 31 May 2020 19:32:31 -0700
Subject: [PATCH] added ai mu-plugins

---
 wp-content/mu-plugins/embed.php               | 121 ++++++++++++++++++
 .../remove-password-change-notification.php   |  10 ++
 wp-content/mu-plugins/send-smtp-email.php     |  36 ++++++
 3 files changed, 167 insertions(+)
 create mode 100644 wp-content/mu-plugins/embed.php
 create mode 100644 wp-content/mu-plugins/remove-password-change-notification.php
 create mode 100644 wp-content/mu-plugins/send-smtp-email.php

diff --git a/wp-content/mu-plugins/embed.php b/wp-content/mu-plugins/embed.php
new file mode 100644
index 0000000..70d9564
--- /dev/null
+++ b/wp-content/mu-plugins/embed.php
@@ -0,0 +1,121 @@
+<?php
+/*
+* Plugin Name: Ai - Add oembed provider and embed short
+* Plugin URI:
+* Description: AI -Add Embed
+* Version: 1.3
+* Author: lechuck, lucha
+* Author URI: http://noblogs.org
+**/
+
+function wp_embed_handler_google_maps( $matches, $attr, $url, $rawattr ) {
+  $width = ($rawattr['width']) ? $rawattr['width'] : 425 ;
+  $height = ($rawattr['height']) ? $rawattr['height'] : 350 ;
+  $query = add_query_arg(array('output' => 'embed'), $matches[0]);
+  $embed = '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.esc_attr($query).'"></iframe>';
+
+  return apply_filters( 'embed_googlemaps', $embed, $matches, $attr, $url, $rawattr );
+}
+
+function wp_embed_handler_openstreetmap( $matches, $attr, $url, $rawattr ) {
+  $width = ($rawattr['width']) ? $rawattr['width'] : 425 ;
+  $height = ($rawattr['height']) ? $rawattr['height'] : 350 ;
+  $embed = '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.esc_attr($matches[0]).'"></iframe>';
+
+  return apply_filters( 'embed_openstreetmap', $embed, $matches, $attr, $url, $rawattr );
+}
+
+/* Returns the Archive.org iframe
+   Used both by the embed handler and by the special shortcode handler */
+function _archive_iframe_build( $id, $height = 480, $width = 640){
+    return sprintf('<iframe src="https://archive.org/embed/%1$s" width="%3$d" height="%2$d" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen></iframe>
+', esc_attr($id), esc_attr($height), esc_attr($width));
+
+}
+
+/* This tries to support the shorcode format that is given out by Archive.org.
+   Don't change it if you don't check what they are using right now.
+   We will ignore some options.
+   Example:
+   [archiveorg peril_of_doc_ock width=640 height=480 frameborder=0
+   ebkitallowfullscreen=true mozallowfullscreen=true]
+*/
+function shortcode_archiveorg($atts){
+    $atts = shortcode_atts(array(
+        0 => '',
+        "height" => 480,
+        "width" => 640
+    ), $atts);
+    return _archive_iframe_build($atts[0], $atts['height'], $atts['width']);
+
+}
+
+function wp_embed_handler_archive( $matches, $attr, $url, $rawattr ) {
+    /* while setting width and height from $attr seems a sensible thing to do,
+       wordpress gives completely wrong sizes. So we won't do it!
+    */
+    $embed = _archive_iframe_build(esc_attr($matches['id']));
+    return apply_filters( 'embed_archive', $embed, $matches, $attr, $url, $rawattr );
+}
+
+function wp_embed_handler_dctptv( $matches, $attr, $url, $rawattr ) {
+$width = ($attr['width']) ? $attr['width'] : 480 ;
+$height = ($attr['height']) ? $attr['height'] : 396 ;
+$embed= sprintf(
+        '<iframe width="%3$s" scrolling="no" height="%2$s" frameborder="0" src="%1$s" name="dctp-teaser" marginwidth="0" marginheight="0"><br>
+</iframe>',esc_attr($matches[0]),esc_attr($height),esc_attr($width));
+
+return apply_filters( 'embed_dctptv', $embed, $matches, $attr, $url, $rawattr );
+}
+
+
+function register_embed_handlers() {
+    add_shortcode('archiveorg', 'shortcode_archiveorg');
+    wp_embed_register_handler( 'archive', '#http[s]?://(?:www\.)?archive\.org/.*/(?<id>.*)#i', 'wp_embed_handler_archive' );
+
+    wp_embed_register_handler( 'dctptv', '#http(s)?://www.dctp.tv/embed/.*?/#i', 'wp_embed_handler_dctptv' );
+
+    wp_embed_register_handler( 'googlemaps', '#http(s)?://maps\.google\.[^\.]+/(.*)#i', 'wp_embed_handler_google_maps');
+    wp_embed_register_handler( 'openstreetmap', '#http(s)?://www\.openstreetmap\.org/export/embed.html\?(.*)#i', 'wp_embed_handler_openstreetmap');
+}
+add_action('wp', 'register_embed_handlers');
+
+/* Noembed -- list selected from https://noembed.com/providers */
+$noembed = 'https://noembed.com/embed';
+$noembed_site = array(
+    "https?://soundcloud.com/.*/.*",
+    "https?://www\\.urbandictionary\\.com/define\\.php\\?term=.+",
+    "https?://(?:www\\.)?vimeo\\.com/.+",
+    "https?://(?:www\\.)?xkcd\\.com/\\d+/?",
+    "https?://.*\\.deviantart\\.com/art/.*",
+    "https?://.*\\.deviantart\\.com/.*#/d.*",
+    "https?://.*\\.flickr\\.com/photos/.*",
+    "https?://flic\\.kr/p/.*",
+    "https?://instagram\\.com/p/.*",
+    "https?://instagr\\.am/p/.*",
+    "https?://instagram\\.com/p/.*",
+    "https?://instagr\\.am/p/.*",
+    "https?://www\\.slideshare\\.net/.*/.*",
+    "https?://fr\\.slideshare\\.net/.*/.*",
+    "https?://de\\.slideshare\\.net/.*/.*",
+    "https?://es\\.slideshare\\.net/.*/.*",
+    "https?://pt\\.slideshare\\.net/.*/.*",
+    "https?://imgur\\.com/(?:[^\\/]+/)?[0-9a-zA-Z]+$",
+    "https?://bash\\.org/\\?(\\d+)"
+);
+
+foreach ($noembed_site as $site){
+    /* we need to add the php regex delimitators */
+    wp_oembed_add_provider('#' . $site . '#i', $noembed, true);
+}
+
+/* Ted Talks */
+wp_oembed_add_provider('http://www.ted.com/talks/*', 'http://www.ted.com/talks/oembed.json', false);
+/* arkiwi */
+wp_oembed_add_provider('http://www.arkiwi.org/*','http://www.arkiwi.org/oembed/', false );
+/* bambuser */
+wp_oembed_add_provider('http://*.bambuser.com/*','http://api.bambuser.com/oembed', false);
+/* mixcloud */
+wp_oembed_add_provider('#https?://(www\.)?mixcloud\.com/.*#i', 'http://mixcloud.com/oembed', true);
+
+?>
diff --git a/wp-content/mu-plugins/remove-password-change-notification.php b/wp-content/mu-plugins/remove-password-change-notification.php
new file mode 100644
index 0000000..b71d683
--- /dev/null
+++ b/wp-content/mu-plugins/remove-password-change-notification.php
@@ -0,0 +1,10 @@
+<?php
+/*
+  Plugin Name: A/I - Remove password change notification
+  Description: Disables email notification of password changes
+  Version: 0.1
+  Author: Autistici/Inventati
+  Author URI: https://autistici.org
+*/
+	 function wp_password_change_notification() {}
+?>
diff --git a/wp-content/mu-plugins/send-smtp-email.php b/wp-content/mu-plugins/send-smtp-email.php
new file mode 100644
index 0000000..31353ea
--- /dev/null
+++ b/wp-content/mu-plugins/send-smtp-email.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Plugin Name: A/I Send SMTP email
+ * Plugin URI: https://noblogs.org
+ * Description: Sends mail via SMTP instead than PHP mail function
+ * Author: Autistici/Inventati
+ * Author URI: https://autistici.org
+ * Version: 1.0
+ */
+ 
+// Put your code snippets below this line.
+
+/**
+ * This function will connect wp_mail to a (possibly authenticated)
+ * external SMTP server, instead of using the PHP mail() function.
+ * 
+ * Values are constants set in wp-config.php
+ */
+if (defined('SMTP_HOST')) {
+	add_action('phpmailer_init', 'send_smtp_email');
+	function send_smtp_email($phpmailer) {
+		$phpmailer->isSMTP();
+		$phpmailer->Host       = SMTP_HOST;
+		$phpmailer->SMTPAuth   = SMTP_AUTH;
+		$phpmailer->Port       = SMTP_PORT;
+		$phpmailer->Username   = SMTP_USER;
+		$phpmailer->Password   = SMTP_PASS;
+		$phpmailer->SMTPSecure = SMTP_SECURE;
+		$phpmailer->From       = SMTP_FROM;
+		$phpmailer->FromName   = SMTP_NAME;
+		// Do not attempt STARTTLS even if the
+		// server offers it - use SMTPSecure instead.
+		$phpmailer->SMTPAutoTLS = false;
+	}
+}
+
-- 
GitLab