Editorial Workflows

Wordpress

unlisted workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Wysyłanie i podmiana wpisów w Wordpessie

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Podaj dane Wordpressa ?
Lista wpisów ?
Title
Wybierz wpis lub kontynuuj jeśli nowy
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
OFF
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show Alert ?
Title
Uwaga, czy na pewno chcesz dodać nowy wpis?
Message
Input
Button 1
Tak
Output Value
Input
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show Alert ?
Title
Uwaga, czy na pewno chcesz zmienić wpis o tytule:
Message
Input
Button 1
OK
Output Value
Input
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
…End If
Run Python Script ?
Source Code
#coding: utf-8
import workflow, datetime, xmlrpclib, time

select = workflow.get_input()
id = workflow.get_variable('id').split(',')
lista = workflow.get_variable('lista').split('\n')

postid = ''
for loop in range(0, len(id)):
	if lista[loop] == select: postid = id[loop]


#pobranie danych z workflow
wp_url = workflow.get_variable('wp_url')
wp_username = workflow.get_variable('wp_username')
wp_password = workflow.get_variable('wp_password')

#Pobranie treści z workflow
title = workflow.get_variable('title')
date = workflow.get_variable('date')
slug = workflow.get_variable('slug')
md = workflow.get_variable('md')
status = workflow.get_variable('status')


#Połączenie z serwerem
server = xmlrpclib.ServerProxy(wp_url)

#Przeliczanie czasu uwzgledniającego UTC i czas letni
offset = time.timezone if (time.localtime().tm_isdst == 0) else time.altzone
czas = time.mktime(datetime.datetime.strptime(date, "%Y-%m-%d %H:%M").timetuple())
czas = czas + offset
date_created = xmlrpclib.DateTime(czas)


categories = [""]
tags = [""]

#Ustalenie statusu publikacji wpisu
post_status = 'draft'
if status == 'publish': post_status = 'publish'
if status == 'private': post_status = 'private'

data = {'title': title, 'description': md.encode('utf-8'), 'date_created_gmt': date_created, 'categories': categories, 'mt_keywords': tags, 'post_status': post_status, 'wp_slug': slug}

wp_blogid = ""

if postid != '':
	post_id = server.metaWeblog.editPost(postid, wp_username, wp_password, data)
else:
	post_id = server.metaWeblog.newPost(wp_blogid, wp_username, wp_password, data)

if post_id: workflow.set_output('sukces')
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
sukces
Show HUD ?
HUD Text
Zakończone pomyślnie.
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
sukces
Show HUD ?
HUD Text
Niestety, nie udało się!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Play Sound Effect ?
Effect
Error
Wait until Finished
OFF
…End If