This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
package MT::Tool::RevertToThePrevious; | |
use strict; | |
use warnings; | |
use File::Spec; | |
use FindBin; | |
use lib map File::Spec->catdir( $FindBin::Bin, File::Spec->updir, $_ ), | |
qw/lib extlib/; | |
use base qw( MT::Tool ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tags: | |
modifier: | |
remove_ignore: > | |
sub { | |
my ( $text, $arg ) = @_; | |
$text =~ s/<mt:{0,1}ignore>.*?<\/mt:{0,1}ignore>//gsi; | |
if ( $arg ne '1' ) { | |
my $comment = quotemeta( '<!--' ); | |
my $comment_end = quotemeta( '-->' ); | |
$text =~ s/$comment.*?$comment_end//sg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub save { | |
my $proxy = shift; | |
# perl funkiness ... keys %{ $proxy->{__objects} } will automatically clobber | |
# empty hash reference on that key! | |
return unless $proxy->{__objects}; | |
my @cols = qw( type vchar vchar_idx vdatetime | |
vdatetime_idx vinteger vinteger_idx vfloat | |
vfloat_idx vblob vclob ); | |
my $od = lc( MT->config( 'ObjectDriver' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
callbacks: | |
cms_save_filter.page: > | |
sub { | |
my ( $cb, $app ) = @_; | |
if ( ( $app->param( 'category_ids' ) eq '-1' ) && | |
( $app->param( 'basename' ) eq 'index' ) ) { | |
return $cb->error( $app->translate( 'File [_1] exists; could not overwrite.', | |
$app->translate( 'Main Index' ) ) ); | |
} | |
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
callbacks: | |
MT::App::CMS::template_param.edit_entry: > | |
sub { | |
my ( $cb, $app, $param, $tmpl ) = @_; | |
if ( $param->{ id } ) { | |
my $title_tags = $tmpl->getElementsByName( 'page_title' ); | |
for my $tag ( @$title_tags ) { | |
my $value = $tag->getAttribute( 'value' ); | |
my $title = $param->{ title }; | |
$title = MT::Util::encode_html( $title ) if $title; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once( 'MTUtil.php' ); | |
class EntriesFromRSS extends MTPlugin { | |
var $registry = array( | |
'config_settings' => array( | |
'RewriteArchiverRewriteTo' => array( 'default' => '/archiver.html' ), | |
), | |
'callbacks' => array( | |
'post_init' => 'rewrite_archiver', | |
), |