Plugin Directory

Changeset 2833215


Ignore:
Timestamp:
12/13/2022 06:45:33 PM (3 years ago)
Author:
appexpertsio
Message:

release 8, v1.3.4

Location:
appexperts/trunk
Files:
17 added
57 edited

Legend:

Unmodified
Added
Removed
  • appexperts/trunk/app-expert.php

    r2808834 r2833215  
    33Plugin Name: AppExperts
    44Description: Integrate App Experts builder functionality with your wordpress website
    5 Version: 1.3.3
     5Version: 1.3.4
    66Author: AppExperts
    77Author URI: https://appexperts.io/
     
    8484//todo:find a better way
    8585
    86 const APP_EXPERT_PLUGIN_VERSION = '1.3.3';  // used in assets
     86const APP_EXPERT_PLUGIN_VERSION = '1.3.4';  // used in assets
    8787const APP_EXPERT_API_NAMESPACE = 'app-expert/v1';
    8888
  • appexperts/trunk/includes/features/authentication/apis/endpoints/app-expert-user-endpoint.php

    r2808832 r2833215  
    2727        $request = App_Expert_Profile_Helper::remove_user_meta_data_update($request);
    2828
     29        $res = $this->update_user_meta($request, $user_id);
     30            if (is_wp_error($res))
     31                return $res;
    2932
    3033        $response = parent::update_item($request);
    3134        if (is_wp_error($response))
    3235            return $response;
    33 
    34         do_action('ae_user_update_profile',$request, $user_id);
    3536
    3637        return App_Expert_Response::wp_rest_success(
     
    4748    {
    4849
    49         $mobile_number = $request->get_param('mobile_number');
     50        $mobile_number = $request->get_param('phone');
    5051        $firebase_access_token = $request->get_param('firebase_access_token');
    51         $birthdate = $request->get_param('birthdate');
    52         $gender = $request->get_param('gender');
    5352
    5453        if(isset($firebase_access_token)){
     
    101100
    102101        }
    103         if(isset($gender)){
    104             $user_query = new WP_User_Query(
    105                 array(
    106                     'user_id'    =>    $user_id,
    107                     'meta_key'    =>    'gender',
    108                 )
    109             );
    110             // Get the results from the query
    111             $users = $user_query->get_results();
    112             if($users){
    113                 update_user_meta( $user_id, 'gender', $gender);
    114             }else{
    115                 add_user_meta( $user_id, 'gender', $gender);
    116             }
    117         }
    118         if(isset($birthdate)){
    119             $user_query = new WP_User_Query(
    120                 array(
    121                     'user_id'    =>    $user_id,
    122                     'meta_key'    =>    'birthdate',
    123                 )
    124             );
    125             // Get the results from the query
    126             $users = $user_query->get_results();
    127             if($users){
    128                 update_user_meta( $user_id, 'birthdate', $birthdate);
    129             }else{
    130                 add_user_meta( $user_id, 'birthdate', $birthdate);
    131             }
    132         }
    133102        return $user_id;
    134103    }
     
    138107        $user_id=get_current_user_id();
    139108        require_once(ABSPATH.'wp-admin/includes/user.php' );
    140         $success = wp_delete_user($user_id,0);
     109        $success = wp_delete_user($user_id);
    141110        return App_Expert_Response::success("app_expert_delete_user_success",
    142111            'User deleted sueccssfully',["result"=>$success]
  • appexperts/trunk/includes/features/authentication/apis/routes/app-expert-user-profile-routes.php

    r2808832 r2833215  
    6161                'type'        => 'string',
    6262                'context'     => array( 'edit' ),
     63            ),
     64            'phone'        => array(
     65                'description' => __( 'User phone' , 'app-expert' ),
     66                'type'        => 'string',
     67                'context'     => array( 'edit' ),
    6368            )
    6469        ];
  • appexperts/trunk/includes/features/authentication/helpers/app-expert-user-response-helper.php

    r2789917 r2833215  
    9191        $data['login_type'] = $user_logged_in_by_mobile?"phone_otp":"user_password";
    9292
     93        $data=apply_filters('ae_login_user_data_object',$data,new WP_REST_Request(),$user);
     94
    9395        return $data;
    9496    }
  • appexperts/trunk/includes/features/notification/backend/app-expert-notification-settings.php

    r2789917 r2833215  
    88        add_filter('ae_settings_tabs',array($this, 'add_notification_tab'), 10, 1);
    99        add_action('admin_init', [$this, 'register_settings']);
    10 
     10        add_filter('ae_daily_log_custom_settings',array($this,"add_logs"));
    1111    }
    1212
     
    4848        return $tabs;
    4949    }
     50    public function add_logs($settings_array){
     51        $server_key = get_option('server_key');
     52        $settings_array['notification']=   [
     53            "is_allowed"=>!empty($server_key)?"yes":"no",
     54            "automatic_send_allowed"=>get_option('notification_options')
     55        ];
     56
     57        return $settings_array;
     58    }
    5059
    5160}
  • appexperts/trunk/includes/features/notification/helpers/app-expert-notification-helper.php

    r2808832 r2833215  
    125125        $_notification['content'] = $_notification['content'][$_lang];
    126126
     127        $_notification =  apply_filters("ae_send_push_notification_object",$_notification,$_lang);
     128
    127129        if(!is_array($_user_token))$_user_token=[$_user_token];
    128130        foreach ($_user_token as $token){
     
    138140        $_notification['title'] =json_decode($_notification['title'],true);
    139141        $_notification['content'] =json_decode($_notification['content'],true);
    140 
    141142        $_langs = App_Expert_Language::get_active_languages();
    142143        foreach($_langs as $lang=>$obj){
    143144           $id="'$lang' in topics".(!empty($segments)?" && ($segments)":"");
     145           $_notification =  apply_filters("ae_send_push_notification_object",$_notification,$lang);
    144146           App_Expert_FCM_Helper::send_message($_notification['title'][$lang],$_notification['content'][$lang],$id,$_notification,'topic',$_notification['attachment']);
    145147        }
  • appexperts/trunk/includes/init/abstracts/app-expert-integration.php

    r2808832 r2833215  
    55        $this->_include_files();
    66        $this->_include_hooks();
     7        add_filter('ae_daily_log_custom_integration',array($this,"add_logs"));
    78    }
    89
     
    1112    abstract public function get_current_path();
    1213    abstract public function get_dependencies();
     14    abstract public function add_logs($arr);
    1315
    1416    private function _include_files(){
     
    5153            glob($this->get_dir()."frontend/*.php"),
    5254            glob($this->get_dir()."apis/middlewares/*.php"),
     55            glob($this->get_dir()."apis/serializers/*.php"),
    5356            glob($this->get_dir()."apis/modifications/*.php")
    5457        );
     
    5861            glob( $this->get_dir()."apis/requests/*.php"),
    5962            glob( $this->get_dir()."apis/helpers/*.php"),
    60             glob( $this->get_dir()."apis/serializers/*.php"),
    6163            glob( $this->get_dir()."apis/endpoints/*.php"),
    6264            glob( $this->get_dir()."apis/routes/*.php")
  • appexperts/trunk/includes/init/common/app-expert-route.php

    r2789917 r2833215  
    3636
    3737            $validation_class=new $validator($request);
     38            $logs_data=[
     39                "request"=>$request->get_params(),
     40                "request_files"=>$request->get_file_params(),
     41                "request_headers"=>$request->get_headers(),
     42                "request_"=>$request->get_content_type(),
     43               ];
    3844            if($validation_class->validate()){
    39                 return (new $call_back_class())->$call_back_method($request);
     45                $response= (new $call_back_class())->$call_back_method($request);
     46                $logs_data["response"]=$response;
     47                App_Expert_Logger::info("Api Call {$request->get_route()} : success",$logs_data);
     48                return $response;
    4049            }
    4150            $error = $validation_class->getErrors();
     51            $logs_data["errors"]=$error;
     52            App_Expert_Logger::error("Api Call {$request->get_route()} : Validation Errors",$logs_data);
    4253            return count($error)?$error[0]:new WP_Error("something_went_wrong","error from App_Expert_Routes:add",[]);
    4354        }catch (Exception $e){
     55            $logs_data["exception"]=$e->getMessage();
     56            App_Expert_Logger::fatal("Api Call {$request->get_route()} : Exception",$logs_data);
    4457            return App_Expert_Response::fail("something_went_wrong",$e->getMessage(),[]);
    4558        }
  • appexperts/trunk/includes/integrations/contact-form-7/app-expert-contact-form-7-init.php

    r2800813 r2833215  
    1919    }
    2020
     21    public function add_logs($arr){
     22        $arr[] ='contact-form-7';
     23        return $arr;
     24    }
    2125}
    2226new App_Expert_Contact_Form_7_Init();
  • appexperts/trunk/includes/integrations/freemius/app-expert-freemius-init.php

    r2789917 r2833215  
    1313    public function get_dependencies(){
    1414        return [];
     15    }
     16    public function add_logs($arr){
     17        $arr[] ='freemius';
     18        return $arr;
    1519    }
    1620
  • appexperts/trunk/includes/integrations/peepso-core/apis/endpoints/app-expert-peepso-core-members-endpoint.php

    r2808832 r2833215  
    88        $ajax->set_follow_status($resp);
    99        $val=$request->get_param('follow');
    10         $msg="un-follow done successfully";
    11         if($val) $msg="follow done successfully";
     10        $msg=__("un-follow done successfully",'app-expert');
     11        if($val) $msg=__("follow done successfully",'app-expert');
    1212        if($resp->success){
    13             return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,['message'=>translate($msg,'app-expert')]);
     13            return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,['message'=>$msg]);
    1414        }
    1515        return  App_Expert_Peepso_Core_Response_Helper::fail_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,$resp->errors);
  • appexperts/trunk/includes/integrations/peepso-core/apis/endpoints/app-expert-peepso-core-post-endpoint.php

    r2808832 r2833215  
    66        $_POST['id'] = get_current_user_id();
    77        $_POST['uid']= $request->get_param('profile_id')??0;
     8        if($request->get_param('group_id')){
     9            $_POST['group_id'] = (int)$_POST['group_id'];
     10        }
    811        $result = apply_filters('ae_peepso_handle_add_post_request', $_POST, $request);
    912        if(is_wp_error($result)){
     
    2932        $_POST['page']    = isset($_POST['page'])?(int)$_POST['page']:1;
    3033        $_POST['pinned']  = ($_POST['page']<2)?1:0;
     34        if($request->get_param('group_id')){
     35            $_POST['group_id'] = (int)$_POST['group_id'];
     36        }
    3137        $_POST = apply_filters('ae_peepso_handle_get_post_request', $_POST,$request);
    3238
     
    129135        return App_Expert_Peepso_Core_Response_Helper::success_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS, ['message'=>"this post has been unpinned successfully"]);
    130136    }
     137
     138    public function report(WP_REST_Request $request){
     139        $_POST = array_merge($_POST,$request->get_params());
     140        $_POST['uid'] = get_current_user_id();
     141        $PeepSoActivity   = new PeepSoActivity();
     142        $resp = new PeepSoAjaxResponse();
     143        $PeepSoActivity->report($resp);
     144        if($resp->success){
     145            $resp->set('msg',count($resp->notices)?$resp->notices[0]:__('This item has been reported', 'peepso-core'));
     146            return App_Expert_Peepso_Core_Response_Helper::success_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS, $resp->data);
     147        }
     148        return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,$resp->errors);
     149
     150    }
     151
     152    public function submit_vote(WP_REST_Request $request){
     153        $_POST = array_merge($_POST,$request->get_params());
     154
     155        $PeepSoPollsAjax = PeepSoPollsAjax::get_instance();
     156        $resp = new PeepSoAjaxResponse();
     157        $PeepSoPollsAjax->submit_vote($resp);
     158        if($resp->success){
     159            $resp->set('msg',__('Vote added.', 'peepso-core'));
     160            unset($resp->data['html']);
     161            return App_Expert_Peepso_Core_Response_Helper::success_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS, $resp->data);
     162        }
     163        return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,$resp->errors);
     164    }
     165
     166    public function change_vote(WP_REST_Request $request){
     167        $_POST = array_merge($_POST,$request->get_params());
     168
     169        $PeepSoPollsAjax = PeepSoPollsAjax::get_instance();
     170        $resp = new PeepSoAjaxResponse();
     171        $PeepSoPollsAjax->change_vote($resp);
     172        if($resp->success){
     173            $resp->set('msg',__('Vote retrived', 'peepso-core'));
     174            unset($resp->data['html']);
     175            $post_id = $_POST['poll_id'];
     176            $user_id = $_POST['user_id'];
     177            $polls_model = new PeepSoPollsModel();
     178            $user_polls = $polls_model->get_user_polls($user_id, $post_id);
     179
     180            $max_answers = (int) get_post_meta($post_id, 'max_answers', TRUE);
     181            $options = unserialize(get_post_meta($post_id, 'select_options', TRUE));
     182            $total_user_poll = get_post_meta($post_id, 'total_user_poll', TRUE);
     183
     184            $resp->data = array(
     185                'id' => $post_id,
     186                'options' => (is_array($options) && count($options) > 1) ? $options : array(),
     187                'type' => $max_answers === 0 ? 'checkbox' : 'radio',
     188                'enabled' => TRUE,
     189                'is_voted' => FALSE,
     190                'total_user_poll' => $total_user_poll,
     191                'user_polls' => $user_polls
     192            );
     193            return App_Expert_Peepso_Core_Response_Helper::success_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS, $resp->data);
     194        }
     195        return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,$resp->errors);
     196    }
     197
     198    public function unvote(WP_REST_Request $request){
     199        $_POST = array_merge($_POST,$request->get_params());
     200
     201        $PeepSoPollsAjax = PeepSoPollsAjax::get_instance();
     202        $resp = new PeepSoAjaxResponse();
     203        $PeepSoPollsAjax->unvote($resp);
     204        if($resp->success){
     205            $resp->set('msg',__('Vote deleted.', 'peepso-core'));
     206            unset($resp->data['html']);
     207            return App_Expert_Peepso_Core_Response_Helper::success_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS, $resp->data);
     208        }
     209        return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,$resp->errors);
     210    }
    131211}
  • appexperts/trunk/includes/integrations/peepso-core/apis/endpoints/app-expert-peepso-core-users-endpoint.php

    r2808832 r2833215  
    3535    }
    3636
     37    public function report(WP_REST_Request $request){
     38       // profile.report
     39        $peepso_profile = PeepSoProfile::get_instance();
     40        $_POST = array_merge($_POST,$request->get_params());
     41        $resp = new PeepSoAjaxResponse();
     42        $peepso_profile->report($resp);
     43        if($resp->success){
     44            $resp->set('msg',count($resp->notices)?$resp->notices[0]:__('This item has been reported', 'peepso-core'));
     45            return App_Expert_Peepso_Core_Response_Helper::success_response( App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS, $resp->data);
     46        }
     47        return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,$resp->errors);
     48
     49    }
     50
     51    public function get_followers(WP_REST_Request $request) {
     52        $user_id = $request->get_param('user_id')?:get_current_user_id();
     53        $page = $request->get_param('page')?:1;
     54
     55        // default limit is 1 (NewScroll)
     56        $limit = $request->get_param('limit')?:1;
     57
     58        $offset = ($page - 1) * $limit;
     59
     60        if ($page < 1) {
     61            $page = 1;
     62            $offset = 0;
     63        }
     64
     65        $users =  PeepSoUserFollower::get_followers([
     66            'offset' => $offset,
     67            'limit' => $limit,
     68            'user_id' => $user_id
     69        ]);
     70        foreach ($users as $i=>$u){
     71            $users[$i] = (new App_Expert_User_Serializer(PeepSoUser::get_instance($u->uf_active_user_id)))->get();
     72        }
     73        return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,$users);
     74
     75    }
     76
     77
     78    public function get_following(WP_REST_Request $request) {
     79        $user_id = $request->get_param('user_id')?:get_current_user_id();
     80        $page = $request->get_param('page')?:1;
     81
     82        // default limit is 1 (NewScroll)
     83        $limit = $request->get_param('limit')?:1;
     84
     85        $offset = ($page - 1) * $limit;
     86
     87        if ($page < 1) {
     88            $page = 1;
     89            $offset = 0;
     90        }
     91
     92        $users =  PeepSoUserFollower::get_following([
     93            'offset' => $offset,
     94            'limit' => $limit,
     95            'user_id' => $user_id
     96        ]);
     97        foreach ($users as $i=>$u){
     98            $users[$i] = (new App_Expert_User_Serializer(PeepSoUser::get_instance($u->uf_passive_user_id)))->get();
     99        }
     100        return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,$users);
     101
     102    }
    37103
    38104
  • appexperts/trunk/includes/integrations/peepso-core/apis/modifications/app-expert-peepso-core-notification.php

    r2808832 r2833215  
    2020    public function add_additional_params($_notification){
    2121        if(in_array($_notification->type,$this->notification_types)){
    22             $_notification->title = __($_notification->title,'peepso-core');
    23             $record   = App_Expert_Peepso_Core_Notification_helper::get_notification($_notification->object_id);
    24             $PeepSoUser  = PeepSoUser::get_instance($record->not_from_user_id);
    25             $_notification->user_sending_notification_data = (new App_Expert_User_Serializer($PeepSoUser))->get();
    26             $activities = PeepSoActivity::get_instance();
    27             $preview = get_post_meta($record->not_external_id,'peepso_human_friendly', TRUE);
    28             if(!is_array($preview) && strlen($preview)) {
    29                 $preview = trim(
    30                     truncateHtml($preview,
    31                         PeepSo::get_option('notification_preview_length',50),
    32                         PeepSo::get_option('notification_preview_ellipsis','...'),
    33                         false, FALSE)
    34                 );
    35             }
    36             $preview = (string)$preview?:"";
    37             $_notification->content = $preview;
    38             if($record){
    39                 switch($_notification->type){
    40                     case 'wall_post':
    41                     case 'tag':
    42                         $_notification->object_id = $record->act_id;
    43                         break;
    44                     case 'user_comment':
    45                     case 'tag_comment':
    46                     case 'stream_reply_comment':
    47                         $not_activity = $activities->get_activity_data($record->not_external_id, $record->not_module_id);
    48                         $_notification->comment_activity_id = $not_activity->act_id;
    49                         $parent_activity = $activities->get_activity_data($not_activity->act_comment_object_id, $not_activity->act_comment_module_id);
    50                         $_notification->object_id = $parent_activity->act_id;
    51                         break;
    52                     case 'like_post':
    53                         $not_activity = $activities->get_activity_post($record->not_act_id);
    54                         $_notification->object_id =$not_activity->act_id;
    55                         if($not_activity->post_type ==="peepso-comment"){
    56                             $not_activity = $activities->get_activity_data($not_activity->act_comment_object_id, $not_activity->act_comment_module_id);
    57                             $_notification->object_id =$not_activity->act_id;
    58                         }
    59                 }
    60             }
     22            $_notification = App_Expert_Peepso_Core_Notification_helper::get_extra_data($_notification);
    6123        }
    6224        return $_notification;
  • appexperts/trunk/includes/integrations/peepso-core/apis/modifications/app-expert-peepso-core-settings.php

    r2808832 r2833215  
    2020        }
    2121
    22         $data['reactions'] = $reactions;
     22        $data['reactions'] = $reactions;   
    2323
    2424        $data['privacy'] = $this->getPrivacyData();
     25        $data['hashtags'] = $this->get_hashtag_settings();
     26        $data['post_backgrounds'] = $this->get_post_background_settings();
     27        $data['giphy'] = $this->get_post_giphy_settings();
     28        $data['polls'] = $this->get_post_polls_settings();
    2529
    2630        $moods = PeepSoMoods::get_instance();
     
    4852        }
    4953        $data['plugins'] = $plugins;
    50 //        $reasons = str_replace("\r", '', PeepSo::get_option('site_reporting_types', __('Spam', 'peepso-core')));
    51 //        $reasons = explode("\n", $reasons);
    52 //        $reasons = apply_filters('peepso_activity_report_reasons', $reasons);
    53 //        $reasons[] = "Other";
    54 //        $data['reporting_reasons'] = $reasons;
     54        $reasons = str_replace("\r", '', PeepSo::get_option('site_reporting_types', __('Spam', 'peepso-core')));
     55        $reasons = explode("\n", $reasons);
     56        $reasons = apply_filters('peepso_activity_report_reasons', $reasons);
     57        $reasons[] = "Other";
     58        $reasons_translated = [];
     59        foreach ($reasons as $reason){
     60            $reason = esc_attr($reason);
     61            $reason = stripslashes($reason);
     62            $reasons_translated[] =[
     63                "value"=>$reason,
     64                "label"=>__($reason, 'peepso-core')
     65            ];
     66        }
     67        $data['site_reporting'] = (string)PeepSo::get_option('site_reporting_enable');
     68
     69        $data['reporting_reasons'] = $reasons_translated;
     70        $data['location'] = [
     71            'location_enable'=>PeepSo::get_option('location_enable', 0),
     72            'location_gmap_api_key'=>PeepSo::get_option('location_gmap_api_key',''),
     73        ];
     74        $data['mentions']=[
     75            'tags_enable'=>PeepSo::get_option('tags_enable', 0),
     76            'mentions_auto_on_comment_reply'=>PeepSo::get_option('mentions_auto_on_comment_reply',0),
     77        ];
    5578        return $data;
    5679    }
     
    79102
    80103    }
     104
     105    private function get_hashtag_settings (){
     106        $settings = array();
     107        $settings['hashtags_enable'] = (string)PeepSo::get_option('hashtags_enable', 1);
     108        $settings['hashtags_post_count_interval'] =  (string)PeepSo::get_option('hashtags_post_count_interval', 60);
     109        $settings['hashtags_post_count_batch_size'] =  (string)PeepSo::get_option('hashtags_post_count_batch_size', 5);
     110        $settings['hashtags_delete_empty'] =  (string)PeepSo::get_option('hashtags_delete_empty', 1);
     111        $settings['hashtags_everything'] =  (string)PeepSo::get_option('hashtags_everything', 0);
     112        $settings['hashtags_min_length'] =  (string)PeepSo::get_option('hashtags_min_length', 3);
     113        $settings['hashtags_max_length'] =  (string)PeepSo::get_option('hashtags_max_length', 16);
     114        $settings['hashtags_must_start_with_letter'] =  (string)PeepSo::get_option('hashtags_must_start_with_letter', 0);
     115        $settings['hashtags_rebuild'] =  (string)PeepSo::get_option('hashtags_rebuild', 0);
     116        return $settings;
     117    }
     118
     119    private function get_post_background_settings (){
     120        $settings = array();
     121        $settings['post_backgrounds_enable'] =  (string)PeepSo::get_option('post_backgrounds_enable', 0);
     122        $settings['post_backgrounds_max_length'] =  (string)PeepSo::get_option('post_backgrounds_max_length',150);
     123        $settings['post_backgrounds_max_linebreaks'] =  (string)PeepSo::get_option('post_backgrounds_max_linebreaks', 0);
     124        $PeepSoPostBackgroundsModel = new PeepSoPostBackgroundsModel(FALSE);
     125        $backgrounds = $PeepSoPostBackgroundsModel->post_backgrounds;
     126        foreach ($backgrounds as $background){
     127
     128            $text_color = $background->content->text_color;
     129            if(strpos($text_color, 'rgba') === 0){
     130                $background->content->text_color = $this->change_color_rgba_to_hex($text_color);
     131            }
     132
     133            $background_color = $background->content->background_color;
     134            if(strpos($background_color, 'rgba') === 0){
     135                $background->content->background_color = $this->change_color_rgba_to_hex($background_color);
     136            }
     137
     138            $text_shadow_color = $background->content->text_shadow_color;
     139            if(strpos($text_shadow_color, 'rgba') === 0){
     140                $background->content->text_shadow_color = $this->change_color_rgba_to_hex($text_shadow_color);
     141            }
     142        }
     143
     144        $settings['backgrounds'] = $PeepSoPostBackgroundsModel->post_backgrounds;
     145        return $settings;
     146    }
     147
     148    private function get_post_giphy_settings (){
     149
     150        $settings = array();
     151        $settings['giphy_api_key'] =  (string)PeepSo::get_option('giphy_api_key');
     152        $settings['giphy_display_limit'] =  (string)PeepSo::get_option('giphy_display_limit',25);
     153        $settings['giphy_rating'] =  (string)PeepSo::get_option('giphy_rating', '');
     154        $settings['giphy_posts_enable'] =  (string)PeepSo::get_option('giphy_posts_enable', 1);
     155        $settings['giphy_rendition_posts'] =  (string)PeepSo::get_option('giphy_rendition_posts', 'original');
     156        $settings['giphy_comments_enable'] =  (string)PeepSo::get_option('giphy_comments_enable', 1);
     157        $settings['giphy_rendition_comments'] =  (string)PeepSo::get_option('giphy_rendition_comments', 'fixed_width');
     158        return $settings;
     159    }
     160
     161    private function change_color_rgba_to_hex ($color){
     162        $color = str_replace( ' ', '', $color );
     163        sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
     164
     165        $output = "#";
     166        $output.= dechex((1 - $alpha) * $red + $alpha * $red);
     167        $output.= dechex((1 - $alpha) * $green + $alpha * $green);
     168        $output.= dechex((1 - $alpha) * $blue + $alpha * $blue);
     169        return $output;
     170    }
     171
     172    private function get_post_polls_settings (){
     173       
     174        $settings = array();
     175        $settings['polls_enable'] =  (string)PeepSo::get_option('polls_enable', 1);
     176        $settings['polls_multiselect'] =  (string)PeepSo::get_option('polls_multiselect',1);
     177        $settings['polls_changevote'] =  (string)PeepSo::get_option('polls_changevote', 0);
     178        $settings['polls_show_result_before_vote'] =  (string)PeepSo::get_option('polls_show_result_before_vote', 0);
     179        $settings['polls_sort_result_by_votes'] =  (string)PeepSo::get_option('polls_sort_result_by_votes', 0);
     180        return $settings;
     181    }
    81182}
    82183new App_Expert_Peepso_Core_Settings();
  • appexperts/trunk/includes/integrations/peepso-core/apis/requests/app-expert-add-post-request.php

    r2808832 r2833215  
    2323        $val = $this->request->get_param("type");
    2424        //todo:add_apply filter
    25         $types = array('activity', 'audio', 'video', 'photo', 'files');
     25        $types = array('activity', 'audio', 'video', 'photo', 'files', 'post_backgrounds', 'giphy', 'poll');
    2626        if (!in_array($val, $types)) {
    27             return $this->get_validation_error("invalid_type", "type", __("Invalid parameter(s): type", "app-expert"), __("type should be activity, video, audio, photo or files", "app-expert"));
     27            return $this->get_validation_error("invalid_type", "type", __("Invalid parameter(s): type", "app-expert"), __("type should be activity, video, audio, photo , post_backgrounds or files", "app-expert"));
    2828        }
    2929        return true;
     
    6060        $val = $this->request->get_param("url");
    6161        $type = $this->request->get_param("type");
    62         if (($type === 'video' || $type === 'audio') && empty($val)) {
     62        $video = $this->request->get_param("video");
     63        $audio = $this->request->get_param("audio");
     64
     65        if (($type === 'video' || $type === 'audio') && empty($val) && empty($video) && empty($audio)) {
    6366            return $this->get_validation_error("empty_url", "url", __("Invalid parameter(s): url", "app-expert"), __("url should not be empty once type of post is video or audio", "app-expert"));
    6467        }
  • appexperts/trunk/includes/integrations/peepso-core/apis/routes/app-expert-peepso-core-comment-routes.php

    r2808832 r2833215  
    2929                'required' => true
    3030            ),
     31            'giphy'        => array(
     32                'description' => __( 'giphy url' , 'app-expert' ),
     33                'type'        => 'string',
     34                'required' => false
     35            )
    3136        ]);
    3237    }
  • appexperts/trunk/includes/integrations/peepso-core/apis/routes/app-expert-peepso-core-routes.php

    r2808832 r2833215  
    1717        App_Expert_Route::delete(PEEPSO_CORE_API_NAMESPACE, '/posts/delete', "App_Expert_Peepso_Core_Post_Endpoint@delete" , $this->delete_post_parameters(), "App_Expert_Auth_Request");
    1818        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/posts/pin', "App_Expert_Peepso_Core_Post_Endpoint@pin" , $this->pin_post_parameters(), "App_Expert_Auth_Request");
     19        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/posts/report', "App_Expert_Peepso_Core_Post_Endpoint@report" , $this->report_post_parameters(), "App_Expert_Auth_Request");
     20        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/posts/poll/vote', "App_Expert_Peepso_Core_Post_Endpoint@submit_vote" , $this->vote_post_parameters(), "App_Expert_Auth_Request");
     21        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/posts/poll/vote/change', "App_Expert_Peepso_Core_Post_Endpoint@change_vote" , $this->change_vote_post_parameters(), "App_Expert_Auth_Request");
     22        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/posts/poll/vote/delete', "App_Expert_Peepso_Core_Post_Endpoint@unvote" , $this->delete_vote_post_parameters(), "App_Expert_Auth_Request");
     23
    1924    }
    2025
     
    9095            ),
    9196            'type'        => array(
    92                 'description' => __( 'type of the post Allowed values are(activity,files,photo,audio Or video).' , 'app-expert' ),
     97                'description' => __( 'type of the post Allowed values are(activity, files, photo, audio, video, giphy, poll or post_backgrounds).' , 'app-expert' ),
    9398                'type'        => 'string',
    9499                'required' => false
     
    97102                'description' => __( 'to schedule posting.' , 'app-expert' ),
    98103                'type'        => 'date',
     104                'required' => false
     105            ),
     106            'options'        => array(
     107                'description' => __( 'required if type is poll.' , 'app-expert' ),
     108                'type'        => 'array',
     109                'required' => false
     110            ),
     111            'location'        => array(
     112                'description' => __( 'add location to the post if allowed. location should have "name","latitude" and "longitude".' , 'app-expert' ),
     113                'type'        => 'Object',
     114                'required' => false
     115            ),
     116            'preset_id'        => array(
     117                'description' => __( 'post id of post background get it from app-expert settings api post_background section -> backgrounds array of objects, it is required if type = post_backgrounds' , 'app-expert' ),
     118                'type'        => 'integer',
     119                'required' => false
     120            ),
     121            'text_color'        => array(
     122                'description' => __( 'text color of post background get it from app-expert settings api post_background section -> backgrounds array of objects, it is required if type = post_backgrounds' , 'app-expert' ),
     123                'type'        => 'string',
     124                'required' => false
     125            ),
     126            'background'        => array(
     127                'description' => __( 'image url of post background get it from app-expert settings api post_background section -> backgrounds array of objects, it is required if type = post_backgrounds' , 'app-expert' ),
     128                'type'        => 'string',
     129                'required' => false
     130            ),
     131            'giphy'        => array(
     132                'description' => __( 'giphy url , it is required if type = giphy' , 'app-expert' ),
     133                'type'        => 'string',
     134                'required' => false
     135            ),
     136            'options'        => array(
     137                'description' => __( 'poll options , it is required if type = poll' , 'app-expert' ),
     138                'type'        => 'array',
     139                'required' => false
     140            ),
     141            'allow_multiple'        => array(
     142                'description' => __( 'can select on option or more , it is required if type = poll and value = 0 or 1' , 'app-expert' ),
     143                'type'        => 'integer',
    99144                'required' => false
    100145            )
     
    131176                'type'        => 'string',
    132177                'required' => false
    133             )
    134 
     178            ),
     179            'location'        => array(
     180                'description' => __( 'add location to the post if allowed. location should have "name","latitude" and "longitude".' , 'app-expert' ),
     181                'type'        => 'Object',
     182                'required' => false
     183            ),
    135184        );
    136185
     
    162211        );
    163212    }
     213    public function report_post_parameters(){
     214        return  array(
     215            'act_id'        => array(
     216                'description' => __( 'activity id to report.' , 'app-expert' ),
     217                'type'        => 'integer',
     218                'required' => true
     219            ),
     220            'reason'        => array(
     221                'description' => __( 'one of reasons in settings.' , 'app-expert' ),
     222                'type'        => 'string',
     223                'required' => true
     224            ),
     225            'reason_desc'        => array(
     226                'description' => __( 'Report description.' , 'app-expert' ),
     227                'type'        => 'string',
     228                'required' => false
     229            ),
     230        );
     231    }
     232
     233    public function vote_post_parameters(){
     234        return  array(
     235            'user_id'        => array(
     236                'description' => __( 'user_id' , 'app-expert' ),
     237                'type'        => 'integer',
     238                'required' => true
     239            ),
     240            'poll_id'        => array(
     241                'description' => __( 'post id' , 'app-expert' ),
     242                'type'        => 'integer',
     243                'required' => true
     244            ),
     245            'polls'        => array(
     246                'description' => __( 'array of pre-defined options ' , 'app-expert' ),
     247                'type'        => 'array',
     248                'required' => true
     249            ),
     250        );
     251    }
     252
     253    public function change_vote_post_parameters(){
     254        return  array(
     255            'user_id'        => array(
     256                'description' => __( 'user_id' , 'app-expert' ),
     257                'type'        => 'integer',
     258                'required' => true
     259            ),
     260            'poll_id'        => array(
     261                'description' => __( 'post id' , 'app-expert' ),
     262                'type'        => 'integer',
     263                'required' => true
     264            )
     265        );
     266    }
     267
     268    public function delete_vote_post_parameters(){
     269        return  array(
     270            'user_id'        => array(
     271                'description' => __( 'user_id' , 'app-expert' ),
     272                'type'        => 'integer',
     273                'required' => true
     274            ),
     275            'poll_id'        => array(
     276                'description' => __( 'post id' , 'app-expert' ),
     277                'type'        => 'integer',
     278                'required' => true
     279            )
     280        );
     281    }
    164282
    165283}
  • appexperts/trunk/includes/integrations/peepso-core/apis/routes/app-expert-peepso-core-users-routes.php

    r2808832 r2833215  
    1010    public function register_routes(){
    1111        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/users/profile(?:/(?P<id>\d+))?', "App_Expert_Peepso_Core_Users_Endpoint@get_user" , $this->get_user_parameters(), "App_Expert_Auth_Request");
     12        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/users/followers', "App_Expert_Peepso_Core_Users_Endpoint@get_followers" , $this->get_follow_parameters(), "App_Expert_Auth_Request");
     13        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/users/followings', "App_Expert_Peepso_Core_Users_Endpoint@get_following" , $this->get_follow_parameters(), "App_Expert_Auth_Request");
    1214        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/users/profile-image', "App_Expert_Peepso_Core_Users_Endpoint@edit_profile_image" , $this->get_profile_image_parameters(), "App_Expert_Auth_Request");
    1315        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/users/cover-imag', "App_Expert_Peepso_Core_Users_Endpoint@edit_coverImage" , $this->get_cover_image_parameters(), "App_Expert_Auth_Request");
     16        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/users/report', "App_Expert_Peepso_Core_Users_Endpoint@report" , $this->get_report_parameters(), "App_Expert_Auth_Request");
    1417    }
    1518
     
    4952    }
    5053
     54    public function get_report_parameters()
     55    {
     56        return  array(
     57            'user_id'        => array(
     58                'description' => __( 'user id to report.' , 'app-expert' ),
     59                'type'        => 'integer',
     60                'required' => true
     61            ),
     62            'reason'        => array(
     63                'description' => __( 'one of reasons in settings.' , 'app-expert' ),
     64                'type'        => 'string',
     65                'required' => true
     66            ),
     67            'reason_desc'        => array(
     68                'description' => __( 'Report description.' , 'app-expert' ),
     69                'type'        => 'string',
     70                'required' => false
     71            ),
     72        );
     73    }
     74
     75    private function get_follow_parameters()
     76    {
     77        return  array(
     78            'user_id'        => array(
     79                'description' => __( 'user id to report.' , 'app-expert' ),
     80                'type'        => 'integer',
     81                'required' => false
     82            ),
     83            'page'        => array(
     84                'description' => __( 'one of reasons in settings.' , 'app-expert' ),
     85                'type'        => 'integer',
     86                'required' => false
     87            ),
     88            'limit'        => array(
     89                'description' => __( 'Report description.' , 'app-expert' ),
     90                'type'        => 'integer',
     91                'required' => false
     92            ),
     93        );
     94    }
    5195
    5296
  • appexperts/trunk/includes/integrations/peepso-core/apis/serializers/app-expert-comment-serializer.php

    r2808832 r2833215  
    2424        foreach($this->commentAttributes as $key){
    2525            $Arr[$key]= $this->activity[$key];
     26        }
     27        $comment_giphy = get_post_meta($this->activity["ID"], 'peepso_giphy', TRUE);
     28        if($comment_giphy){
     29            $Arr['giphy'] = $comment_giphy;
    2630        }
    2731        $PeepSoUser  = PeepSoUser::get_instance($this->activity["post_author"]);
  • appexperts/trunk/includes/integrations/peepso-core/apis/serializers/app-expert-post-serializer.php

    r2808832 r2833215  
    2828            $arr[$key]= $this->post[$key];
    2929        }
     30        $post_background = get_post_meta($this->post['ID'], 'peepso_post_background', TRUE);
     31        if($post_background){
     32            $arr['background'] = json_decode($post_background);
     33            $arr['type'] = 'post_backgrounds';
     34        }
     35        $post_giphy = get_post_meta($this->post['ID'], 'peepso_giphy', TRUE);
     36        if($post_giphy){
     37            $arr['giphy'] = $post_giphy;
     38            $arr['type'] = 'giphy';
     39        }
     40        $post_poll_options = get_post_meta($this->post['ID'], 'select_options', true);
     41        if($post_poll_options){
     42            $arr['poll_options'] = unserialize($post_poll_options);
     43        }
     44        $total_user_poll = get_post_meta($this->post['ID'], 'total_user_poll', true);
     45        if($total_user_poll >= 0){
     46            $arr['total_user_poll'] = (string)$total_user_poll;
     47        }
     48        $max_answers = get_post_meta($this->post['ID'], 'max_answers', true);
     49        if($max_answers >= 0){
     50            $arr['max_answers'] = (string)$max_answers;
     51        }
    3052        //======== temporary fix date ===========
    3153        //$arr['post_date'] = wp_date('Y-m-d h:i:s',strtotime($arr['post_date']));
     
    5173            ];
    5274        }
    53        $arr['comment_count'] = App_Expert_Peepso_Core_Activity_Helper::getCommentCount($this->post['ID']);
     75        $arr['comment_count'] = App_Expert_Peepso_Core_Activity_Helper::getCommentCount($this->post['ID']);
    5476
    5577        $arr['reactions']=App_Expert_Peepso_Core_Activity_Helper::getReactionCount($this->post['act_id']);
     
    7496        $arr['get_current_user_id']  = get_current_user_id();
    7597        $arr['can_pin']   = App_Expert_Peepso_Core_Allowed_Plugins_Helper::can_pin(intval($this->post['ID']));
    76 
     98        //======== location data ===========
     99        $arr['location'] = get_post_meta($this->post['ID'],"peepso_location",true);
     100        if(empty($arr['location'])) $arr['location']=null;
     101        //======== location data ===========
    77102        return apply_filters("ae_peepso_post_object",$arr, $this->post);
    78103    }
  • appexperts/trunk/includes/integrations/peepso-core/apis/serializers/app-expert-user-serializer.php

    r2808832 r2833215  
    4747        $PeepSoUserFollower = new PeepSoUserFollower( $this->user->get_id(),get_current_user_id());
    4848        $arr['is_follow'] = $PeepSoUserFollower->follow;
    49    
     49        $arr['followers_count'] =(string) PeepSoUserFollower::count_followers( $this->user->get_id(), true);
     50
    5051        return apply_filters("ae_peepso_user_object",$arr, $this->user);
    5152    }
  • appexperts/trunk/includes/integrations/peepso-core/app-expert-peepso-core-init.php

    r2808832 r2833215  
    3131       return plugin_dir_path(__FILE__);
    3232    }
     33
     34    public function add_logs($arr){
     35        $arr[] ='peepso-core';
     36        return $arr;
     37    }
    3338}
    3439
  • appexperts/trunk/includes/integrations/peepso-core/backend/app-expert-peepso-core-send-notification.php

    r2808832 r2833215  
    1818        $this->_current_integration = $_current_integration;
    1919        add_action('peepso_action_create_notification_after',array($this,'add_push_notification'),99,1);
     20        add_filter( "ae_send_push_notification_object" , array($this,'add_push_notification_additional_params'), 10, 2);
    2021    }
    2122    public function add_push_notification($id){
     
    4647    }
    4748
     49    public function add_push_notification_additional_params($_notification,$lang){
     50        if(in_array($_notification["type"],array_keys($this->settings_map))) {
     51            $_notification = App_Expert_Peepso_Core_Notification_helper::get_extra_data((object)$_notification);
     52            $_notification->title = $_notification->sender["user_fullname"]." ".$_notification->title;
     53            $_notification = (array)$_notification;
     54        }
     55        return $_notification;
     56    }
    4857}
  • appexperts/trunk/includes/integrations/peepso-core/helpers/app-expert-peepso-core-notification-helper.php

    r2808832 r2833215  
    77        return $wpdb->get_row($wpdb->prepare($sql, $id), OBJECT);
    88    }
     9    public static function get_extra_data($_notification){
     10        $_notification->title = __($_notification->title,'peepso-core');
     11        $record      = self::get_notification($_notification->object_id);
     12        if(!$record) return $_notification;
     13        $PeepSoUser  = PeepSoUser::get_instance($record->not_from_user_id);
     14        $_notification->sender = (new App_Expert_User_Serializer($PeepSoUser))->get();
     15        $activities = PeepSoActivity::get_instance();
     16        if($record){
     17            switch($_notification->type){
     18                case 'wall_post':
     19                case 'tag':
     20                    $not_activity = $activities->get_activity_post($record->not_act_id);
     21                    $_notification->object_id = $record->not_act_id;
     22                    break;
     23                case 'user_comment':
     24                case 'tag_comment':
     25                case 'stream_reply_comment':
     26                    $not_activity = $activities->get_activity_data($record->not_external_id, $record->not_module_id);
     27                    $_notification->comment_activity_id = $not_activity->act_id;
     28                    $parent_activity = $activities->get_activity_data($not_activity->act_comment_object_id, $not_activity->act_comment_module_id);
     29                    $_notification->object_id = $parent_activity->act_id;
     30                    break;
     31                case 'like_post':
     32                    $not_activity = $activities->get_activity_post($record->not_act_id);
     33                    $_notification->object_id =$not_activity->act_id;
     34                    if($not_activity->post_type ==="peepso-comment"){
     35                        $not_activity = $activities->get_activity_data($not_activity->act_comment_object_id, $not_activity->act_comment_module_id);
     36                        $_notification->object_id =$not_activity->act_id;
     37                    }
     38            }
     39        }
     40        $preview = get_post_meta($record->not_external_id,'peepso_human_friendly', TRUE);
     41        if(empty($preview)){
     42            $preview = $not_activity->post_content;
     43        }
     44        if(!is_array($preview) && strlen($preview)) {
     45            $preview = trim(
     46                truncateHtml($preview,
     47                    PeepSo::get_option('notification_preview_length',50),
     48                    PeepSo::get_option('notification_preview_ellipsis','...'),
     49                    false, FALSE)
     50            );
     51        }
     52        $preview = (string)$preview?:"";
     53
     54        $_notification->content = $preview;
     55
     56        return $_notification;
     57    }
    958}
  • appexperts/trunk/includes/integrations/peepso-friends/apis/endpoints/app-expert-peepso-friends-list-endpoint.php

    r2808832 r2833215  
    3030    }
    3131
    32     public function get_requests(){
     32    public function get_requests(WP_REST_Request $request){
    3333        // .../peepso-friends/templates/friends/pending.php
    3434        $PeepSoFriendsRequests = PeepSoFriendsRequests::get_instance();
    35         $data=['received'=>[]];
    36 
    37         if ($PeepSoFriendsRequests->has_received_requests(get_current_user_id())) {
    38             while ($request = $PeepSoFriendsRequests->get_next_request()) {
    39                 $friend = PeepSoUser::get_instance($request['freq_user_id']);
    40                 $request['Friend_data'] = (new App_Expert_User_Serializer($friend))->get();
    41                 $data['received'][]=$request;
    42             }
     35        $data=[];
     36        $type = $request->has_param('type')?$request->get_param('type'):"received";
     37        switch ($type){
     38            //redundant code should stay as is
     39            //the if checks & set the data to a private class parameter :)
     40            case 'received':
     41                if ($PeepSoFriendsRequests->has_received_requests(get_current_user_id())) {
     42                    while ($fr_request = $PeepSoFriendsRequests->get_next_request()) {
     43                        $friend = PeepSoUser::get_instance($fr_request['freq_user_id']);
     44                        $fr_request['Friend_data'] = (new App_Expert_User_Serializer($friend))->get();
     45                        $data[]=$fr_request;
     46                    }
     47                }
     48                break;
     49            case 'sent' :
     50                if ($PeepSoFriendsRequests->has_sent_requests(get_current_user_id())) {
     51                    while ($request = $PeepSoFriendsRequests->get_next_request()) {
     52                        $friend = PeepSoUser::get_instance($request['freq_friend_id']);
     53                        $request['Friend_data'] = (new App_Expert_User_Serializer($friend))->get();
     54                        $data[]=$request;
     55                    }
     56                }
     57                break;
    4358        }
    44 
    45 //        if ($PeepSoFriendsRequests->has_sent_requests(get_current_user_id())) {
    46 //            while ($request = $PeepSoFriendsRequests->get_next_request()) {
    47 //                $friend = PeepSoUser::get_instance($request['freq_friend_id']);
    48 //                $request['Friend_data'] = (new UserSerializer($friend))->get();
    49 //                $data['sent'][]=$request;
    50 //            }
    51 //        }
    52         return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,$data['received']);
     59        return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,$data);
    5360    }
    5461
     
    7279            switch ($sent_action){
    7380                case 'add_friend':
    74                     $msg="friend request added successfully";
     81                    $msg=__("friend request added successfully",'app-expert');
    7582                    break;
    7683                case 'cancel_request':
    77                     $msg="friend request canceled successfully";
     84                    $msg=__("friend request canceled successfully",'app-expert');
    7885                    break;
    7986                case 'accept_request':
    80                     $msg="friend request accepted successfully";
     87                    $msg=__("friend request accepted successfully",'app-expert');
    8188                    break;
    8289                case 'remove_friend':
    83                     $msg="friend removed successfully";
     90                    $msg=__("friend removed successfully",'app-expert');
    8491                    break;
    8592            }
    86             return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,['message'=>translate($msg,'app-expert')]);
     93            return App_Expert_Peepso_Core_Response_Helper::success_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_SUCCESS,['message'=>$msg]);
    8794        }
    8895        else
  • appexperts/trunk/includes/integrations/peepso-friends/apis/modifications/app-expert-peepso-friends-notification.php

    r2808832 r2833215  
    1414    public function add_additional_params($_notification){
    1515        if(in_array($_notification->type,$this->notification_types)){
    16             $_notification->title = __($_notification->title,'peepso-core');
    17             $record   = App_Expert_Peepso_Core_Notification_helper::get_notification($_notification->object_id);
    18             $PeepSoUser  = PeepSoUser::get_instance($record->not_from_user_id);
    19             $_notification->user_sending_notification_data = (new App_Expert_User_Serializer($PeepSoUser))->get();
    20             $activities = PeepSoActivity::get_instance();
    21             $preview = get_post_meta($record->not_external_id,'peepso_human_friendly', TRUE);
    22             if(!is_array($preview) && strlen($preview)) {
    23                 $preview = trim(
    24                     truncateHtml($preview,
    25                         PeepSo::get_option('notification_preview_length',50),
    26                         PeepSo::get_option('notification_preview_ellipsis','...'),
    27                         false, FALSE)
    28                 );
    29             }
    30             $preview = (string)$preview?:"";
    31             $_notification->content = $preview;
    32             if($record){
    33                 switch($_notification->type){
    34                     case 'wall_post':
    35                     case 'tag':
    36                         $_notification->object_id = $record->act_id;
    37                         break;
    38                     case 'user_comment':
    39                     case 'like_comment':
    40                     case 'tag_comment':
    41                     case 'stream_reply_comment':
    42                         $not_activity = $activities->get_activity_data($record->not_external_id, $record->not_module_id);
    43                         $_notification->comment_activity_id = $not_activity->act_id;
    44                         $parent_activity = $activities->get_activity_data($not_activity->act_comment_object_id, $not_activity->act_comment_module_id);
    45                         $_notification->object_id = $parent_activity->act_id;
    46                         break;
    47                 }
    48             }
     16            $_notification = App_Expert_Peepso_Friends_Notification_helper::get_extra_data($_notification);
    4917        }
    5018        return $_notification;
  • appexperts/trunk/includes/integrations/peepso-friends/apis/modifications/app-expert-peepso-friends-user.php

    r2808832 r2833215  
    44    public function __construct()
    55    {
     6        add_filter('ae_login_user_data_object', array($this, 'add_auth_changes'), 10, 3);
    67        add_filter('ae_peepso_profile_tab_sub_items',array($this,'get_tab_sub_items'),10,4);
    78    }
     
    2829        return $subItems;
    2930    }
     31    public function add_auth_changes($user_data,WP_REST_Request $request,WP_User $user){
     32        $friends_requests = PeepSoFriendsRequests::get_instance();
     33        $user_data['friends_count'] =  count($friends_requests->get_received_requests($user->ID));
     34        return $user_data;
     35    }
    3036
    3137}
  • appexperts/trunk/includes/integrations/peepso-friends/apis/routes/app-expert-peepso-friends-routes.php

    r2808832 r2833215  
    1111    {
    1212        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/friends', "App_Expert_Peepso_Friends_List_Endpoint@get" , $this->get_friends_parameters(),"App_Expert_Auth_Request");
    13         App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/friends/requests', "App_Expert_Peepso_Friends_List_Endpoint@get_requests" , [],"App_Expert_Auth_Request");
     13        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/friends/requests', "App_Expert_Peepso_Friends_List_Endpoint@get_requests" ,  $this->get_requests_parameters(),"App_Expert_Auth_Request");
    1414        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/friends/action/(?P<friend_action>\D+)', "App_Expert_Peepso_Friends_List_Endpoint@actions" , $this->get_friends_actions_parameters(),"App_Expert_Auth_Request");
    1515
     
    3030                'description' => __( 'number of friends per page.' , 'app-expert' ),
    3131                'type'        => 'integer',
     32                'required' => false
     33            ),
     34        ];
     35    }
     36    public function get_requests_parameters(){
     37        return [
     38            'type'        => array(
     39                'description' => __( 'get friends requests lists sent/received.' , 'app-expert' ),
     40                'type'        => 'string',
    3241                'required' => false
    3342            ),
  • appexperts/trunk/includes/integrations/peepso-friends/app-expert-peepso-friends-init.php

    r2808832 r2833215  
    3838        return true;
    3939    }
     40
     41    public function add_logs($arr)
     42    {
     43        $arr[] ='peepso-friends';
     44        return $arr;
     45    }
    4046}
    4147
  • appexperts/trunk/includes/integrations/peepso-friends/backend/app-expert-peepso-friends-notification-settings.php

    r2808832 r2833215  
    1111    public function register_settings()
    1212    {
    13            add_settings_field('peepso_friends_notification_settings', __('Peepso Friends', 'app-expert'), [$this, 'add_notification_settings'], 'notification-options', 'App Experts');
     13        add_settings_field('peepso_friends_notification_settings', __('Peepso Friends', 'app-expert'), [$this, 'add_notification_settings'], 'notification-options', 'App Experts');
    1414    }
    1515
     
    1919        $options = get_option('notification_options');
    2020        $peepso_friends_options = [
     21            [
     22                'title' => __('Receive request', 'app-expert'),
     23                'value' => 'receive_request'
     24            ],
    2125            [
    2226                'title' => __('Accept request', 'app-expert'),
  • appexperts/trunk/includes/integrations/peepso-friends/backend/app-expert-peepso-friends-send-notification.php

    r2808832 r2833215  
    44    private $_current_integration;
    55    private $settings_map = [
    6         'friends_requests' => ['accept_request']
     6        'friends_requests' => ['accept_request'],
    77    ];
    88    public function __construct(App_Expert_Integration $_current_integration)
    99    {
    1010        $this->_current_integration = $_current_integration;
     11        add_action('peepso_friends_requests_after_add', array($this, 'add_notification'), 10, 2);
    1112        add_action('peepso_action_create_notification_after',array($this,'add_push_notification'),99,1);
     13        add_filter( "ae_send_push_notification_object" , array($this,'add_push_notification_additional_params'), 10, 2);
    1214    }
     15
    1316    public function add_push_notification($id){
    1417        $record   = App_Expert_Peepso_Core_Notification_helper::get_notification($id);
     
    3740    }
    3841
     42    public function add_push_notification_additional_params($_notification,$lang){
     43        if(in_array($_notification["type"],array_keys($this->settings_map))) {
     44            $_notification = App_Expert_Peepso_Friends_Notification_helper::get_extra_data((object)$_notification);
     45            $_notification->title = $_notification->sender["user_fullname"]." ".$_notification->title;
     46            $_notification = (array)$_notification;
     47        }
     48        return $_notification;
     49    }
     50
     51    public function add_notification($from_id,$to_id){
     52       
     53        $notification_options = get_option('notification_options',[]);
     54        if(empty($notification_options)||empty($notification_options['peepso_friends_settings']))return;
     55        $is_option_exist = false;
     56        $is_option_exist = array_key_exists('receive_request',$notification_options['peepso_friends_settings']);
     57        if(!$is_option_exist) return;
     58
     59        $SenderUser  = PeepSoUser::get_instance($from_id);
     60        $sender = (new App_Expert_User_Serializer($SenderUser))->get();
     61        $domain = 'app-expert';
     62        $_langs = App_Expert_Language::get_active_languages();
     63        $title=[];
     64        $content=[];
     65        //prepare segments to send to
     66        foreach ($_langs as $lang=>$obj){
     67            App_Expert_Language::switch_lang($lang);
     68            $title[$lang]   = translate('Friend Rquest'  , $domain);
     69            $content[$lang] = sprintf(...array_merge([translate('New Friend Request from %s', $domain)], array($sender["user_fullname"])));
     70        }
     71
     72        $data=[
     73            "title" => json_encode($title),
     74            "content" => json_encode($content),
     75            "target" => null,
     76            "segment" => "",
     77            "attachment_id" => null,
     78            "type" => 'new_friends_requests',
     79            "object_id" => null,
     80            "created_at" => gmdate( 'Y-m-d H:i:s' )
     81        ];
     82
     83        App_Expert_Notification_Helper::send_push_to_user($data, $to_id);
     84    }
    3985}
  • appexperts/trunk/includes/integrations/peepso-groups/apis/endpoints/app-expert-peepso-groups-endpoint.php

    r2808832 r2833215  
    6262            $segments = array();
    6363            $segments[0][] = array(
    64                 'href' => '',
     64                'href' => 'stream',
    6565                'title'=> __('Stream', 'groupso'),
    6666                'icon' => 'gcis gci-stream',
     
    7575                }
    7676
    77                 $title = __('Members', 'groupso');
    78 
    79 
    8077                $segments[0][] = array(
    8178                    'href' => 'members',
    82                     'title'=> $title,
     79                    'title'=> __('Members', 'groupso'),
    8380                    'count'=>$pending = $group->pending_admin_members_count,
    8481                    'icon' => 'gcis gci-user-friends',
     
    9087            foreach ($segments as $tabs){
    9188                foreach ($tabs as $tab){
    92                     $tabname=strtolower($tab['href']);
    93                     if(empty($tabname)) $tabname=strtolower($tab['title']);
    94                     $groupData['profile_tabs'][]=[
    95                         'id'=>$tabname,
    96                         'label'=>$tab['title'],
    97                         'count'=>(int)($tab['count']??0),
    98                         'url'=>$group->get_url().$tab['href'],
    99                         'sub_items'=> App_Expert_Peepso_Groups_Tabs_Helper::getTabSubItems($tabname,$group,$group->get_url())
    100                     ];
     89                        $tabname=strtolower($tab['href']);
     90                        if(empty($tabname)) $tabname=strtolower($tab['title']);
     91                        $groupData['profile_tabs'][]=[
     92                            'id'=>$tabname,
     93                            'label'=>$tab['title'],
     94                            'count'=>(int)($tab['count']??0),
     95                            'url'=>$group->get_url().$tab['href'],
     96                            'sub_items'=> App_Expert_Peepso_Groups_Tabs_Helper::getTabSubItems($tabname,$group,$group->get_url())
     97                        ];
    10198                }
    10299            }
  • appexperts/trunk/includes/integrations/peepso-groups/apis/modifications/app-expert-album-apis.php

    r2808832 r2833215  
    1818        $parameters['group_id' ] =  array(
    1919                'description' => __( 'if the album is in a group.' , 'app-expert' ),
    20                 'type'        => 'integer',
    2120                'required' => false
    2221                );
     
    3534    {
    3635        if($request->has_param('group_id')){
    37             $post['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
     36            $post['module_id'] = PeepSoGroupsPlugin::MODULE_ID; 
    3837            $post['privacy'] = PeepSo::ACCESS_PUBLIC;
    3938        }
     
    6362        if($request->has_param('group_id'))
    6463        {
    65             $_POST['user_id'] = $request->get_param('group_id');
    66             $_POST['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
    67             $_POST['privacy'] = PeepSo::ACCESS_PUBLIC;
     64            $post['user_id'] = $request->get_param('group_id');
     65            $post['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
     66            $post['privacy'] = PeepSo::ACCESS_PUBLIC;
    6867        }
    6968        return $post;
  • appexperts/trunk/includes/integrations/peepso-groups/apis/modifications/app-expert-peepso-groups-notification.php

    r2808832 r2833215  
    2424    public function add_additional_params($_notification){
    2525        if(in_array($_notification->type,$this->notification_types)){
    26             $_notification->title = __($_notification->title,'peepso-core');
    27             $record      = App_Expert_Peepso_Core_Notification_helper::get_notification($_notification->object_id);
    28             $PeepSoUser  = PeepSoUser::get_instance($record->not_from_user_id);
    29             $_notification->sender = (new App_Expert_User_Serializer($PeepSoUser))->get();
    30 
    31             $preview = get_post_meta($record->not_external_id,'peepso_human_friendly', TRUE);
    32             if(!is_array($preview) && strlen($preview)) {
    33                 $preview = trim(
    34                     truncateHtml($preview,
    35                         PeepSo::get_option('notification_preview_length',50),
    36                         PeepSo::get_option('notification_preview_ellipsis','...'),
    37                         false, FALSE)
    38                 );
    39             }
    40             $preview = $preview?:"";
    41             $_notification->content = $preview;
    42             if($record){
    43                 switch($_notification->type){
    44                     case 'groups_new_post':
    45                         $args = json_decode($record->not_message_args);
    46                         if(count($args)) {
    47                             unset($args[0]);
    48                             $_notification->title = call_user_func_array("sprintf",array_merge([$_notification->title],$args));
    49                         }
    50                         $activities = PeepSoActivity::get_instance();
    51                         $activity   = $activities->get_post_object($record->not_external_id);
    52                         $_notification->object_id = $activity->act_id;
    53                         break;
    54                     case 'groups_user_join_request_send':
    55                     case 'groups_user_join':
    56                     case 'groups_user_invitation_send':
    57                     case 'groups_user_join_request_accept':
    58                     case 'groups_rename':
    59                     case 'groups_privacy_change':
    60                         $args = json_decode($record->not_message_args);
    61                         if(count($args)) {
    62                             unset($args[0]);
    63                             $_notification->title = call_user_func_array("sprintf",array_merge([$_notification->title],$args));
    64                         }
    65                     case 'groups_publish':
    66                     case 'groups_unpublish':
    67                         $_notification->object_id = $record->not_external_id;
    68                         break;
    69                 }
    70             }
     26            $_notification = App_Expert_Peepso_Groups_Notification_helper::get_extra_data($_notification);
    7127        }
    7228        return $_notification;
  • appexperts/trunk/includes/integrations/peepso-groups/apis/modifications/app-expert-peepso-groups-settings.php

    r2808832 r2833215  
    2121            $data["peepso"]["group_privacy_default"]=-1;
    2222        }
     23
     24        $data['peepso']['polls']['polls_group'] =  (string)PeepSo::get_option('polls_group', 0);
     25
    2326        return $data;
    2427    }
  • appexperts/trunk/includes/integrations/peepso-groups/apis/modifications/app-expert-peepso-groups-user.php

    r2808832 r2833215  
    4646            }
    4747        }
     48
    4849        return $subItems;
    4950    }
  • appexperts/trunk/includes/integrations/peepso-groups/apis/modifications/app-expert-post-apis.php

    r2808832 r2833215  
    1111        $parameters['group_id' ] =  array(
    1212                'description' => __( 'if the post is in a group.' , 'app-expert' ),
    13                 'type'        => 'integer',
    1413                'required' => false
    1514                );
     
    1918    public function handle_group_id_add_post_request( $post,$request)
    2019    {
     20
    2121        if(isset($post['group_id'])){
    22             $post['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
     22
     23            $_POST['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
    2324        }
    2425        return $post;
     
    2829    {
    2930        if(isset($post['group_id'])){
    30             $post['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
     31            $_POST['module_id'] = PeepSoGroupsPlugin::MODULE_ID;
    3132        }
    3233        return $post;
  • appexperts/trunk/includes/integrations/peepso-groups/apis/modifications/app-expert-video-apis.php

    r2808832 r2833215  
    1010        $parameters['group_id' ] =  array(
    1111                'description' => __( 'if the video is in a group.' , 'app-expert' ),
    12                 'type'        => 'integer',
    1312                'required' => false
    1413                );
  • appexperts/trunk/includes/integrations/peepso-groups/apis/routes/app-expert-peepso-groups-routes.php

    r2808832 r2833215  
    1111    {
    1212        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/groups/is-plugin-active', "App_Expert_Peepso_Groups_Endpoint@is_active" , array());
    13         App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/groups', "App_Expert_Peepso_Groups_Endpoint@get" , $this->get_groups_parameters(),"App_Expert_Auth_Request");
     13        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/groups', "App_Expert_Peepso_Groups_Endpoint@get" , $this->get_groups_parameters());
    1414        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/groups/(?P<id>[\d]+)', "App_Expert_Peepso_Groups_Endpoint@get_one", $this->get_single_group_parameters());
    15         App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/groups/categories', "App_Expert_Peepso_Groups_Endpoint@get_categories", array());
     15        App_Expert_Route::get(PEEPSO_CORE_API_NAMESPACE, '/groups/categories', "App_Expert_Peepso_Groups_Endpoint@get_categories", array(),"App_Expert_Auth_Request");
    1616        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/groups', "App_Expert_Peepso_Groups_Endpoint@add" , $this->add_groups_parameters(),"App_Expert_Auth_Request");
    1717        App_Expert_Route::post(PEEPSO_CORE_API_NAMESPACE, '/groups/change_avatar', "App_Expert_Peepso_Groups_Endpoint@change_avatar" , $this->change_avatar_groups_parameters(),"App_Expert_Auth_Request");
  • appexperts/trunk/includes/integrations/peepso-groups/app-expert-peepso-groups-init.php

    r2808832 r2833215  
    4040        return true;
    4141    }
     42
     43    public function add_logs($arr)
     44    {
     45        $arr[] ='peepso-groups';
     46        return $arr;
     47    }
    4248}
    4349
  • appexperts/trunk/includes/integrations/peepso-groups/backend/app-expert-peepso-groups-send-notification.php

    r2808832 r2833215  
    2121        $this->_current_integration = $_current_integration;
    2222        add_action('peepso_action_create_notification_after',array($this,'add_push_notification'),99,1);
     23        add_filter( "ae_send_push_notification_object"   , array($this,'add_push_notification_additional_params'), 10, 2);
    2324    }
    2425    public function add_push_notification($id){
     
    4748            }
    4849    }
     50    public function add_push_notification_additional_params($_notification,$lang){
     51        if(in_array($_notification["type"],array_keys($this->settings_map))) {
     52            $_notification = App_Expert_Peepso_Groups_Notification_helper::get_extra_data((object)$_notification);
     53            $_notification->title = $_notification->sender["user_fullname"]." ".$_notification->title;
     54            $_notification = (array)$_notification;
     55        }
     56        return $_notification;
     57    }
    4958
    5059}
  • appexperts/trunk/includes/integrations/peepso-photos/apis/endpoints/app-expert-peepso-photos-endpoint.php

    r2808832 r2833215  
    55    public function upload_photo(WP_REST_Request $request){
    66        $_POST = array_merge($_POST,$request->get_params());
     7        if($request->get_param('group_id')){
     8            $_POST['group_id'] = (int)$_POST['group_id'];
     9        }
    710        $_POST = apply_filters('ae_peepso_handle_upload_photo_request',$_POST , $request);
    811
     
    2427        $_POST['user_id'] = get_current_user_id();
    2528        $_POST['type'] = 'album';
    26 
     29        if($request->get_param('group_id')){
     30            $_POST['group_id'] = (int)$_POST['group_id'];
     31        }
    2732        $_POST = apply_filters('ae_peepso_handle_add_album_request', $_POST, $request);
    2833
     
    4853            'module_id'=>$module_id
    4954        ];
     55        if($request->get_param('group_id')){
     56            $_GET['group_id'] = (int)$_GET['group_id'];
     57        }
    5058        $data = apply_filters('ae_peepso_handle_get_album_request',$data, $request);
    5159
     
    6270        $user_albums = $PeepSoPhotosAlbumModel->get_user_photos_album($user_id, $offset, $limit, $sort, $module_id);
    6371
    64         if(!$user_albums){
    65             return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,["no albums found. "]);
    66         }
     72//        if(!$user_albums){
     73//            return  App_Expert_Peepso_Core_Response_Helper::fail_response(App_Expert_Peepso_Core_Response_Helper::STATUS_CODE_BAD_REQUEST,["no albums found. "]);
     74//        }
    6775
    6876        $albumsData = [];
     
    95103        $_POST['_wpnonce'] = wp_create_nonce('photo-delete-album') ;
    96104        $_POST['uid'] = get_current_user_id();
    97        
     105        if($request->get_param('group_id')){
     106            $_POST['group_id'] = (int)$_POST['group_id'];
     107        }
    98108        $_POST = apply_filters('ae_peepso_handle_delete_album_request', $_POST, $request);
    99109
     
    126136        $allowUpdatePrivacy =  apply_filters('ae_peepso_handle_edit_album_allow_update_privacy',true,$request);
    127137        $_POST['user_id'] = get_current_user_id();
     138        if($request->get_param('group_id')){
     139            $_POST['group_id'] = (int)$_POST['group_id'];
     140        }
    128141        $_POST = apply_filters('ae_peepso_handle_edit_album_request',$_POST ,$request);
    129142        $_POST['owner_id'] = $_POST['user_id'];
     
    175188        $_POST['album_id'] = $request->get_param('album_id') ;
    176189        $_POST['type'] = 'photo';
    177        
     190        if($request->get_param('group_id')){
     191            $_POST['group_id'] = (int)$_POST['group_id'];
     192        }
    178193        $_POST = apply_filters('ae_peepso_handle_add_photos_album_request', $_POST, $request);
    179194        $_POST['photo'] = $request->get_param('photo') ;
     
    209224            'module_id' => 0
    210225        );
     226        if($request->get_param('group_id')){
     227            $_GET['group_id'] = (int)$_GET['group_id'];
     228        }
    211229        $data = apply_filters('ae_peepso_handle_get_photos_album_request',$data, $request);
    212230
     
    252270            'module_id' => 0
    253271        );
     272        if($request->get_param('group_id')){
     273            $_GET['group_id'] = (int)$_GET['group_id'];
     274        }
    254275        $data = apply_filters('ae_peepso_handle_get_photos_by_album_album_request',$data ,$request);
    255276
  • appexperts/trunk/includes/integrations/peepso-photos/app-expert-peepso-photos-init.php

    r2808832 r2833215  
    3131        return true;
    3232    }
     33
     34    public function add_logs($arr)
     35    {
     36        $arr[] ='peepso-photos';
     37        return $arr;
     38    }
    3339}
    3440
  • appexperts/trunk/includes/integrations/peepso-videos/apis/endpoints/app-expert-peepso-videos-endpoint.php

    r2808832 r2833215  
    3838            'module_id' => 0
    3939        );
     40        if($request->get_param('group_id')){
     41            $_GET['group_id'] = (int)$_GET['group_id'];
     42        }
    4043        $data = apply_filters('ae_peepso_handle_get_video_request', $data, $request);
    4144
  • appexperts/trunk/includes/integrations/peepso-videos/apis/modifications/app-expert-peepso-videos-settings.php

    r2808832 r2833215  
    77    public function add_additional_params_to_settings($data){
    88
    9         $settings = array(
    10             'videos_max_upload_size' => '20',
    11             'max_video_length' => 0,
    12         );
     9        $video_settings = array();
     10        $video_settings['videos_enabled'] = (string)PeepSo::get_option('videos_video_master_switch', 1);
     11        $video_settings['videos_play_inline'] =  (string)PeepSo::get_option('videos_play_inline', 0);
     12        $video_settings['videos_upload_enable'] =  (string)PeepSo::get_option('videos_upload_enable', 0);
     13        $video_settings['videos_max_upload_size'] =  (string)PeepSo::get_option('videos_max_upload_size', 20);
     14        $video_settings['videos_allowed_user_space'] =  (string)PeepSo::get_option('videos_allowed_user_space', 0);
     15        $video_settings['videos_conversion_mode'] =  (string)PeepSo::get_option('videos_conversion_mode', 'no');
     16        $video_settings['videos_allowed_extensions'] =  PeepSoVideosUpload::no_conversion_mode_filetypes();
    1317
    14         foreach($settings as $key=>$default){
    15             $data["peepso"][$key] = (string)PeepSo::get_option( $key , $default );
    16         }
     18        $audio_settings = array();
     19        $audio_settings['videos_audio_enabled'] =  (string)PeepSo::get_option('videos_audio_master_switch', 1);
     20        $audio_settings['videos_audio_upload_enable'] =  (string)PeepSo::get_option('videos_audio_enable', 0);
     21        $audio_settings['videos_audio_max_upload_size'] =  (string)PeepSo::get_option('videos_audio_max_upload_size', 20);
     22        $audio_settings['videos_audio_allowed_user_space'] =  (string)PeepSo::get_option('videos_audio_allowed_user_space', 0);
     23        $audio_settings['videos_audio_lastfm'] =  (string)PeepSo::get_option('videos_audio_lastfm', 0);
     24        $audio_settings['videos_audio_lastfm_api_key'] =  (string)PeepSo::get_option('videos_audio_lastfm_api_key');
     25
     26        $data['peepso']['video'] = $video_settings;
     27        $data['peepso']['audio'] = $audio_settings;
    1728
    1829        return $data;
  • appexperts/trunk/includes/integrations/peepso-videos/apis/modifications/app-expert-post-apis.php

    r2808832 r2833215  
    1414        );
    1515
     16        $parameters['audio' ] =  array(
     17            'description' => __( 'required if type is audio and audio is uploaded not a url ' , 'app-expert' ),
     18            'type'        => 'string',
     19            'required' => false
     20        );
     21
     22        $parameters['audio_title' ] =  array(
     23            'description' => __( 'audio title for uploaded audio file if type is audio and audio is uploaded not a url ' , 'app-expert' ),
     24            'type'        => 'string',
     25            'required' => false
     26        );
     27
     28        $parameters['audio_artist' ] =  array(
     29            'description' => __( 'audio artist for uploaded audio file if type is audio and audio is uploaded not a url ' , 'app-expert' ),
     30            'type'        => 'string',
     31            'required' => false
     32        );
     33
     34        $parameters['audio_album' ] =  array(
     35            'description' => __( 'audio album for uploaded audio file if type is audio and audio is uploaded not a url ' , 'app-expert' ),
     36            'type'        => 'string',
     37            'required' => false
     38        );
     39
     40        $parameters['video' ] =  array(
     41            'description' => __( 'required if type is video and video is uploaded not a url ' , 'app-expert' ),
     42            'type'        => 'string',
     43            'required' => false
     44        );
     45
     46        $parameters['video_title' ] =  array(
     47            'description' => __( 'video title for uploaded video file if type is video and video is uploaded not a url ' , 'app-expert' ),
     48            'type'        => 'string',
     49            'required' => false
     50        );
     51
    1652        return $parameters;
    1753    }
     
    2460
    2561        if(in_array($request_type, $types) && !empty($request->get_param('url'))){
    26             $post['accepted_type']=$request->get_param('type');
    27             $post['url']=$request->get_param('url');
     62            if($request_type === 'audio'){
     63                $_POST['accepted_type'] = 'audio';
     64            }
    2865            $PeepSoVideosAjax = PeepSoVideosAjax::get_instance();
    2966            $validation_resp = new PeepSoAjaxResponse();
     
    4380            }
    4481        }
    45         return $post;
     82        return $_POST;
    4683    }
    4784}
  • appexperts/trunk/includes/integrations/peepso-videos/apis/routes/app-expert-peepso-videos-routes.php

    r2808832 r2833215  
    1919                'description' => __( 'video file' , 'app-expert' ),
    2020                'type'        => 'file',
     21                'required' => false
     22            ),
     23            'is_audio'        => array(
     24                'description' => __( 'equal 1 if uploaded file is audio file and it is require in this case' , 'app-expert' ),
     25                'type'        => 'integer',
    2126                'required' => false
    2227            )
  • appexperts/trunk/includes/integrations/peepso-videos/app-expert-peepso-videos-init.php

    r2808832 r2833215  
    3232        return true;
    3333    }
     34
     35    public function add_logs($arr)
     36    {
     37        $arr[] ='peepso-videos';
     38        return $arr;
     39    }
    3440}
    3541
  • appexperts/trunk/includes/integrations/sitepress-multilingual-cms/app-expert-sitepress-multilingual-cms-init.php

    r2789917 r2833215  
    2323        new App_Expert_WPML_Language($this);
    2424    }
     25
     26    public function add_logs($arr)
     27    {
     28        $arr[] ='sitepress-multilingual-cms';
     29        return $arr;
     30    }
    2531}
    2632//todo:find a better way to create new object
  • appexperts/trunk/includes/integrations/woocommerce-bookings/app-expert-woocommerce-bookings-init.php

    r2800813 r2833215  
    2727       return plugin_dir_path(__FILE__);
    2828    }
     29
     30    public function add_logs($arr)
     31    {
     32        $arr[] ='woocommerce-bookings';
     33        return $arr;
     34    }
    2935}
    3036
  • appexperts/trunk/includes/integrations/woocommerce/app-expert-woocommerce-init.php

    r2789917 r2833215  
    5858       return plugin_dir_path(__FILE__);
    5959    }
     60
     61    public function add_logs($arr)
     62    {
     63        $arr[] ='woocommerce';
     64        return $arr;
     65    }
    6066}
    6167
  • appexperts/trunk/includes/integrations/wordpress/apis/wrapped-apis/app-expert-cpt-controller.php

    r2808832 r2833215  
    8080    public function get_item($request){
    8181        $response =  parent::get_item($request);
     82
    8283        if (is_wp_error($response))
    8384            return $response;
    8485
    8586        return App_Expert_Response::wp_rest_success(
    86             $response,
     87            apply_filters("ae_single_{$this->post_type}_response",$response,$request),
    8788            'app_expert_post_retrieved',
    8889            'retrieved requested post'
  • appexperts/trunk/includes/integrations/wordpress/app-expert-wordpress-init.php

    r2789917 r2833215  
    3232        return array_merge(
    3333            parent::get_endponints_files(),
     34//            glob($this->get_dir()."apis/response-meta-data/blocks-meta/*.php"),
    3435            glob($this->get_dir()."apis/response-meta-data/*.php"),
    3536            glob($this->get_dir()."apis/wrapped-apis/*.php")
     
    5657        return [];
    5758    }
     59
     60    public function add_logs($arr)
     61    {
     62        $arr[] ='wordpress';
     63        return $arr;
     64    }
    5865}
    5966//todo:find a better way to create new object
  • appexperts/trunk/includes/integrations/wordpress/backend/app-expert-taxonomy-image-settings.php

    r2789917 r2833215  
    1010        add_filter('ae_default_settings_tab',array($this, 'set_default_settings_tab'), 10, 1);
    1111        add_action('admin_init', [$this, 'register_settings']);
     12        add_filter('ae_daily_log_custom_settings',array($this,"add_logs"));
    1213
    1314    }
     
    4445        return "settings";
    4546    }
     47    public function add_logs($settings_array){
     48        $settings_array['taxonomy_images']=   get_option('aeci_options');
     49        return $settings_array;
     50    }
    4651}
  • appexperts/trunk/includes/integrations/yith-woocommerce-wishlist/app-expert-yith-woocommerce-wishlist-init.php

    r2789917 r2833215  
    2222       return plugin_dir_path(__FILE__);
    2323    }
     24
     25    public function add_logs($arr)
     26    {
     27        $arr[] ='yith-woocommerce-wishlist';
     28        return $arr;
     29    }
    2430}
    2531
  • appexperts/trunk/readme.txt

    r2828704 r2833215  
    66Requires at least: 4.5.0
    77Tested up to: 6.0
    8 Stable tag: 1.3.3
     8Stable tag: 1.3.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    105105== Changelog ==
    106106
     107= 1.3.4 2022-12-13  =
     108* Added - Shimmer Loading
     109* Added - Custom App Loader
     110* Added - App Caching
     111* Added - Terms & Conditions
     112* Added - Option to delete account
     113* Added - Integration with PeepSo (Pro Feature)
     114* Added - Admob Integration (Pro Feature)
     115* Added - Google Analytics (Pro Feature)
     116
    107117= 1.3.3 2022-11-1 =
    108118* Added - Integration with Peepso
Note: See TracChangeset for help on using the changeset viewer.