Plugin Directory

Changeset 654989


Ignore:
Timestamp:
01/18/2013 06:15:04 PM (13 years ago)
Author:
anildhiman
Message:

added new admin area for settings

Location:
mj-contact-us/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • mj-contact-us/trunk/css/mj.css

    r647410 r654989  
    137137.h-71{  height:71px;}
    138138#mailform .w-16{width: 16px;}
     139.p-12{padding: 12px;}
     140.h-43{height:43px;}
     141.h-100{height:100px;}
     142.f-13{font-size:13px;}
  • mj-contact-us/trunk/files/includes.php

    r647410 r654989  
    11<?php
     2
     3ob_start();
     4$upload_dir =   wp_upload_dir();
     5/* defined variables */
     6$atn    =   (isset($_REQUEST['atn'])) ? $_REQUEST['atn'] :  '';
     7DEFINE('NAME', 'mj-contact-us');
     8DEFINE('IMGPATH' , plugins_url('/'.NAME.'/images/'));
     9DEFINE('CSSPATH' , plugins_url('/'.NAME.'/css/mj.css'));
     10DEFINE('URL' , admin_url('admin.php?page=mj-mainpage'));
     11DEFINE('ACTION' , $atn);
     12
    213include( plugin_dir_path( __FILE__ ) . '/mj-class-process.php');
    3 include( plugin_dir_path( __FILE__ ) . '/mj-class-html.php');
     14include( plugin_dir_path( __FILE__ ) . '/mj-class-html.php');
     15
    416?>
  • mj-contact-us/trunk/files/mj-class-html.php

    r647410 r654989  
    1919           
    2020            <div id="container">
    21             <h3 id="reply-title">Contact US</h3>
     21            <h3 id="reply-title"><?php _e('Contact US') ;?></h3>
    2222           
    2323           
    2424            <form action="<?php echo get_permalink($post->ID); ?>" method="post" id="mailform">
    2525                <div class="h-71">
    26                     <label for="name">Name</label>
    27                     <input required name="uname" id="uname" type="name" aria-required="true" >
     26                    <label for="name"><?php _e('Name') ;?><?php echo (get_option('MJname')==1)? "*" : "";?></label>
     27                    <input  <?php echo (get_option('MJname')==1)? "required='required'" : "";?> name="uname" id="uname" type="name" aria-required="true" >
    2828                   
    2929                </div>
    3030                <div class="h-71">
    31                     <label for="email">E-mail</label>
    32                     <input id="email" required name="email" type="email" aria-required="true">
     31                    <label for="email"><?php _e('E-mail') ;?><?php echo (get_option('MJemail')==1)? "*" : "";?></label>
     32                    <input id="email" <?php echo (get_option('MJemail')==1)? "required" : "";?> name="email" type="email" aria-required="true">
    3333                   
    3434                </div>
    3535                <div class="h-71">
    36                     <label for="subject">Subject</label>
    37                     <input id="subject" name="subject" required type="subject" size="30" aria-required="true">
     36                    <label for="subject"><?php _e('Subject') ;?><?php echo (get_option('MJsubject')==1)? "*" : "";?></label>
     37                    <input id="subject" <?php echo (get_option('MJsubject')==1)? "required" : "";?> name="subject" type="subject" size="30" aria-required="true">
    3838                   
    3939                </div>
    4040                <div class="h-71">
    41                     <label for="url">Website</label>
    42                     <input id="url" required name="url" type="url" value=""  aria-required="true">
     41                    <label for="url"><?php _e('Website') ;?><?php echo (get_option('MJwebsite')==1)? "*" : "";?></label>
     42                    <input id="url" <?php echo (get_option('MJwebsite')==1)? "required" : "";?> name="url" type="url" value=""  aria-required="true">
    4343                </div>
    4444                <div class="h-134">
    45                     <label for="message">Comment</label>
    46                     <textarea id="comment" name="comment" required cols="" rows=""></textarea>
     45                    <label for="message"><?php _e('Comment') ;?><?php echo (get_option('MJcomment')==1)? "*" : "";?></label>
     46                    <textarea id="comment" name="comment" <?php echo (get_option('MJcomment')==1)? "required" : "";?> cols="" rows=""></textarea>
    4747                </div>
     48                <?php if(get_option('MJcopytome')==1):?>
    4849                <div class="h-71">
    49                     <label for="message">Send copy to me</label>
     50                    <label for="message"><?php _e('Send copy to me') ;?></label>
    5051                    <input type="checkbox" name="copytome" class="w-16" id="copytome" value="1">
    5152                </div>
    52                
     53                <?php endif; ?>
    5354                <div>
    54                     <input name="mj_submit" type="submit" id="submit" value="Send">
     55                    <input name="mj_submit" type="submit" id="submit" value="<?php _e('Send') ;?>">
    5556                    <input type="hidden" name="mj_submit" value="active">
    5657                    <input type="hidden" name="page_id" value="<?php echo $post->ID; ?>">
     
    6263       
    6364    }
     65    function AdminOption(){ ?>
     66        <div id="wrap">
     67            <div id="container">
     68                <h3 id="reply-title"><?php _e('Contact US Page Settings') ;?></h3>
     69                <form action="" method="post" id="mailform">
     70                    <div class="h-43">
     71                        <label for="name"><?php _e('Email Address to recieve Email address') ;?></label>
     72                        <input name="MJmailto" class="f-13" id="mailto" type="text" aria-required="true" value="<?php echo get_option('MJmailto');?>" >
     73                        <small><i><?php _e('if blank then default mail will goes on '.get_option('admin_email'));?></i></small>
     74                    </div>
     75                    <div class="h-43">
     76                        <label for="name"><?php _e('Copy to me') ;?></label>
     77                        <input type="checkbox" class="w-16" name="MJcopytome" <?php echo (get_option('MJcopytome')==1)? "checked='checked'" : "";?> value="1"> <?php _e('Enable this option ?'); ?>
     78                    </div>
     79                    <div class="h-100">
     80                        <label for="name"><?php _e('Other options') ;?></label>
     81                        <input type="checkbox" class="w-16" name="MJname" <?php echo (get_option('MJname')==1)? "checked='checked'" : "";?> value="1"><?php _e(' - Required Name ?') ;?><br/>
     82                        <input type="checkbox" class="w-16" name="MJemail" <?php echo (get_option('MJemail')==1)? "checked='checked'" : "";?> value="1"><?php _e(' - Required Email ?') ;?><br/>
     83                        <input type="checkbox" class="w-16" name="MJsubject" <?php echo (get_option('MJsubject')==1)? "checked='checked'" : "";?> value="1"><?php _e(' - Required Subject ?') ;?><br/>
     84                        <input type="checkbox" class="w-16" name="MJwebsite" <?php echo (get_option('MJwebsite')==1)? "checked='checked'" : "";?> value="1"><?php _e(' - Required Website ?') ;?><br/>
     85                        <input type="checkbox" class="w-16" name="MJcomment" <?php echo (get_option('MJcomment')==1)? "checked='checked'" : "";?> value="1"><?php _e(' - Required Comment ?') ;?><br/>
     86                    </div>
     87                    <div>
     88                        <input name="MJact" type="hidden" id="MJact" value="insert">
     89                        <input name="Save" type="submit" id="Save" value="<?php _e('Save') ;?>">
     90                    </div>
     91                </form>
     92            </div>
     93        </div> 
     94    <?php
     95    }
    6496}
    6597
  • mj-contact-us/trunk/files/mj-class-process.php

    r647410 r654989  
    99            $url        =   strip_tags($_REQUEST['url']);
    1010            $comment    =   strip_tags($_REQUEST['comment']);
    11             $to         =   get_option('admin_email');
     11            $to         =   (get_option('MJmailto')) ? get_option('MJmailto') : get_option('admin_email');
    1212            $subject    =   (empty($subject))? "Contact Us mail" : $subject;
    1313            $message = "
     
    116116    }
    117117   
     118    function AdminOptionProcess(){
     119        if(isset($_POST['MJact']) && $_POST['MJact']=="insert"){
     120            $MJmailto   =   (!empty($_POST['MJmailto'])) ? $_POST['MJmailto'] : get_option('admin_email');
     121            $MJcopytome =   isset($_POST['MJcopytome'])? 1 :0;
     122            $MJname     =   isset($_POST['MJname'])? 1 :0;
     123            $MJemail    =   isset($_POST['MJemail'])? 1 :0;
     124            $MJsubject  =   isset($_POST['MJsubject'])? 1 :0;
     125            $MJwebsite  =   isset($_POST['MJwebsite'])? 1 :0;
     126            $MJcomment  =   isset($_POST['MJcomment'])? 1 :0;
     127            if(is_email($MJmailto)){
     128                update_option('MJmailto',$MJmailto);
     129                update_option('MJcopytome',$MJcopytome);
     130                update_option('MJname',$MJname);
     131                update_option('MJemail',$MJemail);
     132                update_option('MJsubject',$MJsubject);
     133                update_option('MJwebsite',$MJwebsite);
     134                update_option('MJcomment',$MJcomment);
     135                echo "<div class='updated p-12' id='message'><div class='p-12'>Success : Data saved Successfully</div></div>";
     136               
     137            }else{
     138                echo "<div class='error'><div class='p-12'>Error : Please enter valid email address</div></div>";
     139            }
     140        }
     141    }
     142   
     143    function AdminSwitch(){
     144        switch(ACTION){
     145            case 1:
     146                _e('action');
     147            break;
     148           
     149            default :
     150                self::AdminOptionProcess();
     151                mjContactHTML::AdminOption();
     152            break;
     153        }
     154    }
    118155   
    119156}
    120 
    121157?>
  • mj-contact-us/trunk/index.php

    r647410 r654989  
    33Plugin Name: MJ Contact us
    44Plugin URI: http://mecontact.wordpress.com/mj-contact-us-plugin/
    5 Description: mj contact us a simple form with 4-5 fields to send email address to admin . its a simple contact us form with easy to customize coding standard and easy to customize html standard. <strong>add this code [mjcontactus] in page from admin section to activate plugin form also be sure that you have get_header() function in your header file so that validation can be work properly</strong>
     5Description: mj contact us a simple form with 4-5 fields to send email address to admin . its a simple contact us form with easy to customize coding standard and easy to customize html standard. <strong>add this code</strong> [mjcontactus] <strong>in page from admin section to activate plugin form also be sure that you have get_header() function in your header file so that validation can be work properly</strong>
    66Author: anil kumar
    7 Version: 5.1
     7Version: 5.2
    88Author URI: http://about.me/anilDhiman
    99*/
     
    1313add_action("wp_enqueue_scripts", "my_jquery_enqueue");
    1414add_shortcode('mjcontactus', 'mj_contact_us');
    15 /* add_action('admin_menu', 'mjcontactmenu'); */
     15add_action('admin_menu', 'AdminIndex');
     16
    1617function my_jquery_enqueue() {
    1718   wp_deregister_script('mjform');
     
    2728
    2829function mj_contact_us(){
    29         $object =   new mjContactHTML;
    30         $object->mjForm();
    31         $object->send_mail();
     30    $object =   new mjContactHTML;
     31    $object->mjForm();
     32    $object->send_mail();
     33}
     34function AdminIndex(){
     35    add_menu_page('Mj Contact US', 'Mj Contact US', 'manage_options', 'mj-mainpage', 'AdminMainPage');
     36}
     37function AdminMainPage(){
     38    $obj    =   new mjContactPRO;
     39    $obj->AdminSwitch();
    3240    }
    33 
    34 
    3541?>
  • mj-contact-us/trunk/readme.txt

    r647733 r654989  
    66Requires at least: 3.0.1
    77Tested up to: 3.5
    8 Stable tag: 5.1
     8Stable tag: 5.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3737
    38381. Upload 'mj-contactus' file to the `/wp-content/plugins/` directory
    39 1. Activate the plugin through the 'Plugins' menu in WordPress
    40 1. Place `[mjcontactus]` in your page editor or in templates paste this code mj_contact_us();
    41 
     392. Activate the plugin through the 'Plugins' menu in WordPress
     403. Place `[mjcontactus]` in your page editor or in templates paste this code mj_contact_us();
     414. Do the admin setting as per your requirement
    4242
    4343== Frequently Asked Questions ==
     
    5454== Screenshots ==
    5555
    56 1. simple contact us form screen shot.
    57 2. validation view of form.
     561. Simple contact us form screen shot.
     572. Validation view of form.
     583. Admin area for setting.
    5859
    5960== Changelog ==
    60 = 5.0 =
     61
     62= 5.2 =
     63 * added admin options
     64 * validations are optional
     65
     66= 5.1 =
    6167 * add the jquery validation
    6268 * changes in form design
     
    7177= 5.0 =
    7278= 5.1 =
     79= 5.2 =
Note: See TracChangeset for help on using the changeset viewer.