Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai-mu-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noblogs
ai-mu-plugins
Commits
40319ced
Commit
40319ced
authored
4 years ago
by
lucha
Browse files
Options
Downloads
Patches
Plain Diff
added the mu-plugins
parent
b13a3e77
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+13
-0
13 additions, 0 deletions
README.md
embed.php
+121
-0
121 additions, 0 deletions
embed.php
remove-password-change-notification.php
+10
-0
10 additions, 0 deletions
remove-password-change-notification.php
send-smtp-email.php
+36
-0
36 additions, 0 deletions
send-smtp-email.php
with
180 additions
and
0 deletions
README.md
+
13
−
0
View file @
40319ced
Different must-use plugins for Wordpress we use on noblogs.org
*
```embed.php```
: registers various oembed providers handles
-
google maps
-
openstreetmaps
-
archive.org
-
dctp.tv
-
various sites supported by noembed.com
-
ted.com
-
arkiwi.org
-
bambuser.com
-
mixcloud.com
*
```send-smtp-email.php```
: sends mail via SMTP server instead than using PHP
```mail()```
*
```remove-password-change-notification.php```
: do not send emails to Admins when users change passwords
Ideally, these should each be individually packaged and put in an indepedent repo. In practice we won’t bother for the time being.
This diff is collapsed.
Click to expand it.
embed.php
0 → 100644
+
121
−
0
View file @
40319ced
<?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
);
?>
This diff is collapsed.
Click to expand it.
remove-password-change-notification.php
0 → 100644
+
10
−
0
View file @
40319ced
<?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
()
{}
?>
This diff is collapsed.
Click to expand it.
send-smtp-email.php
0 → 100644
+
36
−
0
View file @
40319ced
<?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
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment