Ver = '1.2.3'; $this->Name = 'Announce from the Dashboard'; $this->Dir = plugin_dir_path( __FILE__ ); $this->Url = plugin_dir_url( __FILE__ ); $this->AuthorUrl = 'http://gqevu6bsiz.chicappa.jp/'; $this->ltd = 'afd'; $this->ltd_p = $this->ltd . '_plugin'; $this->RecordName = 'announce_from_the_dashboard'; $this->PageSlug = 'announce_from_the_dashboard'; $this->PluginSlug = dirname( plugin_basename( __FILE__ ) ); $this->Nonces = array( "field" => $this->ltd . '_form_field' , "value" => $this->ltd . '_form_value'); $this->Schema = is_ssl() ? 'https://' : 'http://'; $this->UPFN = 'Y'; $this->DonateKey = 'd77aec9bc89d445fd54b4c988d090f03'; $this->Msg = ''; $this->PluginSetup(); add_action( 'load-index.php' , array( $this , 'FilterStart' ) ); } // PluginSetup function PluginSetup() { // load text domain load_plugin_textdomain( $this->ltd , false , $this->PluginSlug . '/languages' ); load_plugin_textdomain( $this->ltd_p , false , $this->PluginSlug . '/languages' ); // plugin links add_filter( 'plugin_action_links' , array( $this , 'plugin_action_links' ) , 10 , 2 ); // add menu add_action( 'admin_menu' , array( $this , 'admin_menu' ) ); // get donation toggle add_action( 'wp_ajax_afd_get_donation_toggle' , array( $this , 'wp_ajax_afd_get_donation_toggle' ) ); // set donation toggle add_action( 'wp_ajax_afd_set_donation_toggle' , array( $this , 'wp_ajax_afd_set_donation_toggle' ) ); } // Translation File Check function TransFileCk() { $file = false; $moFile = $this->Dir . 'languages/' . $this->ltd . '-' . get_locale() . '.mo'; if( file_exists( $moFile ) ) { $file = true; } return $file; } // PluginSetup function plugin_action_links( $links , $file ) { if( plugin_basename(__FILE__) == $file ) { $mofile = $this->TransFileCk(); if( $mofile == false ) { $translation_link = 'Please translate'; array_unshift( $links, $translation_link ); } $support_link = '' . __( 'Support Forums' ) . ''; array_unshift( $links, $support_link ); array_unshift( $links, '' . __('Settings') . '' ); } return $links; } // PluginSetup function admin_menu() { add_options_page( $this->Name , __( 'Announcement settings for Dashboard' , $this->ltd ), 'administrator' , $this->PageSlug , array( $this , 'setting' ) ); } // SettingPage function setting() { add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) ); $this->DisplayDonation(); include_once 'inc/setting.php'; } // SetList function wp_ajax_afd_get_donation_toggle() { echo get_option( $this->ltd . '_donate_width' ); die(); } // SetList function wp_ajax_afd_set_donation_toggle() { update_option( $this->ltd . '_donate_width' , strip_tags( $_POST["f"] ) ); die(); } // SetList function AllTypes() { $Displaytype = array( 'normal' , 'updated' , 'error' , 'metabox' , 'nonstyle' ); return $Displaytype; } // SetList function get_color( $type ) { $color = ''; if($type == 'normal') { $color = __( 'gray' , $this->ltd ); } else if($type == 'updated') { $mp6 = is_plugin_active('mp6/mp6.php'); if( $mp6 ) { $color = __( 'yellowish green' , $this->ltd ); } else { $color = __( 'yellow' , $this->ltd ); } } else if($type == 'error') { $color = __( 'red' , $this->ltd ); } else if($type == 'metabox') { $color = __( 'gray' , $this->ltd ); } return $color; } // SetList function get_user_role() { $editable_roles = get_editable_roles(); foreach ( $editable_roles as $role => $details ) { $UserRole[$role] = translate_user_role( $details['name'] ); } return $UserRole; } // SetList function get_user_role_group() { $UserRole = ''; $User = wp_get_current_user(); if( !empty( $User->roles ) ) { foreach( $User->roles as $role ) { $UserRole = $role; break; } } return $UserRole; } // GetData function get_data( $user = false ) { $GetData = get_option( $this->RecordName ); $Data = array(); if( !empty( $GetData ) ) { if( !empty( $user ) ) { $SettData = array(); foreach( $GetData as $k => $sett ) { if( array_key_exists( $user , $sett["role"] ) ) { $SettData[] = $sett; } } $Data = $SettData; } else { $Data = $GetData; } } return $Data; } // DataUpdate function DonatingCheck() { $Update = $this->update_validate(); if( !empty( $Update ) ) { if( !empty( $_POST["donate_key"] ) ) { $SubmitKey = md5( strip_tags( $_POST["donate_key"] ) ); if( $this->DonateKey == $SubmitKey ) { update_option( $this->ltd . '_donated' , $SubmitKey ); $this->Msg .= '
' . __( 'Thank you for your donate.' , $this->ltd_p ) . '
' . __( 'Settings saved.' ) . '
' . __( 'Settings saved.' ) . '
%2$s%3$s
' . __( 'Please consider a donate if you are satisfied with this plugin.' , $this->ltd_p ) . ' ' . __( 'Please donate.' , $this->ltd_p ) . '