-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb_enhance.php
66 lines (41 loc) · 1.86 KB
/
tb_enhance.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
<?php
/*
Plugin Name: TB Enhance
Plugin URI: http://www.akm3.de/
Description: This plugin evaluates a hook in the Textbroker Wordpress plugin to automatically highlight the SEO-keywords as bold and push them to All-in-One SEO post_meta entry
Version: 0.1
Author: AKM3
Author URI: http://www.akm3.de/
This plugin evaluates a hook in the Textbroker Wordpress plugin to automatically highlight the SEO-keywords as bold and push them to All-in-One SEO post_meta entry
*/
add_filter("textbroker_publish_post", 'textbroker_publish_post_func',10,3);
function textbroker_publish_post_func($postTitle, $postContent, $postType) {
$postContent = preg_replace('#</span>#Uui','</strong>' , $postContent);
$postContent = preg_replace('#<span[^>]*>#Uui','<strong>' , $postContent);
$postStatus = 'draft';
return array(
$postTitle,
$postContent,
$postStatus,
$postType
);
}
add_filter("textbroker_add_keywords", 'textbroker_add_keywords_func',10,3);
function textbroker_add_keywords_func($postID, $postContent) {
global $wpdb;
preg_match_all('#<strong>(.*)</strong>#Uui', $postContent, $keywords);
$metakey = "_aioseop_keywords";
$metavalue = implode(',', array_unique($keywords[1]));
$wpdb->query(
$wpdb->prepare(
'
INSERT INTO '. $wpdb->postmeta .'
( post_id, meta_key, meta_value )
VALUES ( %d, %s, %s )
',
$postID,
$metakey,
$metavalue
)
);
}