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); }
public function column_col_name($item) { $html = $item['col_name']; $setting = new MM_Setting_Model(); $setting->load(); $components = $setting->plugins; if (!is_array($components)) { $components = array(); } if (in_array($item['col_id'], $components)) { $html .= '<br><a class="mm-plugin" data-type="deactive" data-id="' . esc_attr($item['col_id']) . '" href="#">' . __('Deactivate <i class="fa fa-circle-o-notch fa-spin loader-ani hide"></i>', mmg()->domain) . '</a>'; } else { $html .= '<br><a class="mm-plugin" data-type="active" data-id="' . esc_attr($item['col_id']) . '" href="#">' . __('Activate <i class="fa fa-circle-o-notch fa-spin loader-ani hide"></i>', mmg()->domain) . '</a>'; } return $html; }
function create_page() { if (isset($_POST['m_type'])) { $model = new MM_Setting_Model(); $model->load(); switch ($_POST['m_type']) { case 'inbox': $new_id = wp_insert_post(apply_filters('mm_create_inbox_page', array('post_title' => "Inbox", 'post_content' => '[message_inbox]', 'post_status' => 'publish', 'post_type' => 'page', 'ping_status' => 'closed', 'comment_status' => 'closed'))); $model->inbox_page = $new_id; $model->save(); //update echo $new_id; break; } } exit; }
function setting() { $setting = new MM_Setting_Model(); $setting->load(); return $setting; }
<?php $user_setting = get_user_meta(get_current_user_id(), '_messages_setting', true); if (!$user_setting) { $user_setting = array('enable_receipt' => '1', 'prevent_receipt' => '0'); } $setting = new MM_Setting_Model(); $setting->load(); if ($setting->user_receipt == false) { ?> <br/> <div class="well well-sm row"> <?php _e("This feature has been disabled by admin", mmg()->domain); ?> </div> <?php return; } else { ?> <br/> <?php if ($this->has_flash('user_setting_' . get_current_user_id())) { ?> <div class="alert alert-success"><?php echo $this->get_flash('user_setting_' . get_current_user_id()); ?> </div> <?php }
function setting() { wp_enqueue_style('mm_style'); add_action('mm_setting_general', array(&$this, 'general_view')); add_action('mm_setting_email', array(&$this, 'email_view')); add_action('mm_setting_shortcode', array(&$this, 'shortcode_view')); add_action('mm_setting_attachment', array(&$this, 'attachment_view')); $model = new MM_Setting_Model(); $model->load(); $this->render('backend/setting', array('model' => $model)); }