Settings'; return $links; } function get_page_url() { $args = array('page' => 'superdesk/admin/admin'); $url = add_query_arg($args, admin_url('options-general.php')); return $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'], 'password' => $_POST['password'], 'client_id' => $_POST['client_id'], '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'], 'import-keywords' => $_POST['import-keywords'], 'convert-services' => $_POST['convert-services'], 'subject-type' => $_POST['subject-type'], 'category' => $_POST['category'], 'separator-caption-image' => $_POST['separator-caption-image'], 'copyrightholder-image' => $_POST['copyrightholder-image'], 'copyrightnotice-image' => $_POST['copyrightnotice-image'], 'separator-located' => $_POST['separator-located'], 'convert-slugline' => $_POST['convert-slugline'], 'slugline-separator' => $_POST['slugline-separator'], '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')) { $settings = get_option('superdesk_settings'); } else { $settings = array( 'url' => '', 'client_id' => '', 'username' => '', 'password' => '', 'status' => 'publish', 'author' => '', 'author-byline' => '', 'byline-words' => '', 'display-copyright' => '', 'convert-keywords' => '', 'import-keywords' => '', 'convert-services' => '', 'subject-type' => '', 'category' => '', 'separator-caption-image' => '', 'copyrightholder-image' => '', 'copyrightnotice-image' => '', 'separator-located' => '', 'convert-slugline' => '', 'slugline-separator' => '', 'slugline-ignored' => '', 'priority_threshhold' => '', 'download-images' => '', 'post-formats' => '', 'post-formats-table' => array(), ); } $statuses = array( 'publish' => 'Published', 'draft' => 'Draft' ); $authors = array(); $categories = array(); $args = array( 'hide_empty' => 0, ); $all_categories = get_categories($args); foreach ($all_categories as $category) { $categories[$category->cat_ID] = $category->cat_name; } $all_users = get_users(); foreach ($all_users as $user) { $authors[$user->ID] = $user->data->display_name; } function make_table_row($format, $text_value, $formats) { $new_element = '