This repository was archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
98 lines (88 loc) · 2.42 KB
/
index.php
File metadata and controls
98 lines (88 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/*
Plugin Name: Fans of LeFox Functions
Plugin URI: https://jorjafox.net/
Description: Instead of putting it all in my functions.php, I've made a plugin.
Version: 2.0
Author: Mika Epstein
*/
class FLF_MU_Plugins {
/**
* Constructor
*/
public function __construct() {
if ( ! isset( $content_width ) ) {
$content_width = 600;
}
add_filter( 'http_request_args', array( $this, 'disable_wp_update' ), 10, 2 );
add_filter( 'upload_mimes', array( $this, 'upload_mimes' ) );
add_action( 'pre_ping', array( $this, 'no_self_ping' ) );
add_filter( 'comments_open', array( $this, 'no_comments_open' ), 10, 2 );
add_filter( 'ast_block_templates_disable', '__return_true' );
}
/**
* Disable WP from updating this plugin..
*
* @access public
* @param mixed $return - array to return.
* @param mixed $url - URL from which checks come and need to be blocked (i.e. wp.org)
* @return array - $return
*/
public function disable_wp_update( $return, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = json_decode( $return['body']['plugins'], true );
unset( $plugins['plugins'][ $my_plugin ] );
unset( $plugins['active'][ array_search( $my_plugin, $plugins['active'], true ) ] );
$return['body']['plugins'] = wp_json_encode( $plugins );
}
return $return;
}
/**
* upload_mimes function.
*
* @access public
* @param mixed $existing_mimes
* @return void
*/
public function upload_mimes( $existing_mimes ) {
$existing_mimes['epub'] = 'application/epub+zip'; //allow epub files
$existing_mimes['webm'] = 'video/webm'; //allow webm file
return $existing_mimes;
}
/**
* no_self_ping function.
*
* @access public
* @param mixed &$links
* @return void
*/
public function no_self_ping( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link ) {
if ( 0 === strpos( $link, $home ) ) {
unset( $links[ $l ] );
}
}
}
/**
* no_comments_open function.
*
* @access public
* @param mixed $open
* @param mixed $post_id
* @return void
*/
public function no_comments_open( $open, $post_id ) {
$post = get_post( $post_id );
if ( 'attachment' === $post->post_type ) {
return false;
}
return $open;
}
}
new FLF_MU_Plugins();
// Require the add-ons
require_once 'blocks/_main.php';
require_once 'cpts/videos.php';
require_once 'features/_main.php';