WSP-33 on/off display the copyright information

This commit is contained in:
Filip Penkava
2017-01-20 10:50:54 +01:00
parent 8a19a64615
commit 01b59b4328
2 changed files with 33 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ function mvp_admin() {
'status' => $_POST['status'],
'author' => $_POST['author'],
'author-byline' => $_POST['author-byline'],
'display-copyright' => $_POST['display-copyright'],
'category' => $_POST['category'],
);
update_option('mvp_settings', $settings);
@@ -45,6 +46,7 @@ function mvp_admin() {
'status' => 'publish',
'author' => '',
'author-byline' => '',
'display-copyright' => '',
'category' => '',
);
}
@@ -140,7 +142,7 @@ function mvp_admin() {
<label for="author">Author</label>
</th>
<td>
<select name="author" id="author" <?php echo ($settings['author-byline']) ? 'disabled="true"' : ""; ?>>
<select name="author" id="author">
<?php
foreach ($authors as $key => $value) {
?>
@@ -155,10 +157,34 @@ function mvp_admin() {
</select>
<br /><br />
<label>
<input type="checkbox" name="author-byline" <?php echo ($settings['author-byline']) ? "checked" : ""; ?> onclick="setAuthor()"> Show byline in posts
<input type="checkbox" name="author-byline" <?php echo ($settings['author-byline']) ? "checked" : ""; ?>> Show byline in posts
</label>
</td>
</tr>
<tr>
<th scope="row">
Display the copyright information
</th>
<td>
<fieldset>
<label for="status-off">
<input type="radio" name="display-copyright" id="status-off" value="off"<?php
if ($settings['display-copyright'] == 'off') {
echo(' checked');
}
?>> off
</label>
<br>
<label for="status-on">
<input type="radio" name="display-copyright" id="status-on" value="on"<?php
if ($settings['display-copyright'] == 'on') {
echo(' checked');
}
?>> on
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<label for="category">Category</label>
@@ -186,10 +212,5 @@ function mvp_admin() {
</p>
</form>
</div>
<script type="text/javascript">
function setAuthor() {
console.log('zavolano');
}
</script>
<?php
}

View File

@@ -5,7 +5,7 @@ require_once '../../../wp-load.php';
$json = file_get_contents('php://input');
//$json = file_get_contents('log.txt');
//file_put_contents('log.txt', $json . "\n\n", FILE_APPEND);
file_put_contents('log.txt', $json . "\n\n", FILE_APPEND);
$obj = json_decode($json, true);
if ($obj['type'] == 'composite') {
@@ -15,6 +15,10 @@ if ($obj['type'] == 'composite') {
if ($obj['pubstatus'] == 'usable') {
$content = $obj['description_html'] . "<!--more-->" . $obj['body_html'];
if ($settings['display-copyright'] == "on") {
$content.= ""; // $obj['copyrightnotice']
}
$guid = wp_strip_all_tags($obj['guid']);
$sync = $wpdb->get_row("SELECT post_id FROM " . $wpdb->prefix . DB_TABLE_SYNC_POST . " WHERE guid = '" . $guid . "'");