Plugin Directory

Changeset 2378212


Ignore:
Timestamp:
09/09/2020 05:45:02 PM (6 years ago)
Author:
cromer12
Message:

made all app features free

Location:
easy-prayer/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • easy-prayer/trunk/easy-prayer.php

    r2267045 r2378212  
    11<?php
    2 
    3 /*
    4 Plugin Name: Easy Prayer
    5 Plugin URI: http://prayer-plugin.com
    6 description: a plugin to create, collect, store, and display prayer requests
    7 Version: 1.0
    8 Author: Cameron C.
    9 Author URI: http://cameronc.com
    10 */
    11 if ( !defined( 'ABSPATH' ) ) {
    12     exit;
     2   /*
     3   Plugin Name: Easy Prayer
     4   Plugin URI: http://prayer-plugin.com
     5   description: a plugin to create, collect, store, and display prayer requests
     6   Version: 1.1
     7   Author: Cameron C.
     8   Author URI: http://cameronc.com
     9   */
     10
     11  if ( ! function_exists( 'ep_fs' ) ) {
     12    // Create a helper function for easy SDK access.
     13    function ep_fs() {
     14        global $ep_fs;
     15
     16        if ( ! isset( $ep_fs ) ) {
     17            // Include Freemius SDK.
     18            require_once dirname(__FILE__) . '/freemius/start.php';
     19
     20            $ep_fs = fs_dynamic_init( array(
     21                'id'                  => '5756',
     22                'slug'                => 'easy-prayer',
     23                'type'                => 'plugin',
     24                'public_key'          => 'pk_24ce60a8ae366b3eff0f74bffcaeb',
     25                'is_premium'          => false,
     26                'has_addons'          => false,
     27                'has_paid_plans'      => false,
     28                'menu'                => array(
     29                    'slug'           => 'easy-prayer/php/adminpage.php',
     30                    'support'        => false,
     31                ),
     32            ) );
     33        }
     34
     35        return $ep_fs;
     36    }
     37
     38    // Init Freemius.
     39    ep_fs();
     40    // Signal that SDK was initiated.
     41    do_action( 'ep_fs_loaded' );
    1342}
    1443
    15 if ( function_exists( 'ep_fs' ) ) {
    16     ep_fs()->set_basename( false, __FILE__ );
    17 } else {
    18     // DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
    19     if ( !function_exists( 'ep_fs' ) ) {
    20        
    21         if ( !function_exists( 'ep_fs' ) ) {
    22             // Create a helper function for easy SDK access.
    23             function ep_fs()
    24             {
    25                 global  $ep_fs ;
    26                
    27                 if ( !isset( $ep_fs ) ) {
    28                     // Include Freemius SDK.
    29                     require_once dirname( __FILE__ ) . '/freemius/start.php';
    30                     $ep_fs = fs_dynamic_init( array(
    31                         'id'             => '5756',
    32                         'slug'           => 'easy-prayer',
    33                         'type'           => 'plugin',
    34                         'public_key'     => 'pk_24ce60a8ae366b3eff0f74bffcaeb',
    35                         'is_premium'     => false,
    36                         'premium_suffix' => 'Premium',
    37                         'has_addons'     => false,
    38                         'has_paid_plans' => true,
    39                         'trial'          => array(
    40                         'days'               => 7,
    41                         'is_require_payment' => false,
    42                     ),
    43                         'menu'           => array(
    44                         'slug'    => 'easy-prayer/php/adminpage.php',
    45                         'support' => false,
    46                     ),
    47                         'is_live'        => true,
    48                     ) );
    49                 }
    50                
    51                 return $ep_fs;
    52             }
    53            
    54             // Init Freemius.
    55             ep_fs();
    56             // Signal that SDK was initiated.
    57             do_action( 'ep_fs_loaded' );
    58         }
    59    
    60     }
    61     global  $easy_prayer_db_version ;
     44    global $easy_prayer_db_version;
    6245    $easy_prayer_db_version = '1.0';
     46
    6347    //create tables and check for updates
    64     function easy_prayer_install()
    65     {
    66         global  $wpdb ;
    67         global  $easy_prayer_db_version ;
     48    function easy_prayer_install() {
     49        global $wpdb;
     50        global $easy_prayer_db_version;
    6851        $installed_ver = get_option( "easy_prayer_db_version" );
     52
    6953        //Requests
    7054        $table_name = $wpdb->prefix . 'easy_prayer_requests';
     55
    7156        $charset_collate = $wpdb->get_charset_collate();
    72         $sql = "CREATE TABLE " . $table_name . " (\n            id INT NOT NULL AUTO_INCREMENT,\n            date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,\n            fname TEXT NOT NULL,\n            lname TEXT NOT NULL,\n            request TEXT NOT NULL,\n            email TEXT NOT NULL,\n            location TEXT NOT NULL,\n            status TEXT NOT NULL,\n            category TEXT NOT NULL,\n            ip TEXT NOT NULL,\n            PRIMARY KEY  (id)\n        ) " . $charset_collate . ";";
    73         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     57
     58        $sql = "CREATE TABLE " . $table_name . " (
     59            id INT NOT NULL AUTO_INCREMENT,
     60            date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
     61            fname TEXT NOT NULL,
     62            lname TEXT NOT NULL,
     63            request TEXT NOT NULL,
     64            email TEXT NOT NULL,
     65            location TEXT NOT NULL,
     66            status TEXT NOT NULL,
     67            category TEXT NOT NULL,
     68            ip TEXT NOT NULL,
     69            PRIMARY KEY  (id)
     70        ) ". $charset_collate .";";
     71
     72        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    7473        dbDelta( $sql );
     74
    7575        //Categories
    7676        $table_name = $wpdb->prefix . 'easy_prayer_categories';
    77         $sql = "CREATE TABLE " . $table_name . " (\n            id INT NOT NULL AUTO_INCREMENT,\n            name TEXT NOT NULL,\n            status TEXT NOT NULL,\n            PRIMARY KEY  (id)\n        ) " . $charset_collate . ";";
    78         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     77
     78        $sql = "CREATE TABLE " . $table_name . " (
     79            id INT NOT NULL AUTO_INCREMENT,
     80            name TEXT NOT NULL,
     81            status TEXT NOT NULL,
     82            PRIMARY KEY  (id)
     83        ) ". $charset_collate .";";
     84
     85        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    7986        dbDelta( $sql );
     87
    8088        //settings
    8189        $table_name = $wpdb->prefix . 'easy_prayer_settings';
    82         $sql = "CREATE TABLE " . $table_name . " (\n            id INT NOT NULL AUTO_INCREMENT,\n            name TEXT NOT NULL,\n            status TEXT NOT NULL,\n            PRIMARY KEY  (id)\n        ) " . $charset_collate . ";";
    83         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     90
     91        $sql = "CREATE TABLE " . $table_name . " (
     92            id INT NOT NULL AUTO_INCREMENT,
     93            name TEXT NOT NULL,
     94            status TEXT NOT NULL,
     95            PRIMARY KEY  (id)
     96        ) ". $charset_collate .";";
     97
     98        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    8499        dbDelta( $sql );
     100
    85101        add_option( 'easy_prayer_db_version', $easy_prayer_db_version );
     102
     103
    86104        if ( $installed_ver != $easy_prayer_db_version ) {
     105
    87106            //updates go here
    88107        }
    89108    }
    90    
     109
    91110    //put init data in database for user
    92     function easy_prayer_install_data()
    93     {
    94         global  $wpdb ;
    95         $exist = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "easy_prayer_requests" );
    96        
    97         if ( $exist == '0' ) {
     111    function easy_prayer_install_data() {
     112        global $wpdb;
     113
     114        $exist = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix ."easy_prayer_requests");
     115
     116        if($exist == '0'){
    98117            $welcome_fname = 'John';
    99118            $welcome_lname = 'Smith';
     
    106125            $welcome_category = '1';
    107126            $welcome_ip = '0.0.0.0';
     127
    108128            $table_name = $wpdb->prefix . 'easy_prayer_requests';
    109129            //insert into requests
    110             $wpdb->insert( $table_name, array(
    111                 'date'     => current_time( 'mysql' ),
    112                 'fname'    => $welcome_fname,
    113                 'lname'    => $welcome_lname,
    114                 'request'  => $welcome_request,
    115                 'email'    => $welcome_email,
    116                 'location' => $welcome_location,
    117                 'status'   => $welcome_status,
    118                 'category' => $welcome_category,
    119                 'ip'       => $welcome_ip,
    120             ) );
    121         }
    122        
    123         $exist = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "easy_prayer_categories" );
    124        
    125         if ( $exist == '0' ) {
     130            $wpdb->insert(
     131                $table_name,
     132                array(
     133                    'date' => current_time( 'mysql' ),
     134                    'fname' => $welcome_fname,
     135                    'lname' => $welcome_lname,
     136                    'request' => $welcome_request,
     137                    'email' => $welcome_email,
     138                    'location' => $welcome_location,
     139                    'status' => $welcome_status,
     140                    'category' => $welcome_category,
     141                    'ip' => $welcome_ip
     142                )
     143            );
     144        }
     145
     146        $exist = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix ."easy_prayer_categories");
     147
     148        if($exist == '0'){
    126149            //insert category
    127150            $table_name = $wpdb->prefix . 'easy_prayer_categories';
    128             $wpdb->insert( $table_name, array(
    129                 'name'   => 'Personal',
    130                 'status' => '1',
    131             ) );
    132         }
    133        
    134         $exist = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "easy_prayer_settings" );
    135        
    136         if ( $exist == '0' ) {
     151
     152            $wpdb->insert(
     153                $table_name,
     154                array(
     155                    'name' => 'Personal',
     156                    'status' => '1'
     157                )
     158            );
     159        }
     160
     161        $exist = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix ."easy_prayer_settings");
     162
     163        if($exist == '0'){
    137164            //insert setting
    138165            $table_name = $wpdb->prefix . 'easy_prayer_settings';
    139             $wpdb->insert( $table_name, array(
    140                 'name'   => 'ip',
    141                 'status' => '0',
    142             ) );
    143         } else {
     166
     167            $wpdb->insert(
     168                $table_name,
     169                array(
     170                    'name' => 'ip',
     171                    'status' => '0'
     172                )
     173            );
     174        }else{
    144175            // empty settings table
    145             $delete = $wpdb->query( "TRUNCATE TABLE " . $wpdb->prefix . "easy_prayer_settings" );
     176            $delete = $wpdb->query("TRUNCATE TABLE ". $wpdb->prefix."easy_prayer_settings");
     177
    146178            //insert settings
    147179            $table_name = $wpdb->prefix . 'easy_prayer_settings';
    148             $wpdb->insert( $table_name, array(
    149                 'name'   => 'ip',
    150                 'status' => '0',
    151             ) );
    152         }
    153    
    154     }
    155    
     180
     181            $wpdb->insert(
     182                $table_name,
     183                array(
     184                    'name' => 'ip',
     185                    'status' => '0'
     186                )
     187            );
     188        }
     189
     190
     191    }
     192
     193
     194
    156195    register_activation_hook( __FILE__, 'easy_prayer_install' );
    157196    register_activation_hook( __FILE__, 'easy_prayer_install_data' );
     197
     198
    158199    //shortcode function to create request form; will need some how get post
    159     function easy_prayer_form_output()
    160     {
    161         global  $wpdb ;
     200    function easy_prayer_form_output() {
     201        global $wpdb;
     202
    162203        //get all active categories from the database
    163         $arr = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_categories WHERE status != 2 AND status != 0" );
     204        $arr = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_categories WHERE status != 2 AND status != 0");
    164205        $output = '
    165206            <form action="" method="post">
     
    179220                    Category:<select name="category" required>
    180221                ';
    181         $outputmid = '';
    182         foreach ( $arr as $results ) {
    183             $output .= '<option value="' . esc_attr( $results->id ) . '" id="' . esc_attr( $results->id ) . '" name="' . esc_attr( $results->id ) . '">' . esc_attr( $results->name ) . '</option>';
    184         }
    185         $outputend = '
     222
     223                $outputmid = '';
     224                foreach ($arr as $results){
     225                  $output .= '<option value="'.esc_attr($results->id).'" id="'.esc_attr($results->id).'" name="'. esc_attr($results->id).'">'.esc_attr($results->name) .'</option>';
     226                 }
     227
     228                $outputend = '
    186229                </select>
    187230                </div>
     
    191234                </form>
    192235                ';
    193        
    194         if ( isset( $_POST['sub'] ) ) {
    195             global  $wpdb ;
    196            
    197             if ( !easyPrayerbadword( $_POST['fname'] ) ) {
    198                 $fname = filter_var( $_POST['fname'], FILTER_SANITIZE_STRING );
    199                 $fname = sanitize_text_field( $fname );
    200             } else {
     236
     237        if ( isset( $_POST['sub'])){
     238            global $wpdb;
     239
     240            if(!easyPrayerbadword($_POST['fname'])){
     241                $fname = filter_var($_POST['fname'], FILTER_SANITIZE_STRING);
     242                $fname = sanitize_text_field($fname);
     243            }else{
    201244                exit;
    202245            }
    203            
    204            
    205             if ( !easyPrayerbadword( $_POST['lname'] ) ) {
    206                 $lname = filter_var( $_POST['lname'], FILTER_SANITIZE_STRING );
    207                 $lname = sanitize_text_field( $lname );
    208             } else {
     246            if(!easyPrayerbadword($_POST['lname'])){
     247                $lname = filter_var($_POST['lname'], FILTER_SANITIZE_STRING);
     248                $lname = sanitize_text_field($lname);
     249            }else{
    209250                exit;
    210251            }
    211            
    212            
    213             if ( !easyPrayerbadword( $_POST['request'] ) ) {
    214                 $request = filter_var( $_POST['request'], FILTER_SANITIZE_STRING );
    215                 $request = sanitize_textarea_field( $request );
    216             } else {
     252            if(!easyPrayerbadword($_POST['request'])){
     253                $request = filter_var($_POST['request'], FILTER_SANITIZE_STRING);
     254                $request = sanitize_textarea_field($request);
     255            }else{
    217256                exit;
    218257            }
    219            
    220            
    221             if ( !easyPrayerbadword( $_POST['email'] ) ) {
    222                 $email = filter_var( $_POST['email'], FILTER_SANITIZE_STRING );
    223                 $email = sanitize_text_field( $email );
    224             } else {
     258            if(!easyPrayerbadword($_POST['email'])){
     259                $email = filter_var($_POST['email'], FILTER_SANITIZE_STRING);
     260                $email = sanitize_text_field($email);
     261            }else{
    225262                exit;
    226263            }
    227            
    228            
    229             if ( !easyPrayerbadword( $_POST['location'] ) ) {
    230                 $location = filter_var( $_POST['location'], FILTER_SANITIZE_STRING );
    231                 $location = sanitize_text_field( $location );
    232             } else {
     264            if(!easyPrayerbadword($_POST['location'])){
     265                $location = filter_var($_POST['location'], FILTER_SANITIZE_STRING);
     266                $location = sanitize_text_field($location);
     267            }else{
    233268                exit;
    234269            }
    235            
     270
    236271            //if ip is set, check database for currently approved requests by ip (status = 1)or previously approved requests by ip (status = 3)
    237272            //if query return results, auto approve request
    238            
    239             if ( isset( $_POST['ip'] ) && $_POST['ip'] != "0.0.0.0" ) {
    240                 $settings = $wpdb->get_results( 'SELECT * FROM $wpdb->prefix' . 'easy_prayer_settings WHERE name = "ip"' );
    241                 foreach ( $setting as $result ) {
    242                     if ( $setting->status == 1 ) {
     273            if(isset($_POST['ip']) && $_POST['ip'] != "0.0.0.0"){
     274                $settings = $wpdb->get_results('SELECT * FROM $wpdb->prefix'.'easy_prayer_settings WHERE name = "ip"');
     275                foreach($setting as $result){
     276                    if($setting->status == 1){
    243277                        $settings = 1;
    244278                    }
    245279                }
    246                
    247                 if ( $settings == 1 ) {
    248                     $ip = filter_var( $_POST['ip'], FILTER_SANITIZE_STRING );
    249                     $ip = sanitize_text_field( $ip );
    250                     $check = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}" . "easy_prayer_requests WHERE status = 1 OR status = 3 AND ip = " . $ip );
    251                    
    252                     if ( $check != 0 ) {
     280                if($settings == 1){
     281                    $ip = filter_var($_POST['ip'], FILTER_SANITIZE_STRING);
     282                    $ip = sanitize_text_field($ip);
     283                    $check = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->prefix"."easy_prayer_requests WHERE status = 1 OR status = 3 AND ip = ".$ip );
     284                    if($check != 0){
    253285                        $status = 1;
    254                     } else {
     286                    }else{
    255287                        $status = 0;
    256288                    }
    257                
    258                 } else {
     289                }else{
    259290                    $status = 0;
    260291                }
    261            
    262             } else {
     292            }else{
    263293                $status = 0;
    264294                $ip = '0.0.0.0';
    265295            }
    266            
     296
    267297            //may allow custom categories
    268            
    269             if ( !easyPrayerbadword( $_POST['category'] ) ) {
    270                 $category = filter_var( $_POST['category'], FILTER_SANITIZE_STRING );
    271                 $category = sanitize_text_field( $category );
    272             } else {
     298            if(!easyPrayerbadword($_POST['category'])){
     299                $category = filter_var($_POST['category'], FILTER_SANITIZE_STRING);
     300                $category = sanitize_text_field($category);
     301            }else{
    273302                exit;
    274303            }
    275            
     304
    276305            $table_name = $wpdb->prefix . 'easy_prayer_requests';
    277             $wpdb->insert( $table_name, array(
    278                 'date'     => current_time( 'mysql' ),
    279                 'fname'    => $fname,
    280                 'lname'    => $lname,
    281                 'request'  => $request,
    282                 'email'    => $email,
    283                 'location' => $location,
    284                 'status'   => $status,
    285                 'category' => $category,
    286                 'ip'       => $ip,
    287             ) );
     306
     307            $wpdb->insert(
     308                $table_name,
     309                array(
     310                    'date' => current_time( 'mysql' ),
     311                    'fname' => $fname,
     312                    'lname' => $lname,
     313                    'request' => $request,
     314                    'email' => $email,
     315                    'location' => $location,
     316                    'status' => $status,
     317                    'category' => $category,
     318                    'ip' => $ip
     319                )
     320            );
    288321            $_POST = array();
    289322            return $output . $outputmid . $outputend;
    290         } else {
     323
     324        }else{
    291325            return $output . $outputmid . $outputend;
    292326        }
    293    
    294     }
    295    
     327    }
    296328    add_shortcode( 'easy_prayer_form', 'easy_prayer_form_output' );
     329
    297330    //shortcode function to create request form
    298    
    299     if ( ep_fs()->can_use_premium_code() ) {
    300         function easy_prayer_requests_output()
    301         {
    302             global  $wpdb ;
    303             $arr = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_requests WHERE status = 1" );
    304             $cate = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_categories WHERE status = 1" );
    305             $string = "";
    306             //alter rows here
    307             foreach ( $arr as $request ) {
    308                 $string = $string . "<div id='easy_prayer'>";
    309                 foreach ( $cate as $category ) {
    310                    
    311                     if ( $request->category == $category->id ) {
    312                         $string = $string . "<span id='fname'>" . esc_attr( $request->fname ) . "</span> ";
    313                         $string = $string . "<span id='lname'>" . esc_attr( $request->lname ) . "</span>";
    314                         $string = $string . "<span id='category' style='float: right'>" . esc_attr( $category->name ) . "</span>";
    315                         $string = $string . "<div id='request' style='text-align: center'>" . esc_attr( $request->request ) . "</div>";
    316                         $string = $string . "<span id='location'>" . esc_attr( $request->location ) . "</span>";
    317                         $string = $string . "</div>";
    318                         $string = $string . "<hr>";
    319                     }
    320                
     331    function easy_prayer_requests_output() {
     332        global $wpdb;
     333
     334        $arr = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_requests WHERE status = 1");
     335        $cate = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_categories WHERE status = 1");
     336        $string = "";
     337        //alter rows here
     338        foreach($arr as $request){
     339            $string = $string . "<div id='easy_prayer'>";
     340            foreach($cate as $category){
     341                if($request->category == $category->id){
     342                    $string = $string . "<span id='fname'>". esc_attr($request->fname) ."</span> ";
     343                    $string = $string . "<span id='lname'>". esc_attr($request->lname) ."</span>";
     344                    $string = $string . "<span id='category' style='float: right'>". esc_attr($category->name) ."</span>";
     345                    $string = $string . "<div id='request' style='text-align: center'>". esc_attr($request->request) ."</div>";
     346                    $string = $string . "<span id='location'>". esc_attr($request->location) ."</span>";
     347                    $string = $string .  "</div>";
     348                    $string = $string .  "<hr>";
    321349                }
    322350            }
    323             return $string;
    324         }
    325        
    326         add_shortcode( 'easy_prayer_requests', 'easy_prayer_requests_output' );
    327     } else {
    328         function easy_prayer_requests_output()
    329         {
    330             $string = "<p>Easy Prayer Requests shortcode is a Premium Feature</p>";
    331             return $string;
    332         }
    333        
    334         add_shortcode( 'easy_prayer_requests', 'easy_prayer_requests_output' );
    335     }
    336    
     351        }
     352        return $string;
     353    }
     354    add_shortcode( 'easy_prayer_requests', 'easy_prayer_requests_output' );
     355
     356
     357
     358
     359
    337360    //checks for updates
    338     function easy_prayer_update_db_check()
    339     {
    340         global  $easy_prayer_db_version ;
     361    function easy_prayer_update_db_check() {
     362        global $easy_prayer_db_version;
    341363        if ( get_site_option( 'easy_prayer_db_version' ) != $easy_prayer_db_version ) {
    342364            easy_prayer_install();
    343365        }
    344366    }
    345    
    346367    add_action( 'plugins_loaded', 'easy_prayer_update_db_check' );
     368
     369
     370
    347371    //add admin panel
    348     function easy_prayer_setup_menu()
    349     {
    350         add_menu_page(
    351             'Easy Prayer Page',
    352             'Easy Prayer',
    353             'manage_options',
    354             'easy-prayer/php/adminpage.php',
    355             '',
    356             'dashicons-format-status'
    357         );
    358         add_submenu_page(
    359             'easy-prayer/php/adminpage.php',
    360             'Help',
    361             'Easy Prayer Help',
    362             'manage_options',
    363             'easy-prayer/help/readme.php',
    364             ''
    365         );
    366     }
    367    
    368     add_action( 'admin_menu', 'easy_prayer_setup_menu' );
     372    function easy_prayer_setup_menu(){
     373
     374        add_menu_page( 'Easy Prayer Page', 'Easy Prayer', 'manage_options',  'easy-prayer/php/adminpage.php', '', 'dashicons-format-status');
     375        add_submenu_page('easy-prayer/php/adminpage.php', 'Help', 'Easy Prayer Help', 'manage_options', 'easy-prayer/help/readme.php', '');
     376    }
     377    add_action('admin_menu', 'easy_prayer_setup_menu');
     378
    369379    //loads css and JS for admin panel
    370     function easyPrayerAdmin_enqueue( $hook )
    371     {
     380    function easyPrayerAdmin_enqueue($hook){
    372381        //only for our special plugin admin page
    373         if ( 'easy-prayer/php/adminpage.php' != $hook ) {
    374             return;
    375         }
     382
     383        if( 'easy-prayer/php/adminpage.php' != $hook ){
     384        return;
     385        }
     386
    376387        //include jquery and free $
    377388        //if not done on this level, datatables has an uncaught type error $.
    378389        //if the inline script is added to the datatables, it has no affect
    379         wp_enqueue_script( 'jquery' );
    380         wp_add_inline_script( 'jquery', '$ = jQuery.noConflict();' );
     390        wp_enqueue_script('jquery');
     391        wp_add_inline_script( 'jquery', '$ = jQuery.noConflict();');
     392
    381393        //admin css
    382         wp_register_style( 'easyPrayerAdminPanelCss', plugins_url( '/easy-prayer/css/pluginpage.css' ) );
    383         wp_enqueue_style( 'easyPrayerAdminPanelCss' );
     394        wp_register_style('easyPrayerAdminPanelCss', plugins_url('/easy-prayer/css/pluginpage.css'));
     395        wp_enqueue_style('easyPrayerAdminPanelCss');
     396
    384397        //adding datatables js
    385         wp_register_style( 'easyPrayerDataTableCss', plugins_url( '/easy-prayer/js/DataTables/datatables.min.css' ) );
    386         wp_enqueue_style( 'easyPrayerDataTableCss' );
    387         wp_enqueue_script( 'easyPrayerDataTable', plugins_url( '/easy-prayer/js/DataTables/datatables.min.js' ), array( 'jquery' ) );
     398        wp_register_style('easyPrayerDataTableCss', plugins_url('/easy-prayer/js/DataTables/datatables.min.css'));
     399        wp_enqueue_style('easyPrayerDataTableCss');
     400        wp_enqueue_script('easyPrayerDataTable',plugins_url('/easy-prayer/js/DataTables/datatables.min.js'), array('jquery'));
     401
     402
    388403        //modal js
    389         wp_register_style( 'easyPrayerModalCss', plugins_url( '/easy-prayer/js/modal/jquery.modal.min.css' ) );
    390         wp_enqueue_style( 'easyPrayerModalCss' );
    391         wp_enqueue_script( 'easyPrayerModal', plugins_url( '/easy-prayer/js/modal/jquery.modal.min.js' ), array( 'jquery' ) );
    392         $location = plugins_url( '/easy-prayer/' );
     404        wp_register_style('easyPrayerModalCss', plugins_url('/easy-prayer/js/modal/jquery.modal.min.css'));
     405        wp_enqueue_style('easyPrayerModalCss');
     406        wp_enqueue_script('easyPrayerModal',plugins_url('/easy-prayer/js/modal/jquery.modal.min.js'), array('jquery'));
     407
     408        $location = plugins_url('/easy-prayer/');
    393409        $params = array(
    394             'filepath'  => $location,
    395             'adminpath' => admin_url(),
     410            'filepath' => $location,
     411            'adminpath' => admin_url()
    396412        );
    397         //load free
    398         wp_enqueue_script( 'easyPrayeradminpanel', plugins_url( 'easy-prayer/js/adminpanelfree.js' ), array( 'jquery' ) );
     413
     414        //load premium
     415        wp_enqueue_script('easyPrayeradminpanel',plugins_url('easy-prayer/js/adminpanel.js'), array('jquery'));
     416
    399417        wp_localize_script( 'easyPrayeradminpanel', 'easyPrayerParams', $params );
    400418        $easyprayernonce = wp_create_nonce( 'easyprayernonce' );
    401         wp_localize_script( 'easyPrayeradminpanel', 'my_ajax_obj', array(
    402             'ajax_url' => admin_url( 'admin-ajax.php' ),
    403             'nonce'    => $easyprayernonce,
    404         ) );
    405     }
    406    
    407     add_action( 'admin_enqueue_scripts', 'easyPrayerAdmin_enqueue' );
    408     //functions begin
     419            wp_localize_script( 'easyPrayeradminpanel', 'my_ajax_obj', array(
     420                'ajax_url' => admin_url( 'admin-ajax.php' ),
     421                'nonce'    => $easyprayernonce, // It is common practice to comma after
     422            ) );
     423    }
     424
     425  add_action( 'admin_enqueue_scripts', 'easyPrayerAdmin_enqueue' );
     426
     427  //functions begin
     428
    409429    //pull from categories table to create list of categories
    410     function easyPrayerlistCate()
    411     {
    412         global  $wpdb ;
    413         $arr = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_categories WHERE status != 2" );
     430    function easyPrayerlistCate(){
     431        global $wpdb;
     432
     433        $arr = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_categories WHERE status != 2");
    414434        $string = '';
    415         foreach ( $arr as $results ) {
    416             $string .= '<option value="' . esc_attr( $results->id ) . '" id="' . esc_attr( $results->id ) . '" name="' . esc_attr( $results->id ) . '">' . esc_attr( $results->name ) . '</option>';
     435        foreach ($arr as $results){
     436            $string .= '<option value="' . esc_attr($results->id) . '" id="' . esc_attr($results->id) .'" name="'. esc_attr($results->id) .'">' . esc_attr($results->name) . '</option>';
    417437        }
    418438        return $string;
    419439    }
    420    
    421     add_action( 'init', 'easyPrayerlistCate', 0 );
     440    add_action( 'init', 'easyPrayerlistCate', 0);
     441
    422442    /****************************Misc Stuff****************/
    423443    //class that enables badword checks
    424     require_once 'php/badwords.php';
     444    require_once('php/badwords.php');
    425445    //check for bad words
    426     function easyPrayerbadword( $text )
    427     {
     446    function easyPrayerbadword($text){
    428447        $myDictionary = array(
    429448            "ass",
     
    473492            "Snatch",
    474493            "Twat",
    475             "fuck"
     494            "fuck",
    476495        );
     496
     497
    477498        $badwords = new EasyPrayerPhpBadWords();
    478         $badwords->setDictionaryFromArray( $myDictionary )->setText( $text );
     499        $badwords->setDictionaryFromArray( $myDictionary )
     500                ->setText( $text );
     501
    479502        $response = $badwords->check();
    480503        return $response;
    481504    }
    482    
    483     add_action( 'init', 'easyPrayerbadword' );
     505    add_action( 'init', 'easyPrayerbadword');
     506
     507
    484508    /**************************Requests****************/
    485509    //accepts only 1 request at a time, called by adminpanel.php: "approve request" button
    486     function easyPrayerApproveRequest()
    487     {
    488         check_ajax_referer( 'easyprayernonce' );
    489         global  $wpdb ;
    490         $table = $wpdb->prefix . "easy_prayer_requests";
    491         $data = [
    492             "status" => "1",
    493         ];
    494         $where = [
    495             "id" => sanitize_text_field( $_POST['id'] ),
    496         ];
     510    function easyPrayerApproveRequest(){
     511        check_ajax_referer( 'easyprayernonce' );
     512
     513        global $wpdb;
     514        $table = $wpdb->prefix."easy_prayer_requests";
     515        $data = ["status" => "1"];
     516        $where = ["id" => sanitize_text_field($_POST['id'])];
    497517        //approve request based on id
    498518        //set status to 1
    499519        //echo "Updating data";
    500         $wpdb->update( $table, $data, $where );
    501         wp_die();
    502         // All ajax handlers die when finished
    503     }
    504    
    505     add_action( 'wp_ajax_easy_prayer_approve', 'easyPrayerApproveRequest' );
     520        $wpdb->update($table, $data, $where);
     521
     522        wp_die(); // All ajax handlers die when finished
     523    }
     524    add_action( 'wp_ajax_easy_prayer_approve', 'easyPrayerApproveRequest');
     525
    506526    //accepts only 1 request at a time, called by adminpanel.php: "trash request" button
    507     function easyPrayerTrashRequest()
    508     {
    509         check_ajax_referer( 'easyprayernonce' );
    510         global  $wpdb ;
    511         $id = sanitize_text_field( $_POST['id'] );
     527    function easyPrayerTrashRequest(){
     528        check_ajax_referer( 'easyprayernonce' );
     529        global $wpdb;
     530        $id = sanitize_text_field($_POST['id']);
    512531        //get specific request, check approval, if approved mark status 3
    513         $count = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "easy_prayer_requests WHERE status = 1 AND id = " . $id );
     532        $count = $wpdb->get_var("SELECT COUNT(*) FROM ". $wpdb->prefix."easy_prayer_requests WHERE status = 1 AND id = ".$id);
     533
    514534        //for future approval
    515535        $status = 2;
    516         if ( $count != 0 ) {
     536        if($count != 0){
    517537            $status = 3;
    518538        }
    519         $table = $wpdb->prefix . "easy_prayer_requests";
    520         $data = [
    521             "status" => $status,
    522         ];
    523         $where = [
    524             "id" => $id,
    525         ];
     539
     540        $table = $wpdb->prefix."easy_prayer_requests";
     541        $data = ["status" => $status];
     542        $where = ["id" => $id];
    526543        //approve request based on id
    527544        //set status to 1
    528         $wpdb->update( $table, $data, $where );
    529         wp_die();
    530         // All ajax handlers die when finished
    531     }
    532    
    533     add_action( 'wp_ajax_easy_prayer_trash', 'easyPrayerTrashRequest' );
     545        $wpdb->update($table, $data, $where);
     546
     547        wp_die(); // All ajax handlers die when finished
     548    }
     549    add_action( 'wp_ajax_easy_prayer_trash', 'easyPrayerTrashRequest');
     550
    534551    //create backend form to create request, called by createform.php. posts data to createrequestinternal.php
    535     function easyPrayerCreateForm()
    536     {
     552    function easyPrayerCreateForm(){
    537553        check_ajax_referer( 'easyprayernonce' );
    538554        $string = '';
     
    559575        $string .= '<div style="text-align: right; float: right;">';
    560576        $string .= '    Category:<select name="category" id="createcate" required>';
    561         $string .= easyPrayerlistCate();
     577        $string .=    easyPrayerlistCate();
    562578        $string .= '    </select>';
    563579        $string .= '</div>';
     
    566582        $string .= '<div style="text-align: center"><input type="submit" value="Create Request" /></div>';
    567583        $string .= '</form>';
    568         echo  $string ;
     584        echo $string;
     585
     586        wp_die(); // All ajax handlers die when finished
     587    }
     588    add_action( 'wp_ajax_easy_prayer_create_form', 'easyPrayerCreateForm');
     589
     590    //create request from internal
     591    function easyPrayerCreateRequestInternal(){
     592        check_ajax_referer( 'easyprayernonce' );
     593        global $wpdb;
     594
     595        if(!easyPrayerbadword($_POST['fname'])){
     596            $fname = filter_var($_POST['fname'], FILTER_SANITIZE_STRING);
     597            $fname = sanitize_text_field($fname);
     598        }else{
     599            exit;
     600        }
     601        if(!easyPrayerbadword($_POST['lname'])){
     602            $lname = filter_var($_POST['lname'], FILTER_SANITIZE_STRING);
     603            $lname = sanitize_text_field($lname);
     604        }else{
     605            exit;
     606        }
     607        if(!easyPrayerbadword($_POST['request'])){
     608            $request = filter_var($_POST['request'], FILTER_SANITIZE_STRING);
     609            $request = sanitize_text_field($request);
     610        }else{
     611            exit;
     612        }
     613        if(!easyPrayerbadword($_POST['email'])){
     614            $email = sanitize_email($_POST['email']);
     615            $email = sanitize_text_field($email);
     616        }else{
     617            exit;
     618        }
     619        if(!easyPrayerbadword($_POST['loca'])){
     620            $location = filter_var($_POST['loca'], FILTER_SANITIZE_STRING);
     621            $location = sanitize_text_field($location);
     622        }else{
     623            exit;
     624        }
     625
     626        if(isset($_POST['ip'])){
     627            $ip = filter_var($_POST['ip'], FILTER_SANITIZE_STRING);
     628            $ip = sanitize_text_field($ip);
     629        }else{
     630            $ip = '0.0.0.0';
     631        }
     632
     633        //0 for unapproved, 1 for approved, 2 for trashed, if statement accounts for 0
     634        if (filter_var($_POST['status'], FILTER_VALIDATE_INT) === 0 || !filter_var($_POST['status'], FILTER_VALIDATE_INT) === false) {
     635            $status = filter_var($_POST['status'], FILTER_SANITIZE_STRING);
     636            $status = sanitize_text_field($status);
     637        }else{
     638            $status = 0;
     639        }
     640
     641        //may allow custom categories
     642        if(!easyPrayerbadword($_POST['category'])){
     643            $category = filter_var($_POST['category'], FILTER_SANITIZE_STRING);
     644            $category = sanitize_text_field($category);
     645        }else{
     646            exit;
     647        }
     648
     649        $table_name = $wpdb->prefix . 'easy_prayer_requests';
     650
     651        $wpdb->insert(
     652            $table_name,
     653            array(
     654                'date' => current_time( 'mysql' ),
     655                'fname' => $fname,
     656                'lname' => $lname,
     657                'request' => $request,
     658                'email' => $email,
     659                'location' => $location,
     660                'status' => $status,
     661                'category' => $category,
     662                'ip' => $ip
     663            )
     664        );
    569665        wp_die();
    570         // All ajax handlers die when finished
    571     }
    572    
    573     add_action( 'wp_ajax_easy_prayer_create_form', 'easyPrayerCreateForm' );
    574     //create request from internal
    575     function easyPrayerCreateRequestInternal()
    576     {
    577         check_ajax_referer( 'easyprayernonce' );
    578         global  $wpdb ;
    579        
    580         if ( !easyPrayerbadword( $_POST['fname'] ) ) {
    581             $fname = filter_var( $_POST['fname'], FILTER_SANITIZE_STRING );
    582             $fname = sanitize_text_field( $fname );
    583         } else {
    584             exit;
    585         }
    586        
    587        
    588         if ( !easyPrayerbadword( $_POST['lname'] ) ) {
    589             $lname = filter_var( $_POST['lname'], FILTER_SANITIZE_STRING );
    590             $lname = sanitize_text_field( $lname );
    591         } else {
    592             exit;
    593         }
    594        
    595        
    596         if ( !easyPrayerbadword( $_POST['request'] ) ) {
    597             $request = filter_var( $_POST['request'], FILTER_SANITIZE_STRING );
    598             $request = sanitize_text_field( $request );
    599         } else {
    600             exit;
    601         }
    602        
    603        
    604         if ( !easyPrayerbadword( $_POST['email'] ) ) {
    605             $email = sanitize_email( $_POST['email'] );
    606             $email = sanitize_text_field( $email );
    607         } else {
    608             exit;
    609         }
    610        
    611        
    612         if ( !easyPrayerbadword( $_POST['loca'] ) ) {
    613             $location = filter_var( $_POST['loca'], FILTER_SANITIZE_STRING );
    614             $location = sanitize_text_field( $location );
    615         } else {
    616             exit;
    617         }
    618        
    619        
    620         if ( isset( $_POST['ip'] ) ) {
    621             $ip = filter_var( $_POST['ip'], FILTER_SANITIZE_STRING );
    622             $ip = sanitize_text_field( $ip );
    623         } else {
    624             $ip = '0.0.0.0';
    625         }
    626        
    627         //0 for unapproved, 1 for approved, 2 for trashed, if statement accounts for 0
    628        
    629         if ( filter_var( $_POST['status'], FILTER_VALIDATE_INT ) === 0 || !filter_var( $_POST['status'], FILTER_VALIDATE_INT ) === false ) {
    630             $status = filter_var( $_POST['status'], FILTER_SANITIZE_STRING );
    631             $status = sanitize_text_field( $status );
    632         } else {
    633             $status = 0;
    634         }
    635        
    636         //may allow custom categories
    637        
    638         if ( !easyPrayerbadword( $_POST['category'] ) ) {
    639             $category = filter_var( $_POST['category'], FILTER_SANITIZE_STRING );
    640             $category = sanitize_text_field( $category );
    641         } else {
    642             exit;
    643         }
    644        
    645         $table_name = $wpdb->prefix . 'easy_prayer_requests';
    646         $wpdb->insert( $table_name, array(
    647             'date'     => current_time( 'mysql' ),
    648             'fname'    => $fname,
    649             'lname'    => $lname,
    650             'request'  => $request,
    651             'email'    => $email,
    652             'location' => $location,
    653             'status'   => $status,
    654             'category' => $category,
    655             'ip'       => $ip,
    656         ) );
    657         wp_die();
    658     }
    659    
    660     add_action( 'wp_ajax_easy_prayer_create_request', 'easyPrayerCreateRequestInternal' );
     666
     667    }
     668    add_action('wp_ajax_easy_prayer_create_request', 'easyPrayerCreateRequestInternal');
     669
    661670    //gets one request by id; called by getrequest.php
    662     function easyPrayerGetRequest()
    663     {
    664         check_ajax_referer( 'easyprayernonce' );
    665         global  $wpdb ;
     671    function easyPrayerGetRequest(){
     672        check_ajax_referer( 'easyprayernonce' );
     673        global $wpdb;
    666674        //query data
    667         $query = "SELECT * FROM " . $wpdb->prefix . "easy_prayer_requests WHERE id = " . sanitize_text_field( $_POST['id'] );
    668         $arr = $wpdb->get_results( $query );
     675        $query = "SELECT * FROM ". $wpdb->prefix."easy_prayer_requests WHERE id = ". sanitize_text_field($_POST['id']);
     676        $arr = $wpdb->get_results($query);
    669677        $string = '';
     678
    670679        //create return string
    671         foreach ( $arr as $result ) {
     680        foreach($arr as $result){
    672681            $string .= '<form action="" method="post" class="ajax"
    673682            enctype="multipart/form-data" id="editRequest">';
    674             $string .= '<input type=text style="display: none" name="id" id="editid" value="' . esc_attr( $result->id ) . '">';
     683            $string .= '<input type=text style="display: none" name="id" id="editid" value="'.esc_attr($result->id).'">';
    675684            $string .= '<div style="text-align: center;"><h1>Edit Request</h1></div>';
    676685            $string .= '<br>';
    677             $string .= 'First Name:<input type="text" name="fname" id="editfname" value="' . esc_attr( $result->fname ) . '">';
    678             $string .= 'Last Name:<input type="text" name="lname" id="editlname" value="' . esc_attr( $result->lname ) . '">';
    679             $string .= 'Email:<input type="email" name="email" id="editemail" value="' . esc_attr( $result->email ) . '">';
     686            $string .= 'First Name:<input type="text" name="fname" id="editfname" value="'.esc_attr($result->fname).'">';
     687            $string .= 'Last Name:<input type="text" name="lname" id="editlname" value="'.esc_attr($result->lname).'">';
     688            $string .= 'Email:<input type="email" name="email" id="editemail" value="'.esc_attr($result->email).'">';
    680689            $string .= '<br>';
    681690            $string .= '<br>';
    682             $string .= 'Request:<textarea type="text" name="request" id="editrequest" placeholder="Request here..." rows=3 style="width: 100%">' . $result->request . '</textarea>';
     691            $string .= 'Request:<textarea type="text" name="request" id="editrequest" placeholder="Request here..." rows=3 style="width: 100%">'.$result->request.'</textarea>';
    683692            $string .= '<br>';
    684693            $string .= '<br>';
    685             $string .= 'Location:<input type="text" name="location" id="editlocation" value="' . esc_attr( $result->location ) . '">';
     694            $string .= 'Location:<input type="text" name="location" id="editlocation" value="'.esc_attr($result->location).'">';
    686695            $string .= '<div style="text-align: right; float: right;">';
    687696            $string .= '    Status:<select name="status" id="editstatus">';
    688            
    689             if ( $result->status == 1 ) {
    690                 $string .= '        <option value="1" selected>Approved</option>';
    691                 $string .= '        <option value="0">Unapproved</option>';
    692             } else {
    693                 $string .= '        <option value="1">Approved</option>';
    694                 $string .= '        <option value="0" selected>Unapproved</option>';
    695             }
    696            
     697            if($result->status == 1){
     698                $string .='     <option value="1" selected>Approved</option>';
     699                $string .='     <option value="0">Unapproved</option>';
     700            }else{
     701                $string .='     <option value="1">Approved</option>';
     702                $string .='     <option value="0" selected>Unapproved</option>';
     703            }
    697704            $string .= '    </select>';
    698705            $string .= '</div>';
     
    700707            $string .= 'Category:<select name="category" id="editcate">';
    701708            //add js to sort thisy
    702             $string .= easyPrayerListCateActive( $result->category );
     709                $string .= easyPrayerListCateActive($result->category);
    703710            $string .= '    </select>';
    704711            $string .= '</div>';
     
    709716        }
    710717        //return string
    711         echo  $string ;
     718        echo $string;
    712719        wp_die();
    713720    }
    714    
    715     add_action( 'wp_ajax_easy_prayer_get_request', 'easyPrayerGetRequest' );
     721    add_action('wp_ajax_easy_prayer_get_request', 'easyPrayerGetRequest');
     722
     723
    716724    //posts edited data to request; called by editrequest.php
    717     function easyPrayerEditRequest()
    718     {
    719         check_ajax_referer( 'easyprayernonce' );
    720         global  $wpdb ;
    721        
    722         if ( !easyPrayerbadword( $_POST['fname'] ) ) {
    723             $fname = filter_var( $_POST['fname'], FILTER_SANITIZE_STRING );
    724             $fname = sanitize_text_field( $fname );
    725         } else {
    726             exit;
    727         }
    728        
    729        
    730         if ( !easyPrayerbadword( $_POST['lname'] ) ) {
    731             $lname = filter_var( $_POST['lname'], FILTER_SANITIZE_STRING );
    732             $lname = sanitize_text_field( $lname );
    733         } else {
    734             exit;
    735         }
    736        
    737        
    738         if ( !easyPrayerbadword( $_POST['request'] ) ) {
    739             $request = filter_var( $_POST['request'], FILTER_SANITIZE_STRING );
    740             $request = sanitize_text_field( $request );
    741         } else {
    742             exit;
    743         }
    744        
    745        
    746         if ( !easyPrayerbadword( $_POST['email'] ) ) {
    747             $email = sanitize_email( $_POST['email'] );
    748         } else {
    749             exit;
    750         }
    751        
    752        
    753         if ( !easyPrayerbadword( $_POST['loca'] ) ) {
    754             $location = filter_var( $_POST['loca'], FILTER_SANITIZE_STRING );
    755             $location = sanitize_text_field( $location );
    756         } else {
    757             exit;
    758         }
    759        
     725    function easyPrayerEditRequest(){
     726        check_ajax_referer( 'easyprayernonce' );
     727        global $wpdb;
     728
     729        if(!easyPrayerbadword($_POST['fname'])){
     730            $fname = filter_var($_POST['fname'], FILTER_SANITIZE_STRING);
     731            $fname = sanitize_text_field($fname);
     732        }else{
     733            exit;
     734        }
     735        if(!easyPrayerbadword($_POST['lname'])){
     736            $lname = filter_var($_POST['lname'], FILTER_SANITIZE_STRING);
     737            $lname = sanitize_text_field($lname);
     738        }else{
     739            exit;
     740        }
     741        if(!easyPrayerbadword($_POST['request'])){
     742            $request = filter_var($_POST['request'], FILTER_SANITIZE_STRING);
     743            $request = sanitize_text_field($request);
     744        }else{
     745            exit;
     746        }
     747        if(!easyPrayerbadword($_POST['email'])){
     748            $email = sanitize_email($_POST['email']);
     749        }else{
     750            exit;
     751        }
     752        if(!easyPrayerbadword($_POST['loca'])){
     753            $location = filter_var($_POST['loca'], FILTER_SANITIZE_STRING);
     754            $location = sanitize_text_field($location);
     755        }else{
     756            exit;
     757        }
     758
    760759        //0 for unapproved, 1 for approved, 2 for trashed, if statement accounts for 0
    761        
    762         if ( filter_var( $_POST['status'], FILTER_VALIDATE_INT ) === 0 || !filter_var( $_POST['status'], FILTER_VALIDATE_INT ) === false ) {
     760        if (filter_var($_POST['status'], FILTER_VALIDATE_INT) === 0 || !filter_var($_POST['status'], FILTER_VALIDATE_INT) === false) {
    763761            $status = $_POST['status'];
    764             $status = sanitize_text_field( $status );
    765         } else {
     762            $status = sanitize_text_field($status);
     763        }else{
    766764            $status = 0;
    767765        }
    768        
     766
    769767        //may allow custom categories
    770        
    771         if ( !easyPrayerbadword( $_POST['category'] ) ) {
    772             $category = filter_var( $_POST['category'], FILTER_SANITIZE_STRING );
    773             $category = sanitize_text_field( $category );
    774         } else {
    775             exit;
    776         }
    777        
     768        if(!easyPrayerbadword($_POST['category'])){
     769            $category = filter_var($_POST['category'], FILTER_SANITIZE_STRING);
     770            $category = sanitize_text_field($category);
     771        }else{
     772            exit;
     773        }
     774
    778775        $table_name = $wpdb->prefix . 'easy_prayer_requests';
     776
    779777        $data = array(
    780             'fname'    => $fname,
    781             'lname'    => $lname,
    782             'request'  => $request,
    783             'email'    => $email,
     778            'fname' => $fname,
     779            'lname' => $lname,
     780            'request' => $request,
     781            'email' => $email,
    784782            'location' => $location,
    785             'status'   => $status,
    786             'category' => $category,
     783            'status' => $status,
     784            'category' => $category
    787785        );
     786
    788787        $where = array(
    789             'id' => sanitize_text_field( $_POST['id'] ),
     788            'id' => sanitize_text_field($_POST['id'])
    790789        );
     790
    791791        $updated = $wpdb->update( $table_name, $data, $where );
    792792        wp_die();
    793793    }
    794    
    795     add_action( 'wp_ajax_easy_prayer_edit_request', 'easyPrayerEditRequest' );
     794    add_action('wp_ajax_easy_prayer_edit_request', 'easyPrayerEditRequest');
     795
    796796    /************************************CATEGORY****************************************/
     797
    797798    //pull from categories table to create list of categories, Selects active category
    798     function easyPrayerListCateActive( $id )
    799     {
    800         global  $wpdb ;
    801         $arr = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_categories WHERE status != 2" );
     799    function easyPrayerListCateActive($id){
     800        global $wpdb;
     801
     802        $arr = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_categories WHERE status != 2");
    802803        $string = '';
    803         foreach ( $arr as $results ) {
    804            
    805             if ( $results->id == $id ) {
    806                 $string .= '<option value="' . esc_attr( $results->id ) . '" id="' . esc_attr( $results->id ) . '" name="' . esc_attr( $results->id ) . '" selected>' . esc_attr( $results->name ) . '</option>';
    807             } else {
    808                 $string .= '<option value="' . esc_attr( $results->id ) . '" id="' . esc_attr( $results->id ) . '" name="' . esc_attr( $results->id ) . '">' . esc_attr( $results->name ) . '</option>';
    809             }
    810        
     804        foreach ($arr as $results){
     805            if($results->id == $id){
     806                $string .= '<option value="' . esc_attr($results->id) . '" id="' . esc_attr($results->id) .'" name="'. esc_attr($results->id) .'" selected>' . esc_attr($results->name) . '</option>';
     807            }else{
     808                $string .= '<option value="' . esc_attr($results->id) . '" id="' . esc_attr($results->id) .'" name="'. esc_attr($results->id) .'">' . esc_attr($results->name) . '</option>';
     809            }
    811810        }
    812811        return $string;
    813812    }
    814    
    815     add_action( 'init', 'easyPrayerListCateActive' );
     813    add_action('init', 'easyPrayerListCateActive');
     814
    816815    //form that is loaded into cateogry modal;
    817     function easyPrayerGetCategories()
    818     {
    819         check_ajax_referer( 'easyprayernonce' );
    820         global  $wpdb ;
    821         $arr = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_categories WHERE status != 2" );
     816    function easyPrayerGetCategories(){
     817        check_ajax_referer( 'easyprayernonce' );
     818        global $wpdb;
     819        $arr = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_categories WHERE status != 2");
    822820        $string = "";
    823821        $string .= '<span style="text-align: center;"><h1>Category</h1></span>';
    824822        $string .= '<div style="text-align: left;"><button class="create_cate">Create</button></div>';
    825823        $string .= '<br>';
    826         foreach ( $arr as $result ) {
    827             $string .= '<div id=' . esc_attr( $result->id ) . '>';
    828             $string .= 'Name:<input type="text" name="fname" value="' . esc_attr( $result->name ) . '">';
     824
     825        foreach($arr as $result){
     826            $string .= '<div id='.esc_attr($result->id).'>';
     827
     828            $string .= 'Name:<input type="text" name="fname" value="'.esc_attr($result->name).'">';
    829829            $string .= 'Status:<select name="status">';
    830            
    831             if ( $result->status == 1 ) {
     830            if($result->status == 1){
    832831                $string .= '<option value="1" selected>Active</option>';
    833832                $string .= '<option value="0">Inactive</option>';
    834             } else {
     833            }else{
    835834                $string .= '<option value="1">Active</option>';
    836835                $string .= '<option value="0" selected>Inactive</option>';
    837836            }
    838            
    839837            $string .= '</select>';
    840             $string .= '<div style="text-align: right; float: right"><button class="delete" id="' . esc_attr( $result->id ) . '">Delete</button></div>';
     838            $string .= '<div style="text-align: right; float: right"><button class="delete" id="'.esc_attr($result->id).'">Delete</button></div>';
    841839            $string .= '<br>';
    842840            $string .= '<hr>';
    843841            $string .= '</div>';
    844842        }
    845         echo  $string ;
     843
     844        echo $string;
    846845        wp_die();
    847846    }
    848    
    849     add_action( 'wp_ajax_easy_prayer_get_categories', 'easyPrayerGetCategories' );
     847    add_action('wp_ajax_easy_prayer_get_categories', 'easyPrayerGetCategories');
     848
    850849    //updates category based off id
    851     function easyPrayerEditCategory()
    852     {
    853         check_ajax_referer( 'easyprayernonce' );
    854         global  $wpdb ;
     850    function easyPrayerEditCategory(){
     851        check_ajax_referer( 'easyprayernonce' );
     852        global $wpdb;
     853
    855854        //updated new name in cata
    856855        $table_name = $wpdb->prefix . 'easy_prayer_categories';
     856
    857857        $data = array(
    858             'name'   => sanitize_text_field( $_POST['name'] ),
    859             'status' => sanitize_text_field( $_POST['status'] ),
     858            'name' => sanitize_text_field($_POST['name']),
     859            'status' => sanitize_text_field($_POST['status'])
    860860        );
     861
    861862        $where = array(
    862             'id' => sanitize_text_field( $_POST['id'] ),
     863            'id' => sanitize_text_field($_POST['id'])
    863864        );
     865
    864866        $updated = $wpdb->update( $table_name, $data, $where );
    865867        wp_die();
    866868    }
    867    
    868     add_action( 'wp_ajax_easy_prayer_edit_categories', 'easyPrayerEditCategory' );
     869    add_action('wp_ajax_easy_prayer_edit_categories', 'easyPrayerEditCategory');
     870
    869871    //deletes category based off id
    870     function easyPrayerDeleteCategory()
    871     {
    872         check_ajax_referer( 'easyprayernonce' );
    873         global  $wpdb ;
    874         $table = $wpdb->prefix . "easy_prayer_categories";
    875         $data = [
    876             "status" => "2",
    877         ];
    878         $where = [
    879             "id" => sanitize_text_field( $_POST['id'] ),
    880         ];
     872    function easyPrayerDeleteCategory(){
     873        check_ajax_referer( 'easyprayernonce' );
     874        global $wpdb;
     875
     876        $table = $wpdb->prefix."easy_prayer_categories";
     877        $data = ["status" => "2"];
     878        $where = ["id" => sanitize_text_field($_POST['id'])];
    881879        //approve request based on id
    882880        //set status to 1
    883         $wpdb->update( $table, $data, $where );
     881        $wpdb->update($table, $data, $where);
    884882        wp_die();
    885883    }
    886    
    887     add_action( 'wp_ajax_easy_prayer_delete_categories', 'easyPrayerDeleteCategory' );
     884    add_action('wp_ajax_easy_prayer_delete_categories', 'easyPrayerDeleteCategory');
     885
    888886    //form that allows creation of category
    889     function easyPrayerCreateCategoryForm()
    890     {
     887    function easyPrayerCreateCategoryForm(){
    891888        check_ajax_referer( 'easyprayernonce' );
    892889        $string = '';
     
    896893        $string .= 'Name:<input type="text" name="name" value="">';
    897894        $string .= 'Status:<select id="category_option" name="status">';
    898         $string .= '<option value="1" selected>Active</option>';
    899         $string .= '<option value="0">Inactive</option>';
     895            $string .= '<option value="1" selected>Active</option>';
     896            $string .= '<option value="0">Inactive</option>';
    900897        $string .= '</select>';
    901898        $string .= '<div style="float: right"><button id="create_category">Create</button></div>';
    902899        $string .= '</div>';
    903         echo  $string ;
     900        echo $string;
    904901        wp_die();
    905902    }
    906    
    907     add_action( 'wp_ajax_easy_prayer_create_categories_form', 'easyPrayerCreateCategoryForm' );
     903    add_action('wp_ajax_easy_prayer_create_categories_form', 'easyPrayerCreateCategoryForm');
     904
     905
     906
    908907    //posts data to category table; called by createcategory.php
    909     function easyPrayerCreateCategory()
    910     {
    911         check_ajax_referer( 'easyprayernonce' );
    912         global  $wpdb ;
     908    function easyPrayerCreateCategory(){
     909        check_ajax_referer( 'easyprayernonce' );
     910        global $wpdb;
     911
    913912        //updated new name in cata
    914913        $table_name = $wpdb->prefix . 'easy_prayer_categories';
     914
    915915        $data = array(
    916             'name'   => sanitize_text_field( $_POST['name'] ),
    917             'status' => sanitize_text_field( $_POST['status'] ),
     916            'name' => sanitize_text_field($_POST['name']),
     917            'status' => sanitize_text_field($_POST['status'])
    918918        );
     919
    919920        $updated = $wpdb->insert( $table_name, $data );
    920921        wp_die();
    921922    }
    922    
    923     add_action( 'wp_ajax_easy_prayer_create_categories', 'easyPrayerCreateCategory' );
     923    add_action('wp_ajax_easy_prayer_create_categories', 'easyPrayerCreateCategory');
     924
     925
    924926    //lists settings; called by getsettings.php
    925     function easyPrayerGetSettings()
    926     {
    927         check_ajax_referer( 'easyprayernonce' );
    928         global  $wpdb ;
    929         $arr = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}" . "easy_prayer_settings" );
     927    function easyPrayerGetSettings(){
     928        check_ajax_referer( 'easyprayernonce' );
     929        global $wpdb;
     930
     931        $arr = $wpdb->get_results("SELECT * FROM $wpdb->prefix"."easy_prayer_settings");
    930932        $string = '';
    931         foreach ( $arr as $results ) {
     933
     934        foreach($arr as $results){
    932935            $string .= '<span style="text-align: center;"><h1>Settings</h1></span>';
    933936            $string .= '<br>';
    934937            $string .= '<div>';
    935             $string .= '<div class="setting" id="' . esc_attr( $results->id ) . '">Setting: ' . esc_attr( $results->name ) . '</div>';
     938            $string .= '<div class="setting" id="' . esc_attr($results->id) . '">Setting: ' . esc_attr($results->name) .'</div>';
    936939            $string .= 'Status:<select id="settings_option" name="status">';
    937            
    938             if ( $results->status == 1 ) {
     940            if($results->status == 1){
    939941                $string .= '<option value="1" selected>Active</option>';
    940942                $string .= '<option value="0">Inactive</option>';
    941             } else {
     943            }else{
    942944                $string .= '<option value="1">Active</option>';
    943945                $string .= '<option value="0" selected>Inactive</option>';
    944946            }
    945            
    946947            $string .= '</select>';
    947948            $string .= '</div>';
    948949        }
    949         echo  $string ;
     950
     951        echo $string;
    950952        wp_die();
    951953    }
    952    
    953     add_action( 'wp_ajax_easy_prayer_get_settings', 'easyPrayerGetSettings' );
     954    add_action('wp_ajax_easy_prayer_get_settings', 'easyPrayerGetSettings');
     955
     956
    954957    //updates settings; called by getsettings.php
    955     function easyPrayerUpdateSettings()
    956     {
    957         check_ajax_referer( 'easyprayernonce' );
    958         global  $wpdb ;
    959         $table = $wpdb->prefix . "easy_prayer_settings";
    960         $data = [
    961             "status" => sanitize_text_field( $_POST['status'] ),
    962         ];
    963         $where = [
    964             "id" => sanitize_text_field( $_POST['id'] ),
    965         ];
     958    function easyPrayerUpdateSettings(){
     959        check_ajax_referer( 'easyprayernonce' );
     960        global $wpdb;
     961
     962        $table = $wpdb->prefix."easy_prayer_settings";
     963        $data = ["status" => sanitize_text_field($_POST['status'])];
     964        $where = ["id" => sanitize_text_field($_POST['id'])];
    966965        //approve request based on id
    967966        //set status to 1
    968         $wpdb->update( $table, $data, $where );
     967        $wpdb->update($table, $data, $where);
    969968        wp_die();
    970969    }
    971    
    972     add_action( 'wp_ajax_easy_prayer_update_settings', 'easyPrayerUpdateSettings' );
    973 }
     970    add_action('wp_ajax_easy_prayer_update_settings', 'easyPrayerUpdateSettings');
     971
     972?>
  • easy-prayer/trunk/help/readme.php

    r2267045 r2378212  
    11<?php
    2 
    3 if ( !defined( 'ABSPATH' ) ) {
     2if ( ! defined( 'ABSPATH' ) ) {
    43    exit;
    54}
     
    87<h3>Hello and thank you for downloading Easy Prayer!</h3>
    98        <p>Easy Prayer Upload form shortcode: [easy_prayer_form] </p>
    10         <p>Easy Prayer Upload form shortcode: <?php
    11 echo  "<b><i><a href='" . esc_url( admin_url( 'admin.php?page=easy-prayer%2Fphp%2Fadminpage.php-pricing', __FILE__ ) ) . "'>Premium Feature</a></i></b>" ;
    12 ?></p>
     9        <p>Easy Prayer Display Request shortcode: <?php
     10            echo '[easy_prayer_requests] , for styling info see below!';
     11
     12        ?></p>
    1313        <p>You can create and turn categories on and off to change what type of requests are displayed on the front-end. The feed is <b><i>LIVE</i></b>, So any updates you make on the back-end will show up in real time on the front-end.</p>
    1414<hr>
    15 <?php
    16 if ( ep_fs()->can_use_premium_code() ) {
    17     ?>
    1815<h3>Styling for [easy_prayer_requests]</h3>
    1916<p>If you would to style the information from [easy_prayer_requests], all elements outputted by the short code have unqiue ids</p>
     
    3027</ul>
    3128<hr>
    32 <?php
    33 }
    34 ?>
    3529
    3630<h4><b><i>Below is the required information that is required to upload a Request:</i></b></h4>
  • easy-prayer/trunk/js/adminpanel.js

    r2267045 r2378212  
    1 
    2 /* Premium Code Stripped by Freemius */
     1jQuery.noConflict();
     2var reload = false;
     3jQuery(document).on(jQuery.modal.AFTER_CLOSE, function () {
     4    if (reload == true) {
     5        location.reload();
     6    }
     7});
     8
     9var easy_prayer_filepath = easyPrayerParams.filepath;
     10jQuery(document).ready(function (jQuery) {
     11    var table = jQuery('#prayerTable').DataTable({
     12        dom: 'Blfrtip',
     13        "paging": true,
     14        "lengthMenu": [
     15            [10, 25, 50, 75, 100, -1],
     16            [10, 25, 50, 75, 100, "All"]
     17        ],
     18        "columnDefs": [{
     19            "visible": false,
     20            "targets": 0
     21        }],
     22        select: {
     23            toggleable: false
     24        },
     25        buttons: [{
     26            text: 'Approve Request',
     27            action: function (e, dt, node, conf) {
     28                //update status to approved based on comment id
     29
     30                //get selected rows and their id value
     31                var ids = jQuery(".selected");
     32
     33                //update loop
     34                for (i = 0; i < ids.length; i++) {
     35                    var updateid = ids[i].id;
     36                    //post data through prepared statement
     37                    jQuery.post(my_ajax_obj.ajax_url, { //POST request
     38                        _ajax_nonce: my_ajax_obj.nonce, //nonce
     39                        action: "easy_prayer_approve", //action
     40                        id: updateid //data
     41                    }, function (data) { //callback
     42                        //console.log(result);
     43                        location.reload();
     44                    });
     45
     46                }
     47
     48            }
     49        },
     50        {
     51            text: 'Trash Request',
     52            action: function (e, dt, node, conf) {
     53                //update status to approved based on comment id
     54                //get selected rows and their id value
     55                var ids = jQuery(".selected");
     56
     57                //update loop
     58                for (i = 0; i < ids.length; i++) {
     59                    var updateid = ids[i].id;
     60                    //post data through prepared statement
     61                    jQuery.post(my_ajax_obj.ajax_url, { //POST request
     62                        _ajax_nonce: my_ajax_obj.nonce, //nonce
     63                        action: "easy_prayer_trash", //action
     64                        id: updateid //data
     65                    }, function (data) { //callback
     66                        //console.log(result);
     67                        location.reload();
     68                    });
     69                }
     70            }
     71        },
     72        {
     73            text: 'Create Request',
     74            action: function (e, dt, node, conf) {
     75                jQuery.post(my_ajax_obj.ajax_url, { //POST request
     76                    _ajax_nonce: my_ajax_obj.nonce, //nonce
     77                    action: "easy_prayer_create_form", //action
     78                }, function (data) { //callback
     79                    // Add response in Modal body
     80                    jQuery('.create_modal-body').html(data);
     81
     82                    // Display Modal
     83                    jQuery('#create_request').modal({
     84                        fadeDuration: 150
     85                    });
     86
     87                    jQuery('form#createNew').on('submit', function (e) {
     88                        e.preventDefault();
     89                        var that = jQuery(this);
     90                        var fname = jQuery('#createfname').val();
     91                        var lname = jQuery('#createlname').val();
     92                        var email = jQuery('#createemail').val();
     93                        var request = jQuery('#createrequest').val();
     94                        var date = jQuery('#createdate').val();
     95                        var loca = jQuery('#createlocation').val();
     96                        var category = jQuery('#createcate').val();
     97                        var status = jQuery('#createstatus').val();
     98                        jQuery.post(my_ajax_obj.ajax_url, {
     99                            _ajax_nonce: my_ajax_obj.nonce, //nonce
     100                            action: "easy_prayer_create_request", //action
     101                            fname: fname,
     102                            lname: lname,
     103                            email: email,
     104                            request: request,
     105                            date: date,
     106                            loca: loca,
     107                            category: category,
     108                            status: status,
     109                        }, function (response) {
     110                            location.reload();
     111                        });
     112                    });
     113                });
     114            }
     115        },
     116        {
     117            text: 'Edit Request',
     118            action: function (e, dt, node, conf) {
     119
     120                var id = jQuery(".selected");
     121
     122                if (id.length == 1) {
     123                    jQuery.post(my_ajax_obj.ajax_url, { //POST request
     124                        _ajax_nonce: my_ajax_obj.nonce, //nonce
     125                        action: "easy_prayer_get_request", //action
     126                        id: id[0].id //data
     127                    }, function (data) { //callback
     128                        // Add response in Modal body
     129                        jQuery('.edit_modal-body').html(data);
     130
     131                        // Display Modal
     132                        jQuery('#edit_request').modal({
     133                            fadeDuration: 150
     134                        });
     135
     136                        jQuery('form#editRequest').on('submit', function (e) {
     137                            e.preventDefault();
     138
     139                            var that = jQuery(this);
     140                            var fname = jQuery('#editfname').val();
     141                            var lname = jQuery('#editlname').val();
     142                            var email = jQuery('#editemail').val();
     143                            var request = jQuery('#editrequest').val();
     144                            var loca = jQuery('#editlocation').val();
     145                            var category = jQuery('#editcate').val();
     146                            var status = jQuery('#editstatus').val();
     147                            var editid = jQuery('#editid').val();
     148                            jQuery.post(my_ajax_obj.ajax_url, {
     149                                _ajax_nonce: my_ajax_obj.nonce, //nonce
     150                                action: "easy_prayer_edit_request", //action
     151                                fname: fname,
     152                                lname: lname,
     153                                email: email,
     154                                request: request,
     155                                loca: loca,
     156                                category: category,
     157                                status: status,
     158                                id: editid,
     159                            }, function (response) {
     160                                location.reload();
     161                            });
     162                        });
     163                    });
     164                } else {
     165                    alert("Please Select a Prayer Request");
     166                }
     167            }
     168        },
     169        {
     170            extend: 'collection',
     171            text: 'Export',
     172            buttons: [
     173                'csv',
     174                'excel',
     175                'pdf',
     176                'print'
     177            ]
     178        },
     179        {
     180            extend: 'collection',
     181            text: 'Categories and Settings',
     182            buttons: [{
     183                text: 'Categories',
     184                action: function (e, dt, node, conf) {
     185                    jQuery.post(my_ajax_obj.ajax_url, { //POST request
     186                        _ajax_nonce: my_ajax_obj.nonce, //nonce
     187                        action: "easy_prayer_get_categories", //action
     188                    }, function (data) { //callback
     189                        // Add response in Modal body
     190
     191                        jQuery('.cate_modal-body').html(data);
     192
     193                        // Display Modal
     194                        jQuery('#category').modal({
     195                            fadeDuration: 150
     196                        });
     197
     198                        jQuery('#category').click();
     199
     200                        //listener for text change
     201                        var divlistener = jQuery("#category div").change(function (event) {
     202                            var optionSelected = jQuery("option:selected", this);
     203                            var nameSelected = jQuery("input:text", this);
     204                            jQuery.post(my_ajax_obj.ajax_url, { //POST request
     205                                _ajax_nonce: my_ajax_obj.nonce, //nonce
     206                                action: "easy_prayer_edit_categories", //action
     207                                id: event.currentTarget.id,
     208                                status: optionSelected[0].value,
     209                                name: nameSelected[0].value,
     210                            }, function (data) { //callback
     211                                reload = true;
     212                            });
     213                        });
     214
     215                        //listener for delete button
     216                        var buttonSelected = jQuery(".delete").on('click', function (event) {
     217                            jQuery.post(my_ajax_obj.ajax_url, { //POST request
     218                                _ajax_nonce: my_ajax_obj.nonce, //nonce
     219                                action: "easy_prayer_delete_categories", //action
     220                                id: event.currentTarget.id,
     221                            }, function (data) { //callback
     222                            });
     223
     224                            jQuery(this).text("DELETED");
     225                            jQuery(this).css("background-color", "red");
     226                            jQuery(this).css("border: 2px solid", "red");
     227                            jQuery(this).css("border-radius", "5px");
     228                            jQuery(this).parent().parent().fadeOut();
     229                        });
     230
     231                        //listener for create button
     232                        var create = jQuery(".create_cate").on('click', function (event) {
     233                            jQuery("#category div").unbind();
     234                            jQuery.post(my_ajax_obj.ajax_url, { //POST request
     235                                _ajax_nonce: my_ajax_obj.nonce, //nonce
     236                                action: "easy_prayer_create_categories_form", //action
     237                            }, function (data) { //callback
     238                                // Add response in Modal body
     239                                jQuery('.cate_modal-body').html(data);
     240                                //listener for create category button
     241                                var createCategory = jQuery("#create_category").on('click', function (event) {
     242                                    var name = jQuery('input:text');
     243                                    var status = jQuery('#category_option');
     244                                    //post data, and reload edit screen
     245                                    jQuery.post(my_ajax_obj.ajax_url, { //POST request
     246                                        _ajax_nonce: my_ajax_obj.nonce, //nonce
     247                                        action: "easy_prayer_create_categories", //action
     248                                        name: name[0].value,
     249                                        status: status[0].value
     250                                    }, function (data) { //callback
     251                                        location.reload();
     252                                    });
     253                                });
     254                            });
     255                        });
     256
     257
     258                        //bottom of get_categories
     259                    });
     260                }
     261            },
     262                /*{
     263                    text: 'Auto Approve Settings',
     264                    action: function (e, dt, node, conf) {
     265                        jQuery.post(my_ajax_obj.ajax_url, { //POST request
     266                            _ajax_nonce: my_ajax_obj.nonce, //nonce
     267                            action: "easy_prayer_get_settings", //action
     268                        }, function (data) { //callback
     269                            // Add response in Modal body
     270                            jQuery('.settings_modal-body').html(data);
     271
     272                            // Display Modal
     273                            jQuery('#settings').modal({
     274                                fadeDuration: 150
     275                            });
     276
     277
     278                            jQuery('#settings').click();
     279
     280                            var div = jQuery("#settings div").change(function (event) {
     281                                var optionSelected = jQuery("option:selected", this);
     282                                var id = jQuery(".setting");
     283
     284                                jQuery.post(my_ajax_obj.ajax_url, { //POST request
     285                                    _ajax_nonce: my_ajax_obj.nonce, //nonce
     286                                    action: "easy_prayer_update_settings", //action
     287                                    id: id[0].id,
     288                                    status: optionSelected[0].value,
     289                                }, function (data) { //callback
     290                                });
     291                            });
     292                        });
     293                    }
     294                },*/
     295            ]
     296        },
     297        ],
     298        "fnInitComplete": function (oSettings, json) {
     299            jQuery("#overlay").fadeOut(400);
     300        }
     301    });
     302});
  • easy-prayer/trunk/readme.txt

    r2267524 r2378212  
    88Tested up to:      5.3.2
    99Requires at least: 5.3.0
    10 Stable tag:        1.0
    11 Version:           1.0
     10Stable tag:        1.1
     11Version:           1.1
    1212Requires PHP:      7.1
    1313
Note: See TracChangeset for help on using the changeset viewer.