From 10b66659c70af29382b9d3e59bf1e61c6bb77da5 Mon Sep 17 00:00:00 2001
From: Filip Penkava
Date: Wed, 19 Apr 2017 13:41:08 +0200
Subject: [PATCH] WSP-68
---
admin/admin.php | 941 ++++++++++++++++++++++++++++--------------------
autoload.php | 14 +-
2 files changed, 562 insertions(+), 393 deletions(-)
diff --git a/admin/admin.php b/admin/admin.php
index 38d186d..58a5e2f 100644
--- a/admin/admin.php
+++ b/admin/admin.php
@@ -24,7 +24,23 @@ function get_page_url() {
}
function superdesk_admin() {
+ $post_formats = get_post_format_strings();
+
if (isset($_POST['url'])) {
+ $resultArray = array();
+ if (isset($_POST['post-formats-value'], $_POST['post-formats-input'])) {
+ foreach ($_POST['post-formats-value'] as $key => $value) {
+ if (!isset($_POST['post-formats-input'][$key])) {
+ continue;
+ }
+ if (isset($post_formats[$value])) {
+ $inputValue = $_POST['post-formats-input'][$key];
+ if (!isset($resultArray[$inputValue]) && !empty($inputValue))
+ $resultArray[$inputValue] = $value;
+ }
+ }
+ }
+
$settings = array(
'url' => $_POST['url'],
'username' => $_POST['username'],
@@ -49,6 +65,8 @@ function superdesk_admin() {
'slugline-ignored' => $_POST['slugline-ignored'],
'priority_threshhold' => $_POST['priority_threshhold'],
'download-images' => $_POST['download-images'],
+ 'post-formats' => $_POST['download-images'],
+ 'post-formats-table' => $resultArray,
);
update_option('superdesk_settings', $settings);
} else if (get_option('superdesk_settings')) {
@@ -78,6 +96,8 @@ function superdesk_admin() {
'slugline-ignored' => '',
'priority_threshhold' => '',
'download-images' => '',
+ 'post-formats' => '',
+ 'post-formats-table' => array(),
);
}
$statuses = array(
@@ -102,400 +122,537 @@ function superdesk_admin() {
foreach ($all_users as $user) {
$authors[$user->ID] = $user->data->display_name;
}
+
+ function make_table_row($format, $text_value, $formats) {
+ $new_element = ' | | Delete |
';
+ return $new_element;
+ }
?>
-
Superdesk Publisher
-
+
Superdesk Publisher
+
+
+
+
Editors Note: " . wp_strip_all_tags($obj['ednote']) . "
";
+ $content .= "Editors Note: " . wp_strip_all_tags($obj['ednote']) . "
";
}
if (isset($obj['evolvedfrom'])) {
@@ -139,6 +139,12 @@ if ($obj['type'] == 'text') {
'post_category' => $category
);
+ if (isset($settings['post-formats'], $settings['post-formats-table']) and ! empty($obj['profile']) and $settings['post-formats'] == 'on') {
+ if (isset($settings['post-formats-table'][$obj['profile']])) {
+ set_post_format($post_ID, $settings['post-formats-table'][$obj['profile']]);
+ }
+ }
+
wp_update_post($edit_post);
$attachmentExist = get_post_thumbnail_id($post_ID);
@@ -177,6 +183,12 @@ if ($obj['type'] == 'text') {
$post_ID = wp_insert_post($postarr, true);
+ if (isset($settings['post-formats'], $settings['post-formats-table']) and ! empty($obj['profile']) and $settings['post-formats'] == 'on') {
+ if (isset($settings['post-formats-table'][$obj['profile']])) {
+ set_post_format($post_ID, $settings['post-formats-table'][$obj['profile']]);
+ }
+ }
+
if ($taxonomyTag && !empty($taxonomyTag)) {
wp_set_post_tags($post_ID, $taxonomyTag);
}