Пример #1
0
 /**
  * @ajax
  */
 function tfuse_ajax_slider_title_exists()
 {
     tf_can_ajax();
     if ($this->request->isset_POST('slider_title')) {
         if ($this->model->title_exists($this->request->POST('slider_title'))) {
             tfjecho(array('status' => -1, 'message' => apply_filters('tf_ext_slider_ajax_slider_title_exists_1', __('A slider with the title you have provided, already exists. Please give a different title for your slider.', 'tfuse'))));
         } else {
             tfjecho(array('status' => 1, 'message' => __('OK', 'tfuse')));
         }
     } else {
         tfjecho(array('status' => -1, 'message' => apply_filters('tf_ext_slider_ajax_slider_title_exists_2', __('You have not provided a title for your slider. Please, do so.', 'tfuse'))));
     }
     die;
 }
Пример #2
0
 /**
  * @ajax
  */
 function tfuse_ajax_add_shortcode_page()
 {
     if (!tf_current_user_can(array('edit_posts'), false)) {
         die(__('Access denied', 'tfuse'));
     }
     $data = array();
     $this->load_shortcode_files(TRUE);
     $data['shortcodes'] = $this->get_shortcodes();
     $shc_ids = array();
     foreach ($data['shortcodes'] as $type => $atts) {
         $shc_ids[$type] = $atts['IDs'];
     }
     $data['categories'] = $this->get_categories();
     $flipped = array_flip($data['categories']);
     $categories = array('all' => __('Show all', 'tfuse'));
     foreach ($flipped as $key => $val) {
         $categories[$key] = $val;
     }
     $data['category_option'] = array('name' => __('Shortcode Categories', 'tfuse'), 'desc' => __('Shortcode Categories', 'tfuse'), 'id' => 'tf_shortcode_categories', 'value' => 'all', 'options' => $categories, 'type' => 'select');
     $data['filter_option'] = array('name' => __('Shortcode Text Fitler', 'tfuse'), 'desc' => __('Shortcode Text Filter', 'tfuse'), 'id' => 'tf_shortcode_text_filter', 'value' => '', 'type' => 'text');
     $data['ext_name'] = $this->_the_class_name;
     $out = $this->load->ext_view($this->_the_class_name, 'all_shortcodes', $data, TRUE);
     tfjecho(array('status' => 1, 'content' => utf8_encode($out), 'shc_ids' => $shc_ids));
 }
Пример #3
0
function tf_can_ajax()
{
    if (!current_user_can('publish_pages')) {
        tfjecho(array('status' => -1, 'message' => __('You do not have the required privileges for this action.', 'tfuse')));
    }
}
Пример #4
0
 /**
  * @ajax
  */
 function tfuse_ajax_newsletter_save_email()
 {
     $newsletter_service = $this->model->get_service();
     if (!$newsletter_service || $newsletter_service == 'none') {
         tfjecho(array('status' => -1, 'message' => __('Newsletter service not configured.', 'tfuse')));
     }
     if (!is_email($this->request->POST('email'))) {
         tfjecho(array('status' => -2, 'message' => __('Invalid email provided.', 'tfuse')));
     }
     if (!method_exists($this, 'save_email_' . $newsletter_service)) {
         tfjecho(array('status' => -1, __('Save function not defined for ', 'tfuse') . $newsletter_service . ' newsletter service.'));
     }
     if ($this->{'save_email_' . $newsletter_service}($this->request->POST('email'))) {
         tfjecho(array('status' => 1));
     } else {
         tfjecho(array('status' => -1, 'message' => __('Could not save this email with the newsletter service.', 'tfuse')));
     }
     die;
 }
Пример #5
0
 /**
  * @ajax
  */
 public function tfuse_ajax_sidebars_delete_settings()
 {
     tf_can_ajax();
     $data = explode('+', $this->request->POST('data'));
     $vars = array();
     if (isset($data[0])) {
         if (isset($data[1])) {
             $vars['subtype'] = $data[1];
             if (isset($data[2])) {
                 $vars['id'] = $data[2];
             }
         }
     }
     if ($this->model->delete_settings($vars)) {
         tfjecho(array('status' => 1));
     }
     die;
 }