WSP-68
This commit is contained in:
941
admin/admin.php
941
admin/admin.php
@@ -24,7 +24,23 @@ function get_page_url() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function superdesk_admin() {
|
function superdesk_admin() {
|
||||||
|
$post_formats = get_post_format_strings();
|
||||||
|
|
||||||
if (isset($_POST['url'])) {
|
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(
|
$settings = array(
|
||||||
'url' => $_POST['url'],
|
'url' => $_POST['url'],
|
||||||
'username' => $_POST['username'],
|
'username' => $_POST['username'],
|
||||||
@@ -49,6 +65,8 @@ function superdesk_admin() {
|
|||||||
'slugline-ignored' => $_POST['slugline-ignored'],
|
'slugline-ignored' => $_POST['slugline-ignored'],
|
||||||
'priority_threshhold' => $_POST['priority_threshhold'],
|
'priority_threshhold' => $_POST['priority_threshhold'],
|
||||||
'download-images' => $_POST['download-images'],
|
'download-images' => $_POST['download-images'],
|
||||||
|
'post-formats' => $_POST['download-images'],
|
||||||
|
'post-formats-table' => $resultArray,
|
||||||
);
|
);
|
||||||
update_option('superdesk_settings', $settings);
|
update_option('superdesk_settings', $settings);
|
||||||
} else if (get_option('superdesk_settings')) {
|
} else if (get_option('superdesk_settings')) {
|
||||||
@@ -78,6 +96,8 @@ function superdesk_admin() {
|
|||||||
'slugline-ignored' => '',
|
'slugline-ignored' => '',
|
||||||
'priority_threshhold' => '',
|
'priority_threshhold' => '',
|
||||||
'download-images' => '',
|
'download-images' => '',
|
||||||
|
'post-formats' => '',
|
||||||
|
'post-formats-table' => array(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$statuses = array(
|
$statuses = array(
|
||||||
@@ -102,400 +122,537 @@ function superdesk_admin() {
|
|||||||
foreach ($all_users as $user) {
|
foreach ($all_users as $user) {
|
||||||
$authors[$user->ID] = $user->data->display_name;
|
$authors[$user->ID] = $user->data->display_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function make_table_row($format, $text_value, $formats) {
|
||||||
|
$new_element = '<tr><td><input type="text" name="post-formats-input[]" onkeyup="debounce(validateInput, 250);" class="regular-text" value="' . esc_html($text_value) . '" /></td><td><select name="post-formats-value[]">';
|
||||||
|
foreach ($formats as $key => $value) {
|
||||||
|
$new_element .= '<option ' . ($key === $format ? 'selected="selected" ' : '') . 'value="' . esc_html($key) . '">' . esc_html($value) . '</option>';
|
||||||
|
}
|
||||||
|
$new_element .= '</select></td><td><a href="#" onclick="removeThisRow(this); return false;">Delete</a></td></tr>';
|
||||||
|
return $new_element;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2>Superdesk Publisher</h2>
|
<h2>Superdesk Publisher</h2>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Autoload</th>
|
<th>Autoload</th>
|
||||||
<td><?php echo get_site_url(); ?>/wp-content/plugins/superdesk-wordpress-plugin/autoload.php</td>
|
<td><?php echo get_site_url(); ?>/wp-content/plugins/superdesk-wordpress-plugin/autoload.php</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="url">SD (content API) URL</label>
|
<label for="url">SD (content API) URL</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="url" id="url" class="regular-text code" value="<?php echo($settings['url']); ?>">
|
<input type="text" name="url" id="url" class="regular-text code" value="<?php echo($settings['url']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="client_id">Client ID</label>
|
<label for="client_id">Client ID</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="client_id" id="client_id" class="regular-text" value="<?php echo($settings['client_id']); ?>">
|
<input type="text" name="client_id" id="client_id" class="regular-text" value="<?php echo($settings['client_id']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="username">Username</label>
|
<label for="username">Username</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="username" id="username" class="regular-text" value="<?php echo($settings['username']); ?>">
|
<input type="text" name="username" id="username" class="regular-text" value="<?php echo($settings['username']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="password">Password</label>
|
<label for="password">Password</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="password" id="password" class="regular-text" value="<?php echo($settings['password']); ?>">
|
<input type="password" name="password" id="password" class="regular-text" value="<?php echo($settings['password']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Status of the ingested articles/posts
|
Status of the ingested articles/posts
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<?php
|
<?php
|
||||||
foreach ($statuses as $key => $value) {
|
foreach ($statuses as $key => $value) {
|
||||||
?>
|
?>
|
||||||
<label for="status-<?php echo($key); ?>">
|
<label for="status-<?php echo($key); ?>">
|
||||||
<input type="radio" name="status" id="status-<?php echo($key); ?>" value="<?php echo($key); ?>"<?php
|
<input type="radio" name="status" id="status-<?php echo($key); ?>" value="<?php echo($key); ?>"<?php
|
||||||
if ($key == $settings['status']) {
|
if ($key == $settings['status']) {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> <?php echo($value); ?>
|
?>> <?php echo($value); ?>
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="author">Default author</label>
|
<label for="author">Default author</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="author" id="author">
|
<select name="author" id="author">
|
||||||
<?php
|
<?php
|
||||||
foreach ($authors as $key => $value) {
|
foreach ($authors as $key => $value) {
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo($key); ?>"<?php
|
<option value="<?php echo($key); ?>"<?php
|
||||||
if ($key == $settings['author']) {
|
if ($key == $settings['author']) {
|
||||||
echo(' selected');
|
echo(' selected');
|
||||||
}
|
}
|
||||||
?>><?php echo($value); ?></option>
|
?>><?php echo($value); ?></option>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="author-byline" <?php echo ($settings['author-byline']) ? "checked" : ""; ?>> Show byline in posts
|
<input type="checkbox" name="author-byline" <?php echo ($settings['author-byline']) ? "checked" : ""; ?>> Show byline in posts
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="byline-words">Choose the words replace from the byline</label>
|
<label for="byline-words">Choose the words replace from the byline</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="byline-words" id="byline-words" class="regular-text" value="<?php echo($settings['byline-words']); ?>">
|
<input type="text" name="byline-words" id="byline-words" class="regular-text" value="<?php echo($settings['byline-words']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Choose words to replace from the byline
|
Choose words to replace from the byline
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="status-off">
|
<label for="status-off">
|
||||||
<input type="radio" name="display-copyright" id="status-off" value="off"<?php
|
<input type="radio" name="display-copyright" id="status-off" value="off"<?php
|
||||||
if ($settings['display-copyright'] == 'off') {
|
if ($settings['display-copyright'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="status-on">
|
<label for="status-on">
|
||||||
<input type="radio" name="display-copyright" id="status-on" value="on"<?php
|
<input type="radio" name="display-copyright" id="status-on" value="on"<?php
|
||||||
if ($settings['display-copyright'] == 'on') {
|
if ($settings['display-copyright'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Convert slugline keywords into WP tags
|
Convert slugline keywords into WP tags
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="off">
|
<label for="off">
|
||||||
<input type="radio" name="convert-keywords" id="off" value="off"<?php
|
<input type="radio" name="convert-keywords" id="off" value="off"<?php
|
||||||
if ($settings['convert-keywords'] == 'off') {
|
if ($settings['convert-keywords'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="on">
|
<label for="on">
|
||||||
<input type="radio" name="convert-keywords" id="on" value="on"<?php
|
<input type="radio" name="convert-keywords" id="on" value="on"<?php
|
||||||
if ($settings['convert-keywords'] == 'on') {
|
if ($settings['convert-keywords'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Import SD keywords as WP tags
|
Import SD keywords as WP tags
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="off">
|
<label for="off">
|
||||||
<input type="radio" name="import-keywords" id="off" value="off"<?php
|
<input type="radio" name="import-keywords" id="off" value="off"<?php
|
||||||
if ($settings['import-keywords'] == 'off') {
|
if ($settings['import-keywords'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="on">
|
<label for="on">
|
||||||
<input type="radio" name="import-keywords" id="on" value="on"<?php
|
<input type="radio" name="import-keywords" id="on" value="on"<?php
|
||||||
if ($settings['import-keywords'] == 'on') {
|
if ($settings['import-keywords'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Import Superdesk categories as Wordpress categories
|
Import Superdesk categories as Wordpress categories
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="off">
|
<label for="off">
|
||||||
<input type="radio" name="convert-services" id="off" value="off"<?php
|
<input type="radio" name="convert-services" id="off" value="off"<?php
|
||||||
if ($settings['convert-services'] == 'off') {
|
if ($settings['convert-services'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="on">
|
<label for="on">
|
||||||
<input type="radio" name="convert-services" id="on" value="on"<?php
|
<input type="radio" name="convert-services" id="on" value="on"<?php
|
||||||
if ($settings['convert-services'] == 'on') {
|
if ($settings['convert-services'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Import Superdesk subjects as
|
Import Superdesk subjects as
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="tags">
|
<label for="tags">
|
||||||
<input type="radio" name="subject-type" id="tags" value="tags"<?php
|
<input type="radio" name="subject-type" id="tags" value="tags"<?php
|
||||||
if ($settings['subject-type'] == 'tags' || !$settings['subject-type'] || $settings['subject-type'] == null) {
|
if ($settings['subject-type'] == 'tags' || !$settings['subject-type'] || $settings['subject-type'] == null) {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> Wordpress tags
|
?>> Wordpress tags
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="categories">
|
<label for="categories">
|
||||||
<input type="radio" name="subject-type" id="categories" value="categories"<?php
|
<input type="radio" name="subject-type" id="categories" value="categories"<?php
|
||||||
if ($settings['subject-type'] == 'categories') {
|
if ($settings['subject-type'] == 'categories') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> Wordpress categories
|
?>> Wordpress categories
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="category">Default category</label>
|
<label for="category">Default category</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="category[]" id="category" multiple>
|
<select name="category[]" id="category" multiple>
|
||||||
<?php
|
<?php
|
||||||
foreach ($categories as $key => $value) {
|
foreach ($categories as $key => $value) {
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo($key); ?>"<?php
|
<option value="<?php echo($key); ?>"<?php
|
||||||
if (isset($settings['category']) && is_array($settings['category'])) {
|
if (isset($settings['category']) && is_array($settings['category'])) {
|
||||||
if (in_array($key, $settings['category'])) {
|
if (in_array($key, $settings['category'])) {
|
||||||
echo(' selected');
|
echo(' selected');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>><?php echo($value); ?></option>
|
?>><?php echo($value); ?></option>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="separator-caption-image">Separator for caption image</label>
|
<label for="separator-caption-image">Separator for caption image</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="separator-caption-image" id="separator-caption-image" class="regular-text" value="<?php echo($settings['separator-caption-image']); ?>">
|
<input type="text" name="separator-caption-image" id="separator-caption-image" class="regular-text" value="<?php echo($settings['separator-caption-image']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Display the copyrightholder image
|
Display the copyrightholder image
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="copyrightholder-image-off">
|
<label for="copyrightholder-image-off">
|
||||||
<input type="radio" name="copyrightholder-image" id="copyrightholder-image-off" value="off"<?php
|
<input type="radio" name="copyrightholder-image" id="copyrightholder-image-off" value="off"<?php
|
||||||
if ($settings['copyrightholder-image'] == 'off') {
|
if ($settings['copyrightholder-image'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="copyrightholder-image-on">
|
<label for="copyrightholder-image-on">
|
||||||
<input type="radio" name="copyrightholder-image" id="copyrightholder-image-on" value="on"<?php
|
<input type="radio" name="copyrightholder-image" id="copyrightholder-image-on" value="on"<?php
|
||||||
if ($settings['copyrightholder-image'] == 'on') {
|
if ($settings['copyrightholder-image'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Display the copyrightnotice image
|
Display the copyrightnotice image
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="copyrightnotice-image-off">
|
<label for="copyrightnotice-image-off">
|
||||||
<input type="radio" name="copyrightnotice-image" id="copyrightnotice-image-off" value="off"<?php
|
<input type="radio" name="copyrightnotice-image" id="copyrightnotice-image-off" value="off"<?php
|
||||||
if ($settings['copyrightnotice-image'] == 'off') {
|
if ($settings['copyrightnotice-image'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="copyrightnotice-image-on">
|
<label for="copyrightnotice-image-on">
|
||||||
<input type="radio" name="copyrightnotice-image" id="copyrightnotice-image-on" value="on"<?php
|
<input type="radio" name="copyrightnotice-image" id="copyrightnotice-image-on" value="on"<?php
|
||||||
if ($settings['copyrightnotice-image'] == 'on') {
|
if ($settings['copyrightnotice-image'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="separator-located">Separator between the location and name</label>
|
<label for="separator-located">Separator between the location and name</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="separator-located" id="separator-located" class="regular-text" value="<?php echo($settings['separator-located']); ?>">
|
<input type="text" name="separator-located" id="separator-located" class="regular-text" value="<?php echo($settings['separator-located']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Convert slugline keywords into WP tags
|
Convert slugline keywords into WP tags
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="convert-slugline-off">
|
<label for="convert-slugline-off">
|
||||||
<input type="radio" name="convert-slugline" id="convert-slugline-off" value="off"<?php
|
<input type="radio" name="convert-slugline" id="convert-slugline-off" value="off"<?php
|
||||||
if ($settings['convert-slugline'] == 'off') {
|
if ($settings['convert-slugline'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="convert-slugline-on">
|
<label for="convert-slugline-on">
|
||||||
<input type="radio" name="convert-slugline" id="convert-slugline-on" value="on"<?php
|
<input type="radio" name="convert-slugline" id="convert-slugline-on" value="on"<?php
|
||||||
if ($settings['convert-slugline'] == 'on') {
|
if ($settings['convert-slugline'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="slugline-separator">Slugline value separator</label>
|
<label for="slugline-separator">Slugline value separator</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="slugline-separator" id="slugline-separator" class="regular-text" value="<?php echo($settings['slugline-separator']); ?>">
|
<input type="text" name="slugline-separator" id="slugline-separator" class="regular-text" value="<?php echo($settings['slugline-separator']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="slugline-ignored">Keywords to be ignored</label>
|
<label for="slugline-ignored">Keywords to be ignored</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="slugline-ignored" id="slugline-ignored" class="regular-text" value="<?php echo($settings['slugline-ignored']); ?>">
|
<input type="text" name="slugline-ignored" id="slugline-ignored" class="regular-text" value="<?php echo($settings['slugline-ignored']); ?>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label for="priority_threshhold">Priority threshhold of </label>
|
<label for="priority_threshhold">Priority threshhold of </label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<select name="priority_threshhold" id="priority_threshhold">
|
<select name="priority_threshhold" id="priority_threshhold">
|
||||||
<option value="0"> </option>
|
<option value="0"> </option>
|
||||||
<?php
|
<?php
|
||||||
for ($i = 1; $i <= 6; $i++) {
|
for ($i = 1; $i <= 6; $i++) {
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo($i); ?>"<?php
|
<option value="<?php echo($i); ?>"<?php
|
||||||
if (isset($settings['priority_threshhold']) && $settings['priority_threshhold'] == $i) {
|
if (isset($settings['priority_threshhold']) && $settings['priority_threshhold'] == $i) {
|
||||||
echo(' selected');
|
echo(' selected');
|
||||||
}
|
}
|
||||||
?>><?php echo($i); ?></option>
|
?>><?php echo($i); ?></option>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
Download images from SD
|
Download images from SD
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="download-images-off">
|
<label for="download-images-off">
|
||||||
<input type="radio" name="download-images" id="download-images-off" value="off"<?php
|
<input type="radio" name="download-images" id="download-images-off" value="off"<?php
|
||||||
if ($settings['download-images'] == 'off') {
|
if ($settings['download-images'] == 'off') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> off
|
?>> off
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="download-images-on">
|
<label for="download-images-on">
|
||||||
<input type="radio" name="download-images" id="download-images-on" value="on"<?php
|
<input type="radio" name="download-images" id="download-images-on" value="on"<?php
|
||||||
if ($settings['download-images'] == 'on') {
|
if ($settings['download-images'] == 'on') {
|
||||||
echo(' checked');
|
echo(' checked');
|
||||||
}
|
}
|
||||||
?>> on
|
?>> on
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
<tr>
|
||||||
</table>
|
<th scope="row">
|
||||||
<p class="submit">
|
Match Superdesk Content Profiles with Wordpress Post Formats
|
||||||
<input type="submit" name="submit" id="submit" class="button button-primary" value="Save">
|
</th>
|
||||||
</p>
|
<td>
|
||||||
</form>
|
<fieldset>
|
||||||
|
<label for="post-formats-off">
|
||||||
|
<input type="radio" name="post-formats" id="post-formats-off" value="off"<?php
|
||||||
|
if ($settings['post-formats'] == 'off') {
|
||||||
|
echo(' checked');
|
||||||
|
}
|
||||||
|
?>> off
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<label for="post-formats-on">
|
||||||
|
<input type="radio" name="post-formats" id="post-formats-on" value="on"<?php
|
||||||
|
if ($settings['post-formats'] == 'on') {
|
||||||
|
echo(' checked');
|
||||||
|
}
|
||||||
|
?>> on
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Superdesk Content Profile Name</th>
|
||||||
|
<th>Wordpress Post Format</th>
|
||||||
|
<th><a href="javascript:rowAddFunction();">Add row</a></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="post-format-tbody">
|
||||||
|
<?php
|
||||||
|
if (isset($settings['post-formats-table']) and is_array($settings['post-formats-table'])) {
|
||||||
|
foreach ($settings['post-formats-table'] as $key => $value) {
|
||||||
|
echo make_table_row($value, $key, $post_formats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="submit">
|
||||||
|
<input type="submit" name="submit" id="submit" class="button button-primary" value="Save">
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var select_options = <?php echo json_encode($post_formats); ?>;
|
||||||
|
var $ = jQuery;
|
||||||
|
|
||||||
|
var rowAddFunction = function () {
|
||||||
|
var element = $("#post-format-tbody");
|
||||||
|
var new_element = '<tr>\n\
|
||||||
|
<td><input type="text" name="post-formats-input[]" class="regular-text" />\n\
|
||||||
|
</td><td>\n\
|
||||||
|
<select name="post-formats-value[]">';
|
||||||
|
$.each(select_options, function (key, value) {
|
||||||
|
new_element += '<option value="' + key + '">' + value + '</option>';
|
||||||
|
});
|
||||||
|
new_element += '</select></td><td><a href="#" onclick="removeThisRow(this); return false;">Delete</a></td></tr>';
|
||||||
|
element.append(new_element);
|
||||||
|
};
|
||||||
|
|
||||||
|
function debounce(func, wait, immediate) {
|
||||||
|
console.log(func);
|
||||||
|
var timeout;
|
||||||
|
return function () {
|
||||||
|
var context = this, args = arguments;
|
||||||
|
var later = function () {
|
||||||
|
timeout = null;
|
||||||
|
if (!immediate)
|
||||||
|
func.apply(context, args);
|
||||||
|
};
|
||||||
|
var callNow = immediate && !timeout;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(later, wait);
|
||||||
|
if (callNow)
|
||||||
|
func.apply(context, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var removeThisRow = function (el) {
|
||||||
|
var element = $(el).parent()
|
||||||
|
.parent();
|
||||||
|
element.remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
var validateInput = function () {
|
||||||
|
var el = this;
|
||||||
|
var element = $(el);
|
||||||
|
var text_value = element.val();
|
||||||
|
var found = false;
|
||||||
|
var input_elements = $("#post-format-tbody input");
|
||||||
|
$.each(input_elements, function (_, input_element) {
|
||||||
|
if (el !== input_element) {
|
||||||
|
if (text_value === $(input_element).val()) {
|
||||||
|
found = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (found) {
|
||||||
|
if (!element.hasClass('spwp-input-error')) {
|
||||||
|
element.addClass('spwp-input-error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (element.hasClass('spwp-input-error')) {
|
||||||
|
element.removeClass('spwp-input-error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#submit").prop('disabled', found);
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
rowAddFunction();
|
||||||
|
var validateDebounce = debounce(validateInput, 250);
|
||||||
|
$("#post-format-tbody input").live('keyup', validateDebounce);
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.spwp-input-error{
|
||||||
|
border-color: red !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
14
autoload.php
14
autoload.php
@@ -27,7 +27,7 @@ if ($obj['type'] == 'text') {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
if (!empty($obj['ednote'])) {
|
if (!empty($obj['ednote'])) {
|
||||||
$content.= "<p>Editors Note: " . wp_strip_all_tags($obj['ednote']) . "</p>";
|
$content .= "<p>Editors Note: " . wp_strip_all_tags($obj['ednote']) . "</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($obj['evolvedfrom'])) {
|
if (isset($obj['evolvedfrom'])) {
|
||||||
@@ -139,6 +139,12 @@ if ($obj['type'] == 'text') {
|
|||||||
'post_category' => $category
|
'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);
|
wp_update_post($edit_post);
|
||||||
|
|
||||||
$attachmentExist = get_post_thumbnail_id($post_ID);
|
$attachmentExist = get_post_thumbnail_id($post_ID);
|
||||||
@@ -177,6 +183,12 @@ if ($obj['type'] == 'text') {
|
|||||||
|
|
||||||
$post_ID = wp_insert_post($postarr, true);
|
$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)) {
|
if ($taxonomyTag && !empty($taxonomyTag)) {
|
||||||
wp_set_post_tags($post_ID, $taxonomyTag);
|
wp_set_post_tags($post_ID, $taxonomyTag);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user