-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathplugin.php
113 lines (83 loc) · 2.74 KB
/
plugin.php
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/*
Plugin Name: WP Phraseanet
Description: Add possibility to insert content from a phraseanet database into the editor - compatible with gutenberg and classic editor
Version: 0.1.5
Author: Nicolas Derambure (Labomedia) and the Alchemy team
Author URI: https://github.com/alchemy-fr/Phraseanet-Wordpress-Plugin
Licence: GNU General Public License v3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Block Initializer.
*/
require_once plugin_dir_path( __FILE__ ) . 'src/init.php';
/**
* Necessary included Files
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/base.php' );
require( plugin_dir_path( __FILE__ ) . "vendor/autoload.php" );
/**
* Plugin activation
*/
function wppsn_activate() {
// Set default plugin options
wppsn_set_default_options();
}
register_activation_hook( __FILE__, 'wppsn_activate' );
/**
* Plugin Setup
*/
function wppsn_setup() {
// Only if in ADMIN area
if ( is_admin() ) {
// Translations
load_plugin_textdomain( 'wp-phraseanet', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
// Functions
require_once( WPPSN_PLUGIN_INCLUDES_PATH . 'functions-admin.php' );
} // Only in FRONTEND area
else {
// Functions
require_once( WPPSN_PLUGIN_INCLUDES_PATH . 'functions-frontend.php' );
}
}
add_action( 'plugins_loaded', 'wppsn_setup' );
/**
* Set default plugin options
*/
function wppsn_set_default_options() {
$default_options = array(
'client_base_url' => '',
'client_id' => '',
'client_secret' => '',
'client_token' => ''
);
add_option( 'wppsn_options', $default_options );
}
/**
* In plugin list, add links to settings and help pages
*
* @param array $links Original links array
* @param string $file Current plugin file loading
*
* @return array Array of links
*/
function wppsn_add_plugin_settings_link( $links, $file ) {
if ( $file == plugin_basename( plugin_basename( __FILE__ ) ) ) {
$links[] = '<a href="' . admin_url() . 'admin.php?page=wppsn_settings_page">' . __( 'Settings' ) . '</a>';
$links[] = '<a href="' . admin_url() . 'admin.php?page=wppsn_help_credits_page">' . __( 'Help' ) . '</a>';
}
return $links;
}
add_filter( 'plugin_action_links', 'wppsn_add_plugin_settings_link', 10, 2 );
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true ); // default Featured Image dimensions (cropped)
// additional image sizes
// delete the next line if you do not need additional image sizes
// add_image_size( 'category-thumb', 300, 9999 ); // 300 pixels wide (and unlimited height)
}