Changeset 1455865
- Timestamp:
- 07/17/2016 12:35:24 AM (10 years ago)
- Location:
- list-urls/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (1 diff)
-
src/ListUrls/ListUrls.php (modified) (9 diffs)
-
views/list-urls.php (modified) (1 diff)
-
wp-listurls.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
list-urls/trunk/readme.txt
r1445920 r1455865 41 41 == Changelog == 42 42 43 = 0.2 = 44 * Feature: Ability to choose or not if draft or unpublished post should be included 45 * Tweak: Added the post status column 46 43 47 = 0.1.1 = 44 48 * Fix autoloader issue that was crashing the plugin on activation -
list-urls/trunk/src/ListUrls/ListUrls.php
r1445881 r1455865 31 31 } 32 32 33 $this->toCsv( );33 $this->toCsv($_POST); 34 34 exit; 35 35 … … 42 42 * @return bool 43 43 */ 44 protected function toCsv( )44 protected function toCsv($request) 45 45 { 46 46 $types = $this->getPostTypes(); … … 52 52 $csv = Writer::createFromFileObject(new SplTempFileObject()); 53 53 54 $firstRow = ['Page Title','URL','Wordpress Id','Post Type' ];54 $firstRow = ['Page Title','URL','Wordpress Id','Post Type', 'Post Status']; 55 55 56 56 $csv->insertOne($firstRow); … … 63 63 'posts_per_page' => -1 64 64 ); 65 66 if(!isset($request['include_draft'])) 67 { 68 $args['post_status'] = array('publish', 'future', 'private'); 69 } 70 65 71 $query = new WP_Query( $args ); 66 72 if ( $query->have_posts() ) { … … 78 84 $url = get_the_permalink($post->ID); 79 85 $id = $post->ID; 80 $rows[] = [$title,$url,$id,$type->labels->name]; 86 $status = get_post_status($post->ID); 87 $rows[] = [$title,$url,$id,$type->labels->name, $status]; 81 88 82 89 } … … 109 116 $csv->insertAll($rows); 110 117 111 $csv->output( 'export.csv');118 $csv->output($this->getFileName()); 112 119 113 120 return true; … … 115 122 116 123 /** 117 * 124 * Get all the post types available 118 125 * 119 126 * @param … … 131 138 132 139 /** 133 * 140 * Get all the taxonimies available 134 141 * 135 142 * @param … … 145 152 } 146 153 154 /** 155 * 156 * 157 * @param 158 * @return 159 */ 160 protected function getFileName() 161 { 162 $siteName = get_bloginfo('name'); 163 164 if(empty($siteName)) 165 { 166 return 'urlslist.csv'; 167 } 168 169 $siteName = preg_replace('/[^A-Za-z0-9\-\']/', '', $siteName); 170 171 $siteName = str_replace(" ","-", $siteName); 172 173 return $siteName.'-urlslist.csv'; 174 175 } 176 147 177 } -
list-urls/trunk/views/list-urls.php
r1445881 r1455865 3 3 <p>Click the button below to download a csv file or all the URLs on your site. Please note if your site is very large it might take a while to generate the CSV.</p> 4 4 <div> 5 <fieldset><legend class="screen-reader-text"><span>Options</span></legend><label for="include_draft"> 6 <input name="include_draft" type="checkbox" id="include_draft" value="1"> 7 Include draft and unpublished?</label> 8 </fieldset> 5 9 <p> 6 10 <input class="button" id="getUrls" name="wp_list_urls_download" type="submit" value="Download CSV"> -
list-urls/trunk/wp-listurls.php
r1445920 r1455865 4 4 Plugin URI: http://www.graphem.ca 5 5 Description: Get a list of all the current urls of your Wordpress site 6 Version: 0. 1.16 Version: 0.2 7 7 Author: Graphem Solutions Inc. 8 8 Author URI: http://www.graphem.ca
Note: See TracChangeset
for help on using the changeset viewer.