@Ghazascanner
_2019runbot
Ghazascanner File Manager
server :Linux phosweb012 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
Current Path :
/
homepage
/
v-mt
/
extras
/
examples
/
plugins
/
mirror
/
Path :
Upload File :
New :
File
Dir
/homepage/v-mt/extras/examples/plugins/mirror/mirror.pl
# Movable Type (r) (C) 2005-2008 Six Apart, Ltd. All Rights Reserved. # This code cannot be redistributed without permission from www.sixapart.com. # For more information, consult your Movable Type license. # # $Id: mirror.pl 1174 2008-01-08 21:02:50Z bchoate $ use strict; my $PLUGIN_NAME = "Mirror"; sub replicate { my ($cb, $entry) = @_; if (!$entry->id) { # If it's a new post, if ($entry->blog_id == 3) { # on my blog use XML::Atom; use XML::Atom::Entry; use XML::Atom::Client; my $atom_entry = new XML::Atom::Entry; $atom_entry->title($entry->title); $atom_entry->content($entry->text); my $atom_client = new XML::Atom::Client; $atom_client->username('Melody'); $atom_client->password('waSiIiKV27v..'); my $post_endpt = 'http://koro:4141/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=6'; $atom_client->createEntry($post_endpt, $atom_entry); if ($atom_client->errstr()) { return $cb->error($atom_client->errstr()); } else { return 1; } } else { return 1; } } } require MT::Plugin; my $plugin = new MT::Plugin(name => $PLUGIN_NAME, dir_name => 'mirror', description => "Replicates each post you make to another weblog using Atom.", config_link => "mt-mirror.cgi"); MT->model('entry')->add_callback("pre_save", 9, $plugin, \&replicate); MT->add_plugin($plugin); # Return the return value of MT->add_plugin so that we'll be disabled # if add_plugin chooses to disable us.