Changeset 1826541
- Timestamp:
- 02/21/2018 11:16:14 PM (8 years ago)
- Location:
- canvasflow/trunk
- Files:
-
- 2 added
- 7 edited
-
README.md (modified) (2 diffs)
-
canvasflow-plugin.php (modified) (3 diffs)
-
includes/canvasflow-main.php (modified) (14 diffs)
-
includes/canvasflow-metabox.php (added)
-
includes/canvasflow-settings.php (modified) (18 diffs)
-
includes/views/canvasflow-main-view.php (modified) (3 diffs)
-
includes/views/canvasflow-metabox-view.php (added)
-
includes/views/canvasflow-settings-view.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
canvasflow/trunk/README.md
r1805407 r1826541 55 55 56 56 #### Changelog 57 ##### 0.11.0 58 * Add support for metabox in post editor 59 * Add support for issue in settings 60 57 61 ##### 0.10.0 58 62 * Add support for Wordpress shortcodes … … 88 92 89 93 #### Upgrade Notice 94 ##### 0.11.0 95 * Support for canvasflow as metabox in post editor 96 * Articles are add automatically to upload manager 97 * Users can now select a default issue 98 * Users can specify to which issue an post is going to be published 99 90 100 ##### 0.10.0 91 101 * Support Wordpress Shortcode -
canvasflow/trunk/canvasflow-plugin.php
r1805408 r1826541 3 3 Plugin Name: Canvasflow for WordPress 4 4 Description: This out-of-the-box connector provides a quick and simple way to push your blog content directly to an existing Canvasflow publication. 5 Version: 0.1 0.05 Version: 0.11.0 6 6 Developer: Canvasflow 7 7 Developer URI: https://canvasflow.io … … 93 93 } 94 94 function createCanvasflowPostsTable() { 95 $query = "CREATE TABLE IF NOT EXISTS wp_canvasflow_posts(ID BIGINT(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,post_id BIGINT(20) UNSIGNED NOT NULL, style_id BIGINT(20) UNSIGNED, author_id BIGINT(20) UNSIGNED NOT NULL, published DATETIME, CONSTRAINT wp_canvasflow_posts_wp_posts_ID_fk FOREIGN KEY (post_id) REFERENCES wp_posts (ID) ON DELETE CASCADE ON UPDATE CASCADE);";95 $query = "CREATE TABLE IF NOT EXISTS wp_canvasflow_posts(ID BIGINT(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,post_id BIGINT(20) UNSIGNED NOT NULL, style_id BIGINT(20) UNSIGNED, issue_id BIGINT(20) UNSIGNED, author_id BIGINT(20) UNSIGNED NOT NULL, published DATETIME, CONSTRAINT wp_canvasflow_posts_wp_posts_ID_fk FOREIGN KEY (post_id) REFERENCES wp_posts (ID) ON DELETE CASCADE ON UPDATE CASCADE);"; 96 96 $this->wpdb->query($query); 97 97 } 98 98 function createCanvasflowCredentialsTable() { 99 $query = "CREATE TABLE IF NOT EXISTS wp_canvasflow_credentials (ID BIGINT(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT, user_id BIGINT(20) UNSIGNED NOT NULL, merge_adjacent_paragraphs BOOLEAN NOT NULL DEFAULT 1, secret_key TEXT, publication_id VARCHAR(100) NOT NULL DEFAULT '', style_id BIGINT(20) UNSIGNED, CONSTRAINT wp_canvasflow_credentials_wp_users_ID_fk FOREIGN KEY (user_id) REFERENCES wp_users (ID) ON DELETE CASCADE ON UPDATE CASCADE);";99 $query = "CREATE TABLE IF NOT EXISTS wp_canvasflow_credentials (ID BIGINT(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT, user_id BIGINT(20) UNSIGNED NOT NULL, merge_adjacent_paragraphs BOOLEAN NOT NULL DEFAULT 1, secret_key TEXT, publication_id VARCHAR(100) NOT NULL DEFAULT '', style_id BIGINT(20) UNSIGNED, issue_id BIGINT(20) UNSIGNED, CONSTRAINT wp_canvasflow_credentials_wp_users_ID_fk FOREIGN KEY (user_id) REFERENCES wp_users (ID) ON DELETE CASCADE ON UPDATE CASCADE);"; 100 100 $this->wpdb->query($query); 101 101 } … … 123 123 } 124 124 new WP_Canvasflow(); 125 126 /* Define the custom box */ 127 add_action( 'add_meta_boxes', 'canvasflow_add_custom_box'); 128 129 /* Do something with the data entered */ 130 // add_action( 'save_post', 'myplugin_save_postdata' ); 131 132 /* Adds a box to the main column on the Post and Page edit screens */ 133 function canvasflow_add_custom_box() { 134 $title = 'Canvasflow'; 135 $screens = array( 'post', 'page'); 136 add_meta_box( 'cf_post', $title, 'cf_editor_meta_box' , $screens, 'side'); 137 } 138 139 /* Prints the box content */ 140 function cf_editor_meta_box( $post ) { 141 142 // Use nonce for verification 143 wp_nonce_field( plugin_basename( __FILE__ ), 'canvasflow_noncename' ); 144 145 include( plugin_dir_path( __FILE__ ) . 'includes/canvasflow-metabox.php'); 146 $metaBox = new Canvasflow_Metabox(); 147 $metaBox->renderHTML($post); 148 149 // $field_value = get_post_meta( $post->ID, '_wp_editor_test_1', false ); 150 // wp_editor( $field_value[0], '_wp_editor_test_1' ); 151 } 125 152 ?> -
canvasflow/trunk/includes/canvasflow-main.php
r1805407 r1826541 19 19 private $publication_id; 20 20 private $default_style_id; 21 private $default_issue_id; 21 22 22 23 function __construct($user_id) { … … 29 30 $this->publication_id = $credentials->publication_id; 30 31 $this->default_style_id = $credentials->style_id; 32 $this->default_issue_id = $credentials->issue_id; 31 33 } 32 34 33 35 function get_user_credentials(){ 34 36 $user_id = $this->user_id; 35 $query = "SELECT secret_key, merge_adjacent_paragraphs, publication_id, style_id 36 FROM wp_canvasflow_credentials LIMIT 1;"; 37 $query = "SELECT secret_key, merge_adjacent_paragraphs, publication_id, style_id, issue_id FROM wp_canvasflow_credentials LIMIT 1;"; 37 38 38 39 $credentials = $this->wpdb->get_results($query); … … 45 46 $credential->publication_id = ''; 46 47 $credential->style_id = ''; 48 $credential->issue_id = ''; 47 49 return $credential; 48 50 } … … 56 58 $publication_id = $this->publication_id; 57 59 $default_style_id = $this->default_style_id; 60 $default_issue_id = $this->default_issue_id; 58 61 59 62 $page = $this->page; … … 68 71 foreach($this->get_styles_from_remote($publication_id, $secret_key) as $style) { 69 72 array_push($styles, $style); 73 } 74 75 $issues = array(); 76 foreach($this->get_issues_from_remote($publication_id, $secret_key) as $issue) { 77 array_push($issues, $issue); 70 78 } 71 79 … … 132 140 users.display_name as display_name, users.ID as user_id, canvasflow_posts.published as published, 133 141 canvasflow_posts.ID as canvasflow_post_id, post.post_modified as post_modified_date, post.post_type 134 as type, canvasflow_posts.style_id as style_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users142 as type, canvasflow_posts.style_id as style_id, canvasflow_posts.issue_id as issue_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users 135 143 ON(post.post_author=users.ID) LEFT JOIN wp_canvasflow_posts as canvasflow_posts 136 144 ON(post.ID=canvasflow_posts.post_id) WHERE post.post_parent = 0 AND (post.post_type = \"post\" … … 143 151 users.display_name as display_name, users.ID as user_id, canvasflow_posts.published as published, 144 152 canvasflow_posts.ID as canvasflow_post_id, post.post_modified as post_modified_date, post.post_type 145 as type, canvasflow_posts.style_id as style_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users153 as type, canvasflow_posts.style_id as style_id, canvasflow_posts.issue_id as issue_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users 146 154 ON(post.post_author=users.ID) LEFT JOIN wp_canvasflow_posts as canvasflow_posts 147 155 ON(post.ID=canvasflow_posts.post_id) WHERE post.post_parent = 0 AND (post.post_type = \"post\" OR … … 162 170 users.display_name as display_name, users.ID as user_id, canvasflow_posts.published as published, 163 171 canvasflow_posts.ID as canvasflow_post_id, post.post_modified as post_modified_date, 164 canvasflow_posts.style_id as style_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users172 canvasflow_posts.style_id as style_id, canvasflow_posts.issue_id as issue_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users 165 173 ON(post.post_author=users.ID) LEFT JOIN wp_canvasflow_posts as canvasflow_posts 166 174 ON(post.ID=canvasflow_posts.post_id) WHERE post.post_parent = 0 AND (post.post_type = \"post\" … … 171 179 as content, users.display_name as display_name, users.ID as user_id, canvasflow_posts.published as 172 180 published, canvasflow_posts.ID as canvasflow_post_id, post.post_modified as post_modified_date, 173 canvasflow_posts.style_id as style_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users181 canvasflow_posts.style_id as style_id, canvasflow_posts.issue_id as issue_id FROM {$post_table_name} as post LEFT JOIN {$users_table_name} as users 174 182 ON(post.post_author=users.ID) LEFT JOIN wp_canvasflow_posts as canvasflow_posts 175 183 ON(post.ID=canvasflow_posts.post_id) WHERE post.post_parent = 0 AND (post.post_type = \"post\" OR … … 188 196 } 189 197 190 function send_post($post_id, $style_id ) {198 function send_post($post_id, $style_id, $issue_id) { 191 199 $author_id = wp_get_current_user()->ID; 192 200 $post = get_post($post_id); 193 201 $post_title = $post->post_title; 194 202 $post_content = $post->post_content; 195 if($this->publish_post($post_content, $post_title, $post_id, $style_id )){196 $this->update_post($post_id, $style_id );197 } 198 } 199 200 function publish_post($content, $post_title, $post_id, $style_id ) {203 if($this->publish_post($post_content, $post_title, $post_id, $style_id, $issue_id)){ 204 $this->update_post($post_id, $style_id, $issue_id); 205 } 206 } 207 208 function publish_post($content, $post_title, $post_id, $style_id, $issue_id) { 201 209 $secret_key = $this->secret_key; 202 210 $merge_adjacent_paragraphs = $this->merge_adjacent_paragraphs; … … 217 225 218 226 $style_id = (int) $style_id; 227 $issue_id = (int) $issue_id; 219 228 220 229 $content = do_shortcode($content); … … 228 237 'contentType' => "html", 229 238 'publicationId' => $publication_id, 230 'issueId' => "Iss01",239 'issueId' => $issue_id, 231 240 'mergeAdjParagraphs' => $merge_adjacent_paragraphs, 232 241 'styleId' => $style_id, … … 266 275 } 267 276 268 function update_post($post_id, $style_id ){277 function update_post($post_id, $style_id, $issue_id){ 269 278 $author_id = $this->user_id; 270 279 271 280 $time = current_time( 'mysql' ); 272 $query = "UPDATE wp_canvasflow_posts SET author_id = {$author_id}, published = '{$time}', style_id = {$style_id} 273 WHERE post_id = {$post_id};"; 281 $query = "INSERT INTO wp_canvasflow_posts (post_id, author_id, published, style_id, issue_id) VALUES ({$post_id}, {$author_id}, '{$time}', {$style_id}, {$issue_id});"; 282 283 if($this->exist_post($post_id)) { 284 $query = "UPDATE wp_canvasflow_posts SET author_id = {$author_id}, published = '{$time}', style_id = {$style_id}, issue_id = {$issue_id} WHERE post_id = {$post_id};"; 285 } 286 274 287 $this->wpdb->query($query); 288 289 } 290 291 function exist_post($post_id) { 292 $query = "SELECT * FROM wp_canvasflow_posts WHERE post_id = {$post_id};"; 293 $result = $this->wpdb->get_results($query); 294 if(sizeof($result) > 0) { 295 return TRUE; 296 } 297 return FALSE; 275 298 } 276 299 … … 294 317 } 295 318 } 319 320 function get_issues_from_remote($publication_id, $secret_key) { 321 $url = $this->base_url."/issues?secretkey={$secret_key}&publicationId={$publication_id}"; 322 $response = wp_remote_get($url); 323 324 if ( is_wp_error( $response ) ) { 325 $error_message = $response->get_error_message(); 326 echo "<div class=\"error-message\"><div><b>{$error_message}</div></div>"; 327 } else { 328 $http_response_code = $response['response']['code']; 329 $body = $response['body']; 330 if($http_response_code == 200){ 331 return json_decode($body, true); 332 } else { 333 $message = $body; 334 $message = str_replace('"', '', $message); 335 echo "<div class=\"error-message\"><div><b>{$message}</b></div></div>"; 336 } 337 } 338 } 296 339 } 297 340 298 341 $canvasflow_main = new Canvasflow_Main($user_id); 299 342 if(isset($_POST["id"])) { 300 $canvasflow_main->send_post($_POST["id"], $_POST["style_id"] );343 $canvasflow_main->send_post($_POST["id"], $_POST["style_id"], $_POST["issue_id"]); 301 344 } 302 345 -
canvasflow/trunk/includes/canvasflow-settings.php
r1736456 r1826541 18 18 private $publications = array(); 19 19 private $style_id = 0; 20 private $issue_id = 0; 20 21 private $styles = array(); 22 private $issues = array(); 21 23 private $valid_secret_key = TRUE; 22 24 … … 34 36 $db_publication_id = $credentials->publication_id; 35 37 $db_style_id = $credentials->style_id; 38 $db_issue_id = $credentials->issue_id; 36 39 37 40 $this->merge_adjacent_paragraphs = $db_merge_adjacent_paragraphs; … … 41 44 $this->publications = array(); 42 45 foreach($this->get_remote_publications($db_secret_key) as $publication) { 43 if($publication['type'] == 'article') { 46 array_push($this->publications, $publication); 47 /*if($publication['type'] == 'article') { 44 48 array_push($this->publications, $publication); 45 } 49 }*/ 46 50 } 47 51 … … 59 63 $this->style_id = $this->styles[0]['id']; 60 64 } 65 66 $this->issues = array(); 67 foreach($this->get_remote_issues($db_secret_key, $this->publication_id) as $issue) { 68 array_push($this->issues, $issue); 69 } 70 71 if($db_issue_id != '') { 72 $this->issue_id = $db_issue_id; 73 } else { 74 $this->issue_id = $this->issues[0]['id']; 75 } 61 76 } else { 62 77 $this->style_id = ''; 63 78 $this->styles = array(); 79 80 $this->db_issue_id = ''; 81 $this->issues = array(); 64 82 } 65 83 } … … 69 87 $this->style_id = ''; 70 88 $this->styles = array(); 71 } 72 } 73 74 public function update_credentials($request_secret_key, $request_merge_adjacent_paragraphs, $request_publication_id, $request_style_id) { 89 $this->db_issue_id = ''; 90 $this->issues = array(); 91 } 92 } 93 94 public function update_credentials($request_secret_key, $request_merge_adjacent_paragraphs, $request_publication_id, $request_style_id, $request_issue_id) { 75 95 $credentials = $this->get_user_credentials(); 76 96 $db_secret_key = $credentials->secret_key; 77 97 $db_publication_id = $credentials->publication_id; 78 98 $db_style_id = $credentials->style_id; 99 $db_issue_id = $credentials->issue_id; 79 100 80 101 $this->merge_adjacent_paragraphs = $request_merge_adjacent_paragraphs; … … 84 105 $this->update_secret_key($request_secret_key); 85 106 $this->reset_canvasflow_posts_style(); 107 $this->reset_canvasflow_posts_issue(); 86 108 } else { 87 109 $this->secret_key = $request_secret_key; … … 89 111 $this->update_publication($request_publication_id); 90 112 $this->reset_canvasflow_posts_style(); 113 $this->reset_canvasflow_posts_issue(); 91 114 } else { 92 115 $this->publication_id = $request_publication_id; … … 96 119 $this->style_id = $db_style_id; 97 120 } 98 } 99 } 100 101 $this->save_credentials($this->secret_key, $this->merge_adjacent_paragraphs, $this->publication_id, $this->style_id); 121 122 if($db_issue_id != $request_issue_id) { 123 $this->issue_id = $request_issue_id; 124 } else { 125 $this->issue_id = $db_issue_id; 126 } 127 } 128 } 129 130 $this->save_credentials($this->secret_key, $this->merge_adjacent_paragraphs, $this->publication_id, $this->style_id, $this->issue_id); 102 131 } else { 103 132 $this->valid_secret_key = FALSE; … … 112 141 $this->publications = array(); 113 142 $this->style_id = 0; 143 $this->issue_id = 0; 114 144 $this->styles = array(); 145 $this->issues = array(); 115 146 } 116 147 … … 129 160 130 161 $this->style_id = $this->styles[0]['id']; 162 163 $this->issues = array(); 164 foreach($this->get_remote_issues($this->secret_key, $this->publication_id) as $issue) { 165 array_push($this->issues, $issue); 166 } 167 168 $this->issue_id = $this->issues[0]['id']; 131 169 } 132 170 … … 139 177 140 178 $selected_style = $this->style_id; 179 $selected_issue = $this->issue_id; 180 141 181 $styles = $this->styles; 182 $issues = $this->issues; 142 183 143 184 include( plugin_dir_path( __FILE__ ) . 'views/canvasflow-settings-view.php'); … … 147 188 $user_id = $this->user_id; 148 189 //$query = "SELECT secret_key, merge_adjacent_paragraphs, publication_id, style_id FROM {$db_name}.wp_canvasflow_credentials WHERE user_id = {$user_id}; LIMIT 1;"; 149 $query = "SELECT secret_key, merge_adjacent_paragraphs, publication_id, style_id FROM wp_canvasflow_credentials LIMIT 1;";190 $query = "SELECT secret_key, merge_adjacent_paragraphs, publication_id, style_id, issue_id FROM wp_canvasflow_credentials LIMIT 1;"; 150 191 $this->wpdb->query($query); 151 192 … … 159 200 $credential->publication_id = ''; 160 201 $credential->style_id = ''; 202 $credential->issue_id = ''; 161 203 return $credential; 162 204 } … … 229 271 } 230 272 231 private function save_credentials($secret_key, $merge_adjacent_paragraphs, $publication_id, $style_id){ 273 private function get_remote_issues($secret_key, $publication_id) { 274 $url = $this->base_url."/issues?secretkey={$secret_key}&publicationId={$publication_id}"; 275 $response = wp_remote_get($url); 276 277 if ( is_wp_error( $response ) ) { 278 $error_message = $response->get_error_message(); 279 echo "<div class=\"error-message\"><div><b>{$error_message}</div></div>"; 280 } else { 281 $http_response_code = $response['response']['code']; 282 $body = $response['body']; 283 if($http_response_code == 200){ 284 if($body == "array()"){ 285 $message = "There are no issues for this publication"; 286 echo "<div class=\"error-message\"><div><b>{$message}</b></div></div>"; 287 } 288 return json_decode($body, true); 289 } else { 290 $message = $body; 291 $message = str_replace('"', '', $message); 292 echo "<div class=\"error-message\"><div><b>{$message}</b></div></div>"; 293 } 294 } 295 } 296 297 private function save_credentials($secret_key, $merge_adjacent_paragraphs, $publication_id, $style_id, $issue_id){ 232 298 if($this->exist_credentials()) { 233 299 $this->insert_credentials_in_db($secret_key, $merge_adjacent_paragraphs); 234 300 } else { 235 $this->update_credentials_in_db($secret_key, $merge_adjacent_paragraphs, $publication_id, $style_id );301 $this->update_credentials_in_db($secret_key, $merge_adjacent_paragraphs, $publication_id, $style_id, $issue_id); 236 302 } 237 303 } … … 251 317 private function insert_credentials_in_db($secret_key, $merge_adjacent_paragraphs = 0) { 252 318 $user_id = $this->user_id; 253 $query = "INSERT INTO wp_canvasflow_credentials (user_id, secret_key, merge_adjacent_paragraphs, publication_id, style_id ) VALUES ({$user_id}, \"{$secret_key}\", {$merge_adjacent_paragraphs}, \"\", NULL);";254 $this->wpdb->query($query); 255 } 256 257 private function update_credentials_in_db($secret_key, $merge_adjacent_paragraphs = 1, $publication_id = '', $style_id = 0 ) {319 $query = "INSERT INTO wp_canvasflow_credentials (user_id, secret_key, merge_adjacent_paragraphs, publication_id, style_id, issue_id) VALUES ({$user_id}, \"{$secret_key}\", {$merge_adjacent_paragraphs}, \"\", NULL, NULL);"; 320 $this->wpdb->query($query); 321 } 322 323 private function update_credentials_in_db($secret_key, $merge_adjacent_paragraphs = 1, $publication_id = '', $style_id = 0, $issue_id = 0) { 258 324 $user_id = $this->user_id; 259 325 … … 264 330 265 331 if($style_id == 0) { 266 $query = "UPDATE wp_canvasflow_credentials SET secret_key = \"{$secret_key}\", merge_adjacent_paragraphs = {$merge_adjacent_paragraphs}, publication_id = \"{$publication_id}\", style_id = NULL;"; 267 } else { 268 $query = "UPDATE wp_canvasflow_credentials SET secret_key = \"{$secret_key}\", merge_adjacent_paragraphs = {$merge_adjacent_paragraphs}, publication_id = \"{$publication_id}\", style_id = {$style_id};"; 332 $query = "UPDATE wp_canvasflow_credentials SET secret_key = \"{$secret_key}\", merge_adjacent_paragraphs = {$merge_adjacent_paragraphs}, publication_id = \"{$publication_id}\", style_id = NULL"; 333 } else { 334 $query = "UPDATE wp_canvasflow_credentials SET secret_key = \"{$secret_key}\", merge_adjacent_paragraphs = {$merge_adjacent_paragraphs}, publication_id = \"{$publication_id}\", style_id = {$style_id}"; 335 } 336 337 if($issue_id == 0) { 338 $query .= ", issue_id = NULL;"; 339 } else { 340 $query .= ", issue_id = {$issue_id};"; 269 341 } 270 342 … … 275 347 $user_id = $this->user_id; 276 348 $query = "UPDATE wp_canvasflow_posts SET style_id = NULL;"; 349 $this->wpdb->query($query); 350 } 351 352 private function reset_canvasflow_posts_issue() { 353 $user_id = $this->user_id; 354 $query = "UPDATE wp_canvasflow_posts SET issue_id = NULL;"; 277 355 $this->wpdb->query($query); 278 356 } … … 302 380 } 303 381 304 $canvasflow_settings->update_credentials($secret_key, $merge_adjacent_paragraphs, $publication_id, $style_id); 382 $issue_id = ''; 383 if(isset($_POST["issue_id"])) { 384 $issue_id = $_POST["issue_id"]; 385 } 386 387 $canvasflow_settings->update_credentials($secret_key, $merge_adjacent_paragraphs, $publication_id, $style_id, $issue_id); 305 388 echo "<div class=\"success-message\"><div><b>Settings Updated</b></div></div>"; 306 389 }catch(Exception $e) { -
canvasflow/trunk/includes/views/canvasflow-main-view.php
r1714764 r1826541 143 143 <span>Style</span> 144 144 </th> 145 <th scope="col" id="issues" class="manage-column column-author num sortable desc"> 146 <span>Issue</span> 147 </th> 145 148 <th scope="col" id="styles" class="manage-column column-author num sortable desc"> 146 149 <?php … … 206 209 $post_modified_date = $post->post_modified_date; 207 210 $current_style_id = $post->style_id; 211 $current_issue_id = $post->issue_id; 208 212 if($post->style_id == '') { 209 213 $current_style_id = $default_style_id; 214 } 215 if($post->issue_id == '') { 216 $current_issue_id = $default_issue_id; 210 217 } 211 218 … … 276 283 ?> 277 284 </td> 285 <td class="date column-author" data-colname="Style"> 286 287 <?php 288 $issue_select = "<select class=\"selectpicker\" name=\"issue_id\" style=\"position: relative; width: 100%\" required>"; 289 foreach($issues as $issue) { 290 $id = $issue['id']; 291 $issue_name = $issue['name']; 292 if($id == $current_issue_id) { 293 $issue_select.= '<option value="'.$id.'" selected name="'.$current_issue_id.'">'.$issue_name.'</option>'; 294 } else { 295 $issue_select.= '<option value="'.$id.'">'.$issue_name.'</option>'; 296 } 297 } 298 $issue_select.= "</select>"; 299 echo $issue_select; 300 ?> 301 </td> 278 302 <td class="date column-author" data-colname="Type"> 279 303 <div><?php echo $type;?></div> -
canvasflow/trunk/includes/views/canvasflow-settings-view.php
r1699142 r1826541 59 59 </td> 60 60 </tr> 61 <?php 62 if(count($issues) > 0) { 63 64 65 ?> 66 <tr> 67 <th scope="row"> 68 <label for="style_id">Default Issue</label> 69 </th> 70 <td> 71 <select class="selectpicker" name="issue_id" required> 72 <?php 73 $select_option_issue = ''; 74 foreach ($issues as $issue) { 75 $issue_id = $issue['id']; 76 $issue_name = $issue['name']; 77 if($issue_id == $selected_issue) { 78 $select_option_issue.= '<option value="'.$issue_id.'" selected>'.$issue_name.'</option>'; 79 } else { 80 $select_option_issue.= '<option value="'.$issue_id.'">'.$issue_name.'</option>'; 81 } 82 } 83 84 echo $select_option_issue; 85 ?> 86 </select> 87 <br/> 88 <small> 89 <em> 90 Determines the default issue where the article is going to be uploaded. 91 </em> 92 </small> 93 </td> 94 </tr> 95 <?php 96 97 } 98 ?> 61 99 <?php 62 100 if(count($styles) > 0){ 63 64 101 ?> 65 102 <tr> -
canvasflow/trunk/readme.txt
r1805407 r1826541 70 70 71 71 == Changelog == 72 = 0.11.0 = 73 * Add support for metabox in post editor 74 * Add support for issue in settings 75 72 76 = 0.10.0 = 73 77 Add support for Wordpress shortcodes … … 102 106 103 107 == Upgrade Notice == 108 = 0.11.0 = 109 Support for canvasflow as metabox in post editor 110 Articles are add automatically to upload manager 111 Users can now select a default issue 112 Users can specify to which issue an post is going to be published 113 104 114 = 0.10.0 = 105 115 Support Wordpress Shortcode
Note: See TracChangeset
for help on using the changeset viewer.