function sent_notification(MM_Message_Model $model)
 {
     //send message
     $setting = new MM_Setting_Model();
     $setting->load();
     $link = add_query_arg('message_id', $model->id, get_permalink(mmg()->setting()->inbox_page));
     $data = array('SITE_NAME' => get_bloginfo('name'), 'FROM_NAME' => $model->get_name($model->send_from), 'POST_LINK' => $link, 'FROM_MESSAGE' => $model->content);
     $data = apply_filters('message_notification_params', $data, $this);
     $subject = stripslashes($setting->noti_subject);
     $content = stripslashes($setting->noti_content);
     foreach ($data as $key => $val) {
         $subject = str_replace($key, $val, $subject);
         $content = str_replace($key, $val, $content);
     }
     $sendto = get_userdata($model->send_to);
     $from = get_userdata($model->send_from);
     //prepare atachments
     $attachments = array();
     if ($model->attachment) {
         $ids = explode(',', $model->attachment);
         $ids = array_filter($ids);
         foreach ($ids as $id) {
             if (filter_var($id, FILTER_VALIDATE_INT)) {
                 $upload = IG_Uploader_Model::model()->find($id);
                 if (is_object($upload) && $upload->file) {
                     $attachments[] = get_attached_file($upload->file);
                 }
             }
         }
     }
     $headers = array('From: ' . $model->get_name($model->send_from) . ' <' . $from->user_email . '>', 'Content-Type: text/html; charset=UTF-8');
     wp_mail($sendto->user_email, $subject, $content, $headers, $attachments);
 }
Example #2
0
        echo mmg()->html_beautifier($message->content);
        ?>
                    </div>
                    <?php 
        $ids = explode(',', $message->attachment);
        $ids = array_filter($ids);
        if (count($ids)) {
            ?>
                        <hr/>
                        <div class="message-footer">
                            <div class="row">
                                <?php 
            foreach ($ids as $id) {
                ?>
                                    <?php 
                $a_m = IG_Uploader_Model::model()->find($id);
                ?>
                                    <div class="col-md-6 message-attachment">
                                        <a class="load-attachment-info" data-target="#<?php 
                echo $id;
                ?>
" href="#<?php 
                echo $id;
                ?>
">
                                            <i class="fa fa-paperclip fa-2x pull-left"></i>
                                            <?php 
                echo $a_m->name;
                ?>
                                        </a>
 function show_media($model, $attribute)
 {
     wp_enqueue_style('igu-uploader');
     wp_enqueue_script('ig-leanmodal');
     $ids = $model->{$attribute};
     $models = array();
     if (!is_array($ids)) {
         $ids = explode(',', $ids);
         $ids = array_filter(array_unique($ids));
     }
     if (!empty($ids)) {
         $models = IG_Uploader_Model::model()->all_with_condition(array('status' => 'publish', 'post__in' => $ids));
     }
     $this->render('show_media', array('models' => $models));
 }
Example #4
0
<div class="ig-container">
    <?php 
//empty modal for fields work only
if (!isset($model)) {
    $model = new IG_Uploader_Model();
}
$form = new IG_Active_Form($model);
$form->open(array("attributes" => array("class" => "igu-upload-form", "style" => "min-width:60%;max-width:304px")));
?>
    <?php 
if ($model->exist) {
    $form->hidden('id');
}
?>
    <div style="margin-bottom: 0" class="form-group <?php 
echo $model->has_error("file") ? "has-error" : null;
?>
">
        <button type="button"
                class="btn btn-default upload_image_button btn-xs"><?php 
_e("Choose File", ig_uploader()->domain);
?>
</button>
        <span class="file-upload-name"></span>
        <?php 
$form->hidden('file', array('attributes' => array('id' => 'attachment')));
?>
        <?php 
if ($model->exist && $model->file) {
    ?>
            <span