Skip to content

Instantly share code, notes, and snippets.

Alfasado Inc. alfasado

Block or report user

Report or block alfasado

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alfasado
alfasado / mt-tool-speed-rebuild
Last active Apr 4, 2016
Alternative script of MT::Worker::Publish.
View mt-tool-speed-rebuild
#!/usr/bin/perl
package MT::Tool::SpeedRebuild;
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 );
use MT::FileMgr;
use MT::Util qw( log_time );
@alfasado
alfasado / mt-tool-rebuild-file
Created Feb 18, 2016
Run MT::Worker::Publish specify the file path or template_id.
View mt-tool-rebuild-file
#!/usr/bin/perl
package MT::Tool::RebuildFile;
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 );
use MT::Util qw( log_time );
sub usage { '--file /path/to/file or or --template_id n' }
@alfasado
alfasado / mt-plugin-http-https-transfer.php
Created Apr 2, 2014
mt/plugins/HttpHttpsTransfer/php/config.php
View mt-plugin-http-https-transfer.php
<?php
class HttpHttpsTransfer extends MTPlugin {
var $registry = array(
'config_settings' => array(
'HttpHttpsTransferPathBegin' => array( 'default' => '/entry_form/' ),
),
'callbacks' => array(
'post_init' => 'post_init',
),
);
@alfasado
alfasado / mt-plugin-rewritearchiver.php
Last active Aug 29, 2015
mt/plugin/RewriteArchiver/php/config.php
View mt-plugin-rewritearchiver.php
<?php
class RewriteArchiver extends MTPlugin {
var $registry = array(
'config_settings' => array(
'RewriteArchiverRewriteTo' => array( 'default' => '/archiver.html' ),
),
'callbacks' => array(
'post_init' => 'rewrite_archiver',
),
);
View mt-plugin-get-epoc
tags:
function:
GetEpoc: sub{return time}
View mt-plugin-garbage-cleaner
name: Garbage Cleaner
id: GarbageCleaner
version: 0.1
callbacks:
MT::FileInfo::post_remove: >
sub {
my ( $cb, $obj ) = @_;
my $path = $obj->file_path;
require MT::FileMgr;
my $fmgr = MT::FileMgr->new( 'Local' )
View mt-plugin-get-list-files
name: GetListFiles
id: GetListFiles
version: 0.1
applications:
cms:
methods:
get_listfiles: >
sub {
my $app = shift;
if (! $app->user->is_superuser ) {
View powercms-plugin-import-check
name: ImportCheck
id: ImportCheck
version: 0.1
config_settings:
EntryPathCustomFieldBasename:
default: orig_entry_path
PagePathCustomFieldBasename:
default: orig_page_path
callbacks:
cms_post_import.entry: >
View Callbacks.pm(Old)
package MAUS::Callbacks;
use strict;
sub _data_api_pre_save_entry {
my ( $cb, $app, $obj, $original ) = @_;
my $entry = $app->param( 'entry' );
$entry = MT::DataAPI::Format::JSON::unserialize( $entry );
if ( $entry->{ 'convert_breaks' } ) {
$obj->convert_breaks( lc( $entry->{ 'convert_breaks' } ) );
}
View config.yaml
id: MAUS
name: MAUS
key: maus
description: <__trans phrase="Set text format to Markdown(Post by MAUS).">
version: 0.1
author_name: Alfasado Inc.
author_link: http://alfasado.net/
l10n_class: MAUS::L10N
callbacks:
data_api_pre_save.entry: $maus::MAUS::Callbacks::_data_api_pre_save_entry
You can’t perform that action at this time.