Changeset 791815
- Timestamp:
- 10/22/2013 02:50:55 PM (12 years ago)
- Location:
- polizeipresse/trunk
- Files:
-
- 6 edited
-
Polizeipresse.php (modified) (6 diffs)
-
admin.php (modified) (18 diffs)
-
css/admin.css (modified) (1 diff)
-
i18n/Polizeipresse-de_DE.mo (modified) (previous)
-
i18n/Polizeipresse-de_DE.po (modified) (2 diffs)
-
options.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
polizeipresse/trunk/Polizeipresse.php
r788944 r791815 4 4 Plugin URI: http://wordpress.org/extend/plugins/polizeipresse/ 5 5 Description: The plugin loads police news from German police offices and shows them in your blog. 6 Version: 0.3 6 Version: 0.3a3 7 7 Author: Karsten Strunk 8 8 Author URI: http://www.strunk.eu/wordpress … … 82 82 } 83 83 84 // Copy cron_add_categorie_id to default_category_id. 85 $category_id_old = polizeipresse_get_option(POLIZEIPRESSE_CRON_ADD_CATEGORIE_ID); 86 if ($category_id_old) { 87 polizeipresse_update_option(POLIZEIPRESSE_DEFAULT_CATEGORY_ID, $category_id_old); 88 polizeipresse_delete_option(POLIZEIPRESSE_CRON_ADD_CATEGORIE_ID); 89 } 90 84 91 // 85 92 // End migration … … 194 201 // Do we need to create a new post for this story? 195 202 if ($story_id > $last_story_id) { 196 polizeipresse_add_story($story );203 polizeipresse_add_story($story, $office); 197 204 $max_story_id = $story_id; 198 205 } … … 318 325 /** 319 326 * Internal function: Creates a new post out of story. 320 */ 321 function polizeipresse_add_story($story) { 327 * 328 * @param story Story to add 329 * @param office Number of office 330 */ 331 function polizeipresse_add_story($story, $office) { 322 332 323 333 // Format text … … 337 347 $post_date = (empty($story->published) ? time() : strtotime($story->published)); 338 348 339 // Categorie 340 $post_categorie = polizeipresse_get_option(POLIZEIPRESSE_CRON_ADD_CATEGORIE_ID); 349 // Categorie. Use special category for office or default if none is defined. 350 $post_category = polizeipresse_get_option(POLIZEIPRESSE_OFFICE_CATEGORY_ID . $office); 351 if (empty($post_category) || $post_category == -1) { 352 // Use default category 353 $post_category = polizeipresse_get_option(POLIZEIPRESSE_DEFAULT_CATEGORY_ID); 354 } 341 355 342 356 // User … … 354 368 'post_author' => $post_user, 355 369 'post_type' => 'post', 356 'post_category' => array($post_categor ie)370 'post_category' => array($post_category) 357 371 ); 358 372 $post_id = wp_insert_post($new_post); -
polizeipresse/trunk/admin.php
r788210 r791815 47 47 48 48 for($office = 0; $office < POLIZEIPRESSE_MAX_OFFICE_COUNT; $office++) { 49 50 // Id of office 49 51 $office_id = strip_tags($_POST['office_id' . $office]); 50 52 if (!empty($office_id)) { … … 56 58 } 57 59 60 // Name of office 58 61 $office_name = strip_tags($_POST['office_name' . $office]); 59 62 if (!empty($office_name)) { … … 64 67 $options[POLIZEIPRESSE_CRON_LAST_STORY_ID . $office] = ''; 65 68 } 69 70 // Category for office 71 $office_category_id = strip_tags($_POST['office_category_id' . $office]); 72 if (isset ($office_category_id)) { 73 $options[POLIZEIPRESSE_OFFICE_CATEGORY_ID . $office] = $office_category_id; 74 } 66 75 } 67 76 … … 92 101 } 93 102 94 if (isset ($_POST[' cron_categorie_id'])) {95 $options[POLIZEIPRESSE_ CRON_ADD_CATEGORIE_ID] = strip_tags($_POST['cron_categorie_id']);103 if (isset ($_POST['default_category_id'])) { 104 $options[POLIZEIPRESSE_DEFAULT_CATEGORY_ID] = strip_tags($_POST['default_category_id']); 96 105 } 97 106 … … 194 203 195 204 <tr valign="top"> 196 <t h scope="row">205 <td scope="row" class="label"> 197 206 <label for="api_key"><?php _e('Polizeipresse API key', 'Polizeipresse'); ?>:</lable> 198 </t h>207 </td> 199 208 <td> 200 209 <?php $api_key = polizeipresse_get_option(POLIZEIPRESSE_API_KEY); ?> … … 206 215 for($office = 0; $office < POLIZEIPRESSE_MAX_OFFICE_COUNT; $office++) { 207 216 ?> 208 <tr valign="top" >209 <t h scope="row">210 <label for="office_name 0"><?php _e('Police office', 'Polizeipresse'); ?></lable>211 </t h>217 <tr valign="top" class="officeRow"> 218 <td scope="row" class="label"> 219 <label for="office_name<?php echo $office;?>"><?php _e('Police office', 'Polizeipresse'); ?></lable> 220 </td> 212 221 <td> 213 222 <input name="office_id<?php echo $office;?>" … … 222 231 value="<?php echo polizeipresse_get_option(POLIZEIPRESSE_OFFICE_NAME . $office); ?>" 223 232 type="text" class="regular-text" readonly="readonly" /> 233 </td> 234 <td> 235 236 </td> 237 </tr> 238 <tr> 239 <td> 240 241 </td> 242 <td> 224 243 <button id="searchOfficeDialogButton<?php echo $office;?>" 225 244 class="searchOfficeDialogButton button-secondary" <?php echo (empty($api_key) ? ' disabled="disabled" ' : '') ?>> … … 232 251 </td> 233 252 </tr> 253 <tr> 254 <td scope="row"> 255 <label for="office_category_id<?php echo $office;?>"><?php _e('Category for new posts', 'Polizeipresse'); ?></lable> 256 </td> 257 <td> 258 <?php 259 $current_cat = polizeipresse_get_option(POLIZEIPRESSE_OFFICE_CATEGORY_ID . $office); 260 wp_dropdown_categories("hide_empty=0&name=office_category_id" . $office . "&selected=" . $current_cat . "&show_option_none=Default"); 261 ?> 262 </td> 263 </tr> 234 264 <?php 235 265 } … … 250 280 251 281 <tr valign="top"> 252 <t h scope="row">282 <td scope="row" class="label"> 253 283 <label for="filter_positive"><?php _e('Positive filters', 'Polizeipresse'); ?>:<br/> 254 284 (<?php _e('Separate multiple filters by comma.', 'Polizeipresse'); ?>) 255 285 </lable> 256 </t h>286 </td> 257 287 <td> 258 288 <textarea name="filter_positive" cols="50" rows="5"><?php echo polizeipresse_get_option(POLIZEIPRESSE_FILTER_POSITIVE); ?></textarea> … … 261 291 262 292 <tr valign="top"> 263 <t h scope="row">293 <td scope="row" class="label"> 264 294 <label for="filter_negative"><?php _e('Negative filters', 'Polizeipresse'); ?>:<br/> 265 295 (<?php _e('Separate multiple filters by comma.', 'Polizeipresse'); ?>) 266 296 </lable> 267 </t h>297 </td> 268 298 <td> 269 299 <textarea name="filter_negative" cols="50" rows="5"><?php echo polizeipresse_get_option(POLIZEIPRESSE_FILTER_NEGATIVE); ?></textarea> … … 285 315 286 316 <tr valign="top"> 287 <t h scope="row">317 <td scope="row" class="label"> 288 318 <label for="cron"><?php _e('Enable cronjob', 'Polizeipresse'); ?>:</lable> 289 </t h>319 </td> 290 320 <td> 291 321 <input type="checkbox" name="cron_enabled" value="true" <?php echo (polizeipresse_is_cron_enabled()) ? 'checked' : ''; ?> > … … 294 324 295 325 <tr valign="top"> 296 <t h scope="row">326 <td scope="row" class="label"> 297 327 <label for="cron_user_id"><?php _e('User for new posts', 'Polizeipresse'); ?>:</lable> 298 </t h>328 </td> 299 329 <td> 300 330 <?php … … 306 336 307 337 <tr valign="top"> 308 <t h scope="row">309 <label for="cron_categorie_id"><?php _e(' Category for new posts', 'Polizeipresse'); ?>:</lable>310 </t h>311 <td> 312 <?php 313 $current_cat = polizeipresse_get_option(POLIZEIPRESSE_ CRON_ADD_CATEGORIE_ID);314 wp_dropdown_categories("hide_empty=0&name= cron_categorie_id&selected=" . $current_cat . "&show_option_none=Keine");315 ?> 316 </td> 317 </tr> 318 319 <tr valign="top"> 320 <t h scope="row">338 <td scope="row" class="label"> 339 <label for="cron_categorie_id"><?php _e('Default category for new posts', 'Polizeipresse'); ?>:</lable> 340 </td> 341 <td> 342 <?php 343 $current_cat = polizeipresse_get_option(POLIZEIPRESSE_DEFAULT_CATEGORY_ID); 344 wp_dropdown_categories("hide_empty=0&name=default_category_id&selected=" . $current_cat . "&show_option_none=Keine"); 345 ?> 346 </td> 347 </tr> 348 349 <tr valign="top"> 350 <td scope="row" class="label"> 321 351 <label for="cron_add_publish"><?php _e('Publish new posts immediately', 'Polizeipresse'); ?>:</lable> 322 </t h>352 </td> 323 353 <td> 324 354 <input type="checkbox" name="cron_add_publish" value="true" <?php echo polizeipresse_get_option(POLIZEIPRESSE_CRON_ADD_PUBLISH) ? 'checked' : ''; ?> > … … 327 357 328 358 <tr valign="top"> 329 <t h scope="row">359 <td scope="row" class="label"> 330 360 <label for="cron_notify"><?php _e('Notify on new stories', 'Polizeipresse'); ?>:</lable> 331 </t h>361 </td> 332 362 <td> 333 363 <input type="checkbox" name="cron_notify" value="true" <?php echo polizeipresse_get_option(POLIZEIPRESSE_CRON_NOTIFY) ? 'checked' : ''; ?> > … … 339 369 ?> 340 370 <tr valign="top"> 341 <t h scope="row">371 <td scope="row" class="label"> 342 372 <label for="cron_last_story_id<?php echo $office;?>"> 343 373 <?php … … 349 379 echo "(" . $office_name . ")"; 350 380 ?>:</lable> 351 </t h>381 </td> 352 382 <td> 353 383 <input name="cron_last_story_id<?php echo $office;?>" size="10" … … 355 385 type="text" 356 386 readonly="readonly" /> 387 </td> 357 388 </tr> 358 389 <?php … … 360 391 ?> 361 392 <tr valign="top"> 362 <t h scope="row">393 <td scope="row" class="label"> 363 394 <label"><?php _e('Last cron execution time', 'Polizeipresse'); ?>:</lable> 364 </t h>395 </td> 365 396 <td> 366 397 <?php -
polizeipresse/trunk/css/admin.css
r511342 r791815 80 80 font-weight: bold; 81 81 } 82 83 #PolizeipresseTabGeneral { 84 } 85 86 #PolizeipresseTabGeneral .label { 87 width: 30ex; 88 } 89 90 #PolizeipresseTabGeneral .officeRow { 91 border-top: 1px solid #000000; 92 } 93 94 #PolizeipresseTabFilter { 95 } 96 97 #PolizeipresseTabFilter .label { 98 width: 40ex; 99 } 100 101 #PolizeipresseTabCron { 102 } 103 104 #PolizeipresseTabCron .label { 105 width: 50ex; 106 } -
polizeipresse/trunk/i18n/Polizeipresse-de_DE.po
r788212 r791815 15 15 "X-Poedit-SearchPath-0: .\n" 16 16 17 #: admin.php:14 17 18 18 msgid "Polizeipresse plugin: Please enter API key select police office" 19 19 msgstr "Polizeipresse plugin: Bitte API-Schlüssel eingeben und Dienststellen auswählen." 20 20 21 #: admin.php:105 21 22 22 msgid "Your settings have been saved." 23 23 msgstr "Ihre Einstellungen wurden gespeichert." 24 24 25 #: admin.php:114 25 26 26 msgid "Stories have been loaded." 27 27 msgstr "Meldungen wurden geladen." 28 28 29 #: admin.php:125 29 30 30 msgid "Last processed story id has been reset." 31 31 msgstr "Zuletzt verarbeitete Meldungs-ID wurde zurückgesetzt." 32 32 33 #: admin.php:144 33 34 34 msgid "Options" 35 35 msgstr "Optionen" 36 36 37 #: admin.php:149 37 38 38 msgid "General" 39 39 msgstr "Allgemein" 40 40 41 #: admin.php:150 41 42 42 msgid "Filter" 43 43 msgstr "Filter" 44 44 45 #: admin.php:151 45 46 46 msgid "Cronjob" 47 47 msgstr "Cronjob" 48 48 49 #: admin.php:160 49 50 50 msgid "This page contains fundamental plugin settings. Without API key and office id the plugin is unable to work." 51 51 msgstr "Auf dieser Seite legen Sie grundlegende Einstellungen des Plugins fest. Ohne API-Schlüssel und ausgewählte Dienststelle funktioniert das Plugin nicht." 52 52 53 #: admin.php:162 53 54 54 msgid "If you do not have an API key, please register on the following page to get one" 55 55 msgstr "Wenn Sie noch keinen API-Schlüssel haben, können Sie diesen auf der folgenden Seite bekommen" 56 56 57 #: admin.php:163 57 58 58 msgid "Click here" 59 59 msgstr "Hier clicken" 60 60 61 #: admin.php:170 61 62 62 msgid "Polizeipresse API key" 63 63 msgstr "Polizeipresse API-Schlüssel" 64 64 65 #: admin.php:180 65 66 66 msgid "Police office" 67 67 msgstr "Polizeidienststelle" 68 68 69 #: admin.php:188 70 #: admin.php:337 69 70 71 71 msgid "Search for offices" 72 72 msgstr "Nach Polizeistationen suchen" 73 73 74 #: admin.php:337 74 75 75 msgid "Remove office" 76 76 msgstr "Polizeistationen löschen" 77 77 78 #: admin.php:201 78 79 79 msgid "On this page you can define filters. These filteres are used to filter police stories. Multiple filters can be separated by comma." 80 80 msgstr "Auf dieser Seite können Sie Filter definieren. Diese Filter werden verwendet, um Polizeimeldungen zu filtern. Mehrere Filter können durch Komma getrennt werden." 81 81 82 #: admin.php:208 82 83 83 msgid "Positive filters" 84 84 msgstr "Positive Filter" 85 85 86 #: admin.php:209 87 #: admin.php:220 86 87 88 88 msgid "Separate multiple filters by comma." 89 89 msgstr "Mehrere Filter durch Komma trennen" 90 90 91 #: admin.php:219 91 92 92 msgid "Negative filters" 93 93 msgstr "Negative Filter" 94 94 95 #: admin.php:236 95 96 96 msgid "New police stories can be automatically loaded and added to your blog. This is done every hour." 97 97 msgstr "Neue Polizeimeldungen können automatisch abgefragt und zu Ihrem Blog hinzugefügt werden. Die Abfrage geschieht stündlich." 98 98 99 #: admin.php:243 99 100 100 msgid "Enable cronjob" 101 101 msgstr "Cronjob einschalten" 102 102 103 #: admin.php:252 103 104 104 msgid "User for new posts" 105 105 msgstr "Benutzer für neue Artikel" 106 106 107 #: admin.php:264 107 108 108 msgid "Category for new posts" 109 109 msgstr "Kategorie für neue Artikel" 110 110 111 #: admin.php:276 111 112 msgid "Default category for new posts" 113 msgstr "Default-Kategorie für neue Artikel" 114 115 112 116 msgid "Publish new posts immediately" 113 117 msgstr "Neue Meldungen sofort veröffentlichen" 114 118 115 #: admin.php:285 119 116 120 msgid "Notify on new stories" 117 121 msgstr "Alarmierung bei neuen Meldungen" 118 122 119 #: admin.php:294 123 120 124 msgid "Last processed story id" 121 125 msgstr "Letzte verarbeitete Meldungs-ID" … … 124 128 msgstr "Letzt Ausführung des Cronjobs" 125 129 126 #: admin.php:303 127 #: admin.php:311 130 131 128 132 msgid "unknown" 129 133 msgstr "unbekannt" 130 134 131 #: admin.php:311 135 132 136 msgid "Date/time" 133 137 msgstr "Datum/Uhrzeit" 134 138 135 #: admin.php:311 139 136 140 msgid "State" 137 141 msgstr "Status" 138 142 139 #: admin.php:311 143 140 144 msgid "successfull" 141 145 msgstr "erfolgreich" 142 146 143 #: admin.php:318 147 144 148 msgid "Load stories now" 145 149 msgstr "Jetzt neue Meldungen laden" 146 150 147 #: admin.php:320 151 148 152 msgid "Reset last processed story id" 149 153 msgstr "Zuletzt verarbeitete Meldungs-ID zurücksetzen" 150 154 151 #: admin.php:329 155 152 156 msgid "Save all" 153 157 msgstr "Alles speichern" 154 158 155 #: admin.php:341 159 156 160 msgid "You can search for German police offices here. Start the search and select one item from the result list. Press apply to accept." 157 161 msgstr "Sie können hier nach deutschen Polizeidienststellen suchen. Nach der Suche wählen sie eine Dienststelle aus und drücken 'übernehmen'." 158 162 159 #: admin.php:346 163 160 164 msgid "Search terms" 161 165 msgstr "Suche" 162 166 163 #: admin.php:355 167 164 168 msgid "Search" 165 169 msgstr "Suchen" 166 170 167 #: admin.php:357 171 168 172 msgid "Cancel" 169 173 msgstr "Abbrechen" 170 174 171 #: admin.php:364 175 172 176 msgid "Search result" 173 177 msgstr "Suchergebnis" 174 178 175 #: admin.php:368 179 176 180 msgid "Apply" 177 181 msgstr "Übernehmen" 178 182 179 #: admin.php:410 183 180 184 msgid "No result from server." 181 185 msgstr "Keine Dienststelle gefunden." 182 186 183 #: admin.php:411 187 184 188 msgid "An error occurred" 185 189 msgstr "Ein unbekannter Fehler ist aufgetreten." 186 190 187 #: admin.php:412 191 188 192 msgid "Please enter API key" 189 193 msgstr "Bitte API-Schlüssel eingeben" 190 194 191 #: admin.php:413 195 192 196 msgid "Please select police office" 193 197 msgstr "Bitte Dienststelle auswählen" 194 198 195 #: Polizeipresse.php:294 199 196 200 msgid "Source" 197 201 msgstr "Quelle" 198 202 199 #: Polizeipresse.php:329 203 200 204 msgid "Polizeipresse: New post added" 201 205 msgstr "Polizeipresse: Neuen Artikel hinzugefügt" 202 206 203 #: Polizeipresse.php:330 207 204 208 msgid "URL to admin page" 205 209 msgstr "URL zur Admin-Seite" 206 210 207 #: widget.php:28 211 208 212 msgid "Displays latest police stories" 209 213 msgstr "Zeigt aktuelle Polizeimeldungen" 210 214 211 #: widget.php:85 215 212 216 msgid "No stories" 213 217 msgstr "Keine Meldungen vorhanden" 214 218 215 #: widget.php:112 219 216 220 msgid "Latest police stories" 217 221 msgstr "Letzte Polizeimeldungen" 218 222 219 #: widget.php:121 223 220 224 msgid "Title" 221 225 msgstr "Titel" 222 226 223 #: widget.php:128 227 224 228 msgid "Story count" 225 229 msgstr "Anzahl Meldungen" 226 230 227 #: widget.php:140 231 228 232 msgid "Show date" 229 233 msgstr "Datum anzeigen" 230 234 231 #: widget.php:147 235 232 236 msgid "Cache timeout" 233 237 msgstr "Cache-Timeout" 234 238 235 #: widget.php:149 239 236 240 msgid "minute" 237 241 msgstr "Minute" 238 242 239 #: widget.php:150 240 #: widget.php:151 241 #: widget.php:152 242 #: widget.php:153 243 244 245 246 243 247 msgid "minutes" 244 248 msgstr "Minuten" 245 249 246 #: widget.php:154 250 247 251 msgid "hour" 248 252 msgstr "Stunde" 249 253 250 #: widget.php:155 254 251 255 msgid "hours" 252 256 msgstr "Stunden" -
polizeipresse/trunk/options.php
r788944 r791815 9 9 define('POLIZEIPRESSE_OFFICE_ID', 'office_id'); // Old option. Needed for version 0.2 and below. Will be migrated. 10 10 define('POLIZEIPRESSE_OFFICE_NAME', 'office_name'); // Old option. Needed for version 0.2 and below. Will be migrated. 11 define('POLIZEIPRESSE_CRON_ADD_CATEGORIE_ID', 'cron_add_categorie_id'); // Old option. Needed for version 0.2 and below. Will be migrated. 11 12 12 13 for($office = 0; $office < POLIZEIPRESSE_MAX_OFFICE_COUNT; $office++) { … … 14 15 define('POLIZEIPRESSE_OFFICE_NAME' . $office, 'office_name' . $office); 15 16 define('POLIZEIPRESSE_CRON_LAST_STORY_ID' . $office, 'cron_last_story_id' . $office); 17 define('POLIZEIPRESSE_OFFICE_CATEGORY_ID' . $office, 'office_category_id' . $office); 16 18 } 17 19 20 define('POLIZEIPRESSE_DEFAULT_CATEGORY_ID', 'default_category_id'); 18 21 define('POLIZEIPRESSE_FILTER_POSITIVE', 'filter_positive'); 19 22 define('POLIZEIPRESSE_FILTER_NEGATIVE', 'filter_negative'); … … 25 28 define('POLIZEIPRESSE_CRON_NOTIFY', 'cron_add_notify'); 26 29 define('POLIZEIPRESSE_CRON_ADD_USER_ID', 'cron_add_user_id'); 27 define('POLIZEIPRESSE_CRON_ADD_CATEGORIE_ID', 'cron_add_categorie_id');28 30 29 31 … … 35 37 polizeipresse_update_option(POLIZEIPRESSE_OFFICE_ID, ''); // Old option. Needed for version 0.2 and below. Will be migrated. 36 38 polizeipresse_update_option(POLIZEIPRESSE_OFFICE_NAME, ''); // Old option. Needed for version 0.2 and below. Will be migrated. 39 polizeipresse_update_option(POLIZEIPRESSE_DEFAULT_CATEGORY_ID, ''); 37 40 polizeipresse_update_option(POLIZEIPRESSE_FILTER_POSITIVE, ''); 38 41 polizeipresse_update_option(POLIZEIPRESSE_FILTER_NEGATIVE, ''); … … 50 53 polizeipresse_update_option(POLIZEIPRESSE_OFFICE_NAME . $office, ''); 51 54 polizeipresse_update_option(POLIZEIPRESSE_CRON_LAST_STORY_ID . $office, ''); 55 polizeipresse_update_option(POLIZEIPRESSE_OFFICE_CATEGORY_ID . $office, ''); 52 56 } 53 57 }
Note: See TracChangeset
for help on using the changeset viewer.