forked from nickyreinert/wordCloud-for-Wordpress
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
57 lines (43 loc) · 1.36 KB
/
index.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
<?php
/**
* @link https://www.nickyreinert.de
* @since 1.0.0
* @package wp-word-cloud
*
* @wordpress-plugin
* Plugin Name: WP Word-Cloud
* Plugin URI: https://www.nickyreinert.de/word-cloud
* Description: Draw word clouds based on text from several sources
* Version: 2.0.0
* Author: Nicky Reinert
* Author URI: https://www.nickyreinert.de
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: wp-word-cloud
* Domain Path: /languages
*/
// if this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Adding the shortcode
* @since 1.0.0
*/
require_once('php/renderShortcode.php');
require_once('php/initSettings.php');
add_shortcode('wp-word-cloud',[new WPWordCloud, 'initWordCloud']);
/**
* log function to send debug information to browser console
*
*/
function debug_wp_word_cloud($message = NULL, $priority = 1 ){
// on settings page, debug level will be defined
// MAX_DEBUG_PRIORITY = 0 - no messages at all
// MAX_DEBUG_PRIORITY = 1 - errors & warnings only
// MAX_DEBUG_PRIORITY = 2 - every piece of information
if ($priority >= 1) {
$message = json_encode($message, JSON_PRETTY_PRINT);
echo "<script>console.log('WORDCLOUD|DEBUG: ' + ".$message.");</script>";
}
}