[ Index ] |
MailPress 7.2 |
[ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] [ Statistics ] |
[Summary view] [Print] [Text view]
1 <?php 2 class MP_AdminPage extends MP_WP_Admin_page_ 3 { 4 const screen = 'mailpress_page_templates'; 5 const capability = 'MailPress_manage_forms'; 6 const help_url = 'http://blog.mailpress.org/tutorials/add-ons/form/'; 7 const file = __FILE__; 8 9 //// Redirect //// 10 11 public static function redirect() 12 { 13 $action = parent::redirect(); 14 if ( !$action ) return; 15 16 switch( $action ) 17 { 18 case 'update' : 19 20 $template = self::$pst_['template']; 21 22 $advanced_path = 'advanced/' . get_current_blog_id() . '/forms'; 23 $root = MP_UPL_ABSPATH . $advanced_path; 24 $root = apply_filters( 'MailPress_advanced_forms_root', $root ); 25 $root .= '/templates'; 26 $template_file = "$root/$template.xml"; 27 28 $args['action'] = 'edit'; 29 $args['template']= $template; 30 $args['message'] = 2; 31 32 $xml = stripslashes( self::$pst_['newcontent'] ); 33 34 if ( !simplexml_load_string( $xml ) ) 35 { 36 $args['message'] = 3; 37 } 38 elseif ( file_put_contents( $template_file, $xml ) ) 39 { 40 $args['message'] = 1; 41 } 42 self::mp_redirect( self::url( MailPress_templates, $args ) ); 43 break; 44 case 'toedit' : 45 $template = self::$pst_['template']; 46 $args['action'] = 'edit'; 47 $args['template']= $template; 48 self::mp_redirect( self::url( MailPress_templates, $args ) ); 49 break; 50 } 51 } 52 53 //// Title //// 54 55 public static function title() 56 { 57 global $title; 58 $title = __( 'MailPress Forms Templates', 'MailPress' ); 59 } 60 61 //// Styles //// 62 63 public static function print_styles( $s ) 64 { 65 $styles = ( is_array( $s ) ) ? $s : array(); 66 67 wp_register_style( self::screen, '/' . MP_PATH . 'mp-admin/css/form_templates.css' ); 68 $styles[] = self::screen; 69 70 parent::print_styles( $styles ); 71 } 72 73 //// Scripts //// 74 75 public static function print_scripts( $scripts = array() ) 76 { 77 $localize = array( 'cm_url' => site_url() . '/' . MP_PATH . 'mp-includes/js/codemirror/' ); 78 79 wp_register_script( 'mp-codemirror','/' . MP_PATH . 'mp-includes/js/codemirror/js/codemirror.js', false, false, 1 ); 80 81 wp_register_script( self::screen, '/' . MP_PATH . 'mp-admin/js/form_templates.js', array( 'mp-codemirror' ), false, 1 ); 82 wp_localize_script( self::screen, 'adminCodeMirrorL10n', $localize ); 83 84 $scripts[] = self::screen; 85 parent::print_scripts( $scripts ); 86 } 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue May 19 15:55:14 2020 | Cross-referenced by PHPXref 0.7.1 |