Changeset 2713005
- Timestamp:
- 04/21/2022 08:55:55 PM (4 years ago)
- Location:
- wordable
- Files:
-
- 1 added
- 12 edited
- 4 copied
-
tags/8.0.5 (added)
-
tags/8.0.5/includes (copied) (copied from wordable/trunk/includes)
-
tags/8.0.5/includes/action_params.php (modified) (2 diffs)
-
tags/8.0.5/includes/actions.php (modified) (4 diffs)
-
tags/8.0.5/includes/connector.php (modified) (2 diffs)
-
tags/8.0.5/includes/wordable_plugin.php (modified) (3 diffs)
-
tags/8.0.5/readme.txt (copied) (copied from wordable/trunk/readme.txt) (2 diffs)
-
tags/8.0.5/settings (copied) (copied from wordable/trunk/settings)
-
tags/8.0.5/settings/views/authors.php (modified) (1 diff)
-
tags/8.0.5/wordable.php (copied) (copied from wordable/trunk/wordable.php) (1 diff)
-
trunk/includes/action_params.php (modified) (2 diffs)
-
trunk/includes/actions.php (modified) (4 diffs)
-
trunk/includes/connector.php (modified) (2 diffs)
-
trunk/includes/wordable_plugin.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/settings/views/authors.php (modified) (1 diff)
-
trunk/wordable.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wordable/tags/8.0.5/includes/action_params.php
r2701468 r2713005 57 57 $author_id = intval($this->params['post']['author_id']); 58 58 59 if(!$this-> user_exists($author_id)) {59 if(!$this->author_exists($author_id)) { 60 60 $this->params['post']['author_id'] = null; 61 61 } else { … … 81 81 82 82 // Helpers 83 function user_exists($user_id) {84 foreach($this->wordable_plugin_actions-> users() as $user) {85 if($ user->ID == $user_id) {83 function author_exists($author_id) { 84 foreach($this->wordable_plugin_actions->authors() as $author) { 85 if($author->ID == $author_id) { 86 86 return true; 87 87 } -
wordable/tags/8.0.5/includes/actions.php
r2701468 r2713005 45 45 function action() { 46 46 $params = $this->parse_and_validate_params(); 47 48 if($params['post'] && $params['post']['author_id']) {49 wp_set_current_user($params['post']['author_id']);50 } else if (count($this->users()) > 0) {51 wp_set_current_user(array_values($this->users())[0]->ID);52 }53 47 54 48 return $this->{$params['method'].'_action'}($params); … … 106 100 107 101 function create_post_action($params) { 102 if($params['post'] && $params['post']['author_id']) { 103 wp_set_current_user($params['post']['author_id']); 104 } else { 105 $current_user_id = $this->user_id_to_be_current(); 106 107 if($current_user_id) { 108 wp_set_current_user($current_user_id); 109 } 110 } 111 108 112 $post_attributes = array( 109 113 'post_author' => $params['post']['author_id'], … … 117 121 118 122 $post_id = $this->throw_if_wp_error(wp_insert_post($post_attributes, true)); 119 return $this->segmented_post_hook($post_id, $post_attributes );123 return $this->segmented_post_hook($post_id, $post_attributes, $params); 120 124 } 121 125 122 function segmented_post_hook($post_id, $post_attributes ) {126 function segmented_post_hook($post_id, $post_attributes, $params) { 123 127 $post = get_post($post_id); 124 128 … … 128 132 $post_attributes['post_title'] = $post_title; 129 133 $post_id = $this->join_segmented_posts($unique_identifier, $post_segment_number, $post, $post_attributes); 134 } 135 136 if($params['post']['featured_image_attachment_id']) { 137 set_post_thumbnail($post_id, $params['post']['featured_image_attachment_id']); 130 138 } 131 139 -
wordable/tags/8.0.5/includes/connector.php
r2709892 r2713005 24 24 'plugin_version' => WORDABLE_VERSION, 25 25 'wordpress_version' => get_bloginfo('version'), 26 'authors' => $this->serialized_ users(),26 'authors' => $this->serialized_authors(), 27 27 'categories' => $this->serialized_categories(), 28 28 'categories_tree' => $this->serialized_categories_tree(), … … 33 33 } 34 34 35 function serialized_ users() {36 $serialized_ users = array();35 function serialized_authors() { 36 $serialized_authors = array(); 37 37 38 foreach ($this->wordable_plugin-> users() as $user) {39 if ($ user->user_login == "") {38 foreach ($this->wordable_plugin->authors() as $author) { 39 if ($author->author_login == "") { 40 40 continue; 41 41 } 42 42 43 array_push($serialized_ users, "$user->ID:$user->user_login");43 array_push($serialized_authors, "$author->ID:$author->author_login"); 44 44 } 45 45 46 return implode(',', $serialized_ users);46 return implode(',', $serialized_authors); 47 47 } 48 48 -
wordable/tags/8.0.5/includes/wordable_plugin.php
r2709892 r2713005 5 5 private $api_host_cache; 6 6 private $secret_cache; 7 private $ users_cache;7 private $authors_cache; 8 8 private $categories_cache; 9 9 private $connector_instance; … … 61 61 } 62 62 63 function users() {64 if(!$this-> users_cache) {65 $this-> users_cache = get_users(array(66 'role s_in' => 'author',63 function authors() { 64 if(!$this->authors_cache) { 65 $this->authors_cache = get_users(array( 66 'role__in' => array('author'), 67 67 'fields' => array('ID', 'user_login', 'user_email', 'display_name'), 68 68 'number' => 200 … … 70 70 } 71 71 72 return $this->users_cache; 72 return $this->authors_cache; 73 } 74 75 function user_id_to_be_current() { 76 foreach (array('administrator', 'editor', 'author', 'contributor') as $role) { 77 $users = get_users(array( 78 'role__in' => array('administrator'), 79 'fields' => array('ID', 'user_login', 'user_email', 'display_name'), 80 'number' => 1 81 )); 82 83 if(count($users) == 1) { 84 return $users[0]->ID; 85 } 86 } 73 87 } 74 88 -
wordable/tags/8.0.5/readme.txt
r2710549 r2713005 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 Stable Tag: 8.0. 49 Stable Tag: 8.0.5 10 10 11 11 This plugin allows you to instantly export Google Docs to WordPress posts or pages. … … 55 55 56 56 == Changelog == 57 58 = 8.0.5 = 59 * Fetching only authors 60 * Not using users to upload images 61 * Set featured image 57 62 58 63 = 8.0.4 = -
wordable/tags/8.0.5/settings/views/authors.php
r2681615 r2713005 1 <?php $ users = $this->users(); ?>1 <?php $authors = $this->authors(); ?> 2 2 3 <h1 class="heading-4">Authors (<?php echo count($users) ?>)</h1> 4 <ul role="list" class="list w-list-unstyled"> 5 <?php foreach ($users as $user) { ?> 6 <li class='list-item-3'> 7 <div class='w-row'> 8 <div class='w-col w-col-4 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 9 <div class='text-block-5'><?php echo esc_html($user->user_login) ?></div> 3 <h1 class="heading-4">Authors (<?php echo count($authors) ?>)</h1> 4 <div style="max-height: 50vh; overflow-y: auto"> 5 <ul role="list" class="list w-list-unstyled"> 6 <?php foreach ($authors as $author) { ?> 7 <li class='list-item-3'> 8 <div class='w-row'> 9 <div class='w-col w-col-4 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 10 <div class='text-block-5'><?php echo esc_html($author->user_login) ?></div> 11 </div> 12 <div class='w-clearfix w-col w-col-8 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 13 <div class='div-block-5'> 14 <a href='mailto:<?php echo $author->user_email ?>' class='link-block w-inline-block'> 15 <div class='text-block-6'><?php echo esc_html($author->user_email) ?></div> 16 </a> 17 </div> 18 </div> 10 19 </div> 11 <div class='w-clearfix w-col w-col-8 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 12 <div class='div-block-5'> 13 <a href='mailto:<?php echo $user->user_email ?>' class='link-block w-inline-block'> 14 <div class='text-block-6'><?php echo esc_html($user->user_email) ?></div> 15 </a> 16 </div> 17 </div> 18 </div> 19 </li> 20 <?php } ?> 21 </ul> 20 </li> 21 <?php } ?> 22 </ul> 23 </div> -
wordable/tags/8.0.5/wordable.php
r2710549 r2713005 4 4 * Plugin URI: http://wordable.io 5 5 * Description: This plugin allows you to instantly export Google Docs to WordPress posts or pages. 6 * Version: 8.0. 46 * Version: 8.0.5 7 7 * Author: Wordable 8 8 * Author URI: https://wordable.io 9 9 * Tested up to: 5.9.2 10 10 * Requires at least: 5.0 11 * Stable tag: 8.0. 411 * Stable tag: 8.0.5 12 12 * 13 13 * Wordpress 5.0+ 14 14 */ 15 15 16 define('WORDABLE_VERSION', '8.0. 4');16 define('WORDABLE_VERSION', '8.0.5'); 17 17 18 18 include 'includes/wordable_plugin.php'; -
wordable/trunk/includes/action_params.php
r2701468 r2713005 57 57 $author_id = intval($this->params['post']['author_id']); 58 58 59 if(!$this-> user_exists($author_id)) {59 if(!$this->author_exists($author_id)) { 60 60 $this->params['post']['author_id'] = null; 61 61 } else { … … 81 81 82 82 // Helpers 83 function user_exists($user_id) {84 foreach($this->wordable_plugin_actions-> users() as $user) {85 if($ user->ID == $user_id) {83 function author_exists($author_id) { 84 foreach($this->wordable_plugin_actions->authors() as $author) { 85 if($author->ID == $author_id) { 86 86 return true; 87 87 } -
wordable/trunk/includes/actions.php
r2701468 r2713005 45 45 function action() { 46 46 $params = $this->parse_and_validate_params(); 47 48 if($params['post'] && $params['post']['author_id']) {49 wp_set_current_user($params['post']['author_id']);50 } else if (count($this->users()) > 0) {51 wp_set_current_user(array_values($this->users())[0]->ID);52 }53 47 54 48 return $this->{$params['method'].'_action'}($params); … … 106 100 107 101 function create_post_action($params) { 102 if($params['post'] && $params['post']['author_id']) { 103 wp_set_current_user($params['post']['author_id']); 104 } else { 105 $current_user_id = $this->user_id_to_be_current(); 106 107 if($current_user_id) { 108 wp_set_current_user($current_user_id); 109 } 110 } 111 108 112 $post_attributes = array( 109 113 'post_author' => $params['post']['author_id'], … … 117 121 118 122 $post_id = $this->throw_if_wp_error(wp_insert_post($post_attributes, true)); 119 return $this->segmented_post_hook($post_id, $post_attributes );123 return $this->segmented_post_hook($post_id, $post_attributes, $params); 120 124 } 121 125 122 function segmented_post_hook($post_id, $post_attributes ) {126 function segmented_post_hook($post_id, $post_attributes, $params) { 123 127 $post = get_post($post_id); 124 128 … … 128 132 $post_attributes['post_title'] = $post_title; 129 133 $post_id = $this->join_segmented_posts($unique_identifier, $post_segment_number, $post, $post_attributes); 134 } 135 136 if($params['post']['featured_image_attachment_id']) { 137 set_post_thumbnail($post_id, $params['post']['featured_image_attachment_id']); 130 138 } 131 139 -
wordable/trunk/includes/connector.php
r2709892 r2713005 24 24 'plugin_version' => WORDABLE_VERSION, 25 25 'wordpress_version' => get_bloginfo('version'), 26 'authors' => $this->serialized_ users(),26 'authors' => $this->serialized_authors(), 27 27 'categories' => $this->serialized_categories(), 28 28 'categories_tree' => $this->serialized_categories_tree(), … … 33 33 } 34 34 35 function serialized_ users() {36 $serialized_ users = array();35 function serialized_authors() { 36 $serialized_authors = array(); 37 37 38 foreach ($this->wordable_plugin-> users() as $user) {39 if ($ user->user_login == "") {38 foreach ($this->wordable_plugin->authors() as $author) { 39 if ($author->author_login == "") { 40 40 continue; 41 41 } 42 42 43 array_push($serialized_ users, "$user->ID:$user->user_login");43 array_push($serialized_authors, "$author->ID:$author->author_login"); 44 44 } 45 45 46 return implode(',', $serialized_ users);46 return implode(',', $serialized_authors); 47 47 } 48 48 -
wordable/trunk/includes/wordable_plugin.php
r2709892 r2713005 5 5 private $api_host_cache; 6 6 private $secret_cache; 7 private $ users_cache;7 private $authors_cache; 8 8 private $categories_cache; 9 9 private $connector_instance; … … 61 61 } 62 62 63 function users() {64 if(!$this-> users_cache) {65 $this-> users_cache = get_users(array(66 'role s_in' => 'author',63 function authors() { 64 if(!$this->authors_cache) { 65 $this->authors_cache = get_users(array( 66 'role__in' => array('author'), 67 67 'fields' => array('ID', 'user_login', 'user_email', 'display_name'), 68 68 'number' => 200 … … 70 70 } 71 71 72 return $this->users_cache; 72 return $this->authors_cache; 73 } 74 75 function user_id_to_be_current() { 76 foreach (array('administrator', 'editor', 'author', 'contributor') as $role) { 77 $users = get_users(array( 78 'role__in' => array('administrator'), 79 'fields' => array('ID', 'user_login', 'user_email', 'display_name'), 80 'number' => 1 81 )); 82 83 if(count($users) == 1) { 84 return $users[0]->ID; 85 } 86 } 73 87 } 74 88 -
wordable/trunk/readme.txt
r2709892 r2713005 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 Stable Tag: 8.0. 49 Stable Tag: 8.0.5 10 10 11 11 This plugin allows you to instantly export Google Docs to WordPress posts or pages. … … 55 55 56 56 == Changelog == 57 58 = 8.0.5 = 59 * Fetching only authors 60 * Not using users to upload images 61 * Set featured image 57 62 58 63 = 8.0.4 = -
wordable/trunk/settings/views/authors.php
r2681615 r2713005 1 <?php $ users = $this->users(); ?>1 <?php $authors = $this->authors(); ?> 2 2 3 <h1 class="heading-4">Authors (<?php echo count($users) ?>)</h1> 4 <ul role="list" class="list w-list-unstyled"> 5 <?php foreach ($users as $user) { ?> 6 <li class='list-item-3'> 7 <div class='w-row'> 8 <div class='w-col w-col-4 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 9 <div class='text-block-5'><?php echo esc_html($user->user_login) ?></div> 3 <h1 class="heading-4">Authors (<?php echo count($authors) ?>)</h1> 4 <div style="max-height: 50vh; overflow-y: auto"> 5 <ul role="list" class="list w-list-unstyled"> 6 <?php foreach ($authors as $author) { ?> 7 <li class='list-item-3'> 8 <div class='w-row'> 9 <div class='w-col w-col-4 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 10 <div class='text-block-5'><?php echo esc_html($author->user_login) ?></div> 11 </div> 12 <div class='w-clearfix w-col w-col-8 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 13 <div class='div-block-5'> 14 <a href='mailto:<?php echo $author->user_email ?>' class='link-block w-inline-block'> 15 <div class='text-block-6'><?php echo esc_html($author->user_email) ?></div> 16 </a> 17 </div> 18 </div> 10 19 </div> 11 <div class='w-clearfix w-col w-col-8 w-col-medium-6 w-col-small-6 w-col-tiny-6'> 12 <div class='div-block-5'> 13 <a href='mailto:<?php echo $user->user_email ?>' class='link-block w-inline-block'> 14 <div class='text-block-6'><?php echo esc_html($user->user_email) ?></div> 15 </a> 16 </div> 17 </div> 18 </div> 19 </li> 20 <?php } ?> 21 </ul> 20 </li> 21 <?php } ?> 22 </ul> 23 </div> -
wordable/trunk/wordable.php
r2709892 r2713005 4 4 * Plugin URI: http://wordable.io 5 5 * Description: This plugin allows you to instantly export Google Docs to WordPress posts or pages. 6 * Version: 8.0. 46 * Version: 8.0.5 7 7 * Author: Wordable 8 8 * Author URI: https://wordable.io 9 9 * Tested up to: 5.9.2 10 10 * Requires at least: 5.0 11 * Stable tag: 8.0. 411 * Stable tag: 8.0.5 12 12 * 13 13 * Wordpress 5.0+ 14 14 */ 15 15 16 define('WORDABLE_VERSION', '8.0. 4');16 define('WORDABLE_VERSION', '8.0.5'); 17 17 18 18 include 'includes/wordable_plugin.php';
Note: See TracChangeset
for help on using the changeset viewer.