diff --git a/admin/admin.php b/admin/admin.php index 1f7d7e4..02b1e9e 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -31,6 +31,7 @@ function mvp_admin() { 'status' => $_POST['status'], 'author' => $_POST['author'], 'author-byline' => $_POST['author-byline'], + 'byline-words' => $_POST['byline-words'], 'display-copyright' => $_POST['display-copyright'], 'convert-keywords' => $_POST['convert-keywords'], 'convert-services' => $_POST['convert-services'], @@ -49,6 +50,7 @@ function mvp_admin() { 'status' => 'publish', 'author' => '', 'author-byline' => '', + 'byline-words' => '', 'display-copyright' => '', 'convert-keywords' => '', 'convert-services' => '', @@ -167,6 +169,14 @@ function mvp_admin() { + + + + + + + + Display the copyright information diff --git a/autoload.php b/autoload.php index 40d14e1..162b531 100644 --- a/autoload.php +++ b/autoload.php @@ -6,9 +6,9 @@ $json = file_get_contents('php://input'); //$json = file_get_contents('log.txt'); file_put_contents('log.txt', $json . "\n\n", FILE_APPEND); -//die(); + $obj = json_decode($json, true); -/* var_dump($obj);die(); */ + if ($obj['type'] == 'text') { $settings = get_option('mvp_settings'); @@ -91,7 +91,13 @@ if ($obj['type'] == 'text') { } else { if ($settings['author-byline'] && $settings['author-byline'] == 'on') { - $author_name = str_replace("By ", "", $obj['byline']); + $author_name = $obj['byline']; + if (!empty(trim($settings['byline-words']))) { + $replaceWords = explode(',', $settings['byline-words']); + foreach ($replaceWords as $value) { + $author_name = str_replace(trim($value) . " ", "", $author_name); + } + } $authorExist = $wpdb->get_row("SELECT ID user_id FROM " . $wpdb->prefix . DB_TABLE_USERS . " WHERE display_name = '" . wp_strip_all_tags($author_name) . "'");