7
7
* Author URI: https://airat.biz
8
8
* Version: 1.0.0
9
9
* Text Domain: ad-generator
10
- * Domain Path: languages
11
10
*/
12
11
13
12
// Exit if accessed directly
@@ -23,18 +22,11 @@ class ad_generator_shortcode {
23
22
static function init () {
24
23
add_shortcode ('ad_generator ' , array (__CLASS__ , 'ad_generator_func ' ));
25
24
//add_action('init', array(__CLASS__, 'register_script'));
26
- add_action ('wp_footer ' , array (__CLASS__ , 'print_script ' ));
25
+ // add_action('wp_footer', array(__CLASS__, 'print_script'));
27
26
}
28
27
29
28
static function ad_generator_func ( $ atts ) {
30
29
self ::$ add_script = true ;
31
- return "foo and bar " ;
32
- }
33
-
34
- //static function register_script() { }
35
-
36
- static function print_script () {
37
- if ( !self ::$ add_script ) return ;
38
30
39
31
echo '<form method="post" action=""> ' ;
40
32
$ ad_text = isset ($ _POST ['ad_text ' ]) ? (string ) $ _POST ['ad_text ' ] : '' ;
@@ -45,7 +37,7 @@ static function print_script () {
45
37
echo '<textarea name="ad_text" cols="100" rows="14">{Рандомизатор|Рандомайзер} {|текста}</textarea> ' ;
46
38
}
47
39
48
- echo '<br /><input type="submit" value="Генерировать" /></form> '
40
+ echo '<br /><input type="submit" value="Генерировать" /></form> ' ;
49
41
50
42
if ($ ad_text ) {
51
43
require_once plugin_dir_path ( __FILE__ ).'/includes/Natty/TextRandomizer.php ' ;
@@ -57,9 +49,11 @@ static function print_script () {
57
49
echo htmlspecialchars ($ tRand ->getText ()) . '<hr /> ' ;
58
50
}
59
51
}
52
+
53
+ return ;
60
54
}
55
+
61
56
}
62
57
63
-
64
58
ad_generator_shortcode::init ();
65
59
0 commit comments