· 8 years ago · Nov 29, 2017, 01:34 AM
1Ðужно Ñделать так [myckontent_page id="ЗдеÑÑŒ опубликованный контент"]
2
3
4код Ñтраницы публикации
5
6<?php
7
8if (!class_exists("DjdSitePost")) {
9 class DjdSitePost {
10
11 /*--------------------------------------------*
12 * Constructor
13 *--------------------------------------------*/
14
15 /**
16 * Initializes the plugin by setting localization, filters, and administration functions.
17 */
18 function __construct() {
19
20 // Load plugin text domain
21 add_action( 'init', array( $this, 'plugin_textdomain' ) );
22
23 // Register site styles and scripts
24 add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) );
25 add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) );
26
27 // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
28 register_activation_hook( __FILE__, array( $this, 'activate' ) );
29 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
30 register_uninstall_hook( __FILE__, array( 'djd-site-post', 'uninstall' ) );
31
32 //Hooking in to setup admin settings page and settings menu
33 add_action('admin_init', array($this, 'admin_init'));
34 add_action('admin_menu', array($this, 'add_menu'));
35
36 /**
37 * Custom actions
38 */
39
40 // Setup Ajax Support
41 add_action('wp_ajax_process_site_post_form', array( $this, 'process_site_post_form' ) );
42 add_action('wp_ajax_nopriv_process_site_post_form', array( $this, 'process_site_post_form' ) );
43
44 // Hide Toolbar
45 add_action('init', array($this, 'hide_toolbar'));
46
47 // Redirect non admin users from dashboard
48 //add_action( 'admin_init', array($this, 'redirect_nonadmin_fromdash'), 1);
49
50 // Register a widget to show the post form in a sidebar
51 add_action( 'widgets_init', array($this,'register_form_widget' ));
52
53 // Save an auto-draft to get a valid post-id
54 add_action ('save_djd_auto_draft', array($this, 'save_djd_auto_draft'));
55
56 /**
57 * Custom filter
58 */
59
60 // Print an edit post on front end link whenever an edit post link is printed on front end.
61 add_filter('edit_post_link', array($this, 'edit_post_link'), 10, 2);
62
63 // Redirect non admin users from dashboard
64 // add_filter('login_redirect', array($this, 'djd_login_redirect'), 10, 3);
65
66 //Call our shortcode handler
67 add_shortcode('djd-site-post', array($this, 'handle_shortcode'));
68
69 } // end constructor
70
71 /**
72 * Fired when the plugin is activated.
73 *
74 * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
75 */
76
77 public function activate( $network_wide ) {
78 $this->set_default_options();
79 } // end activate
80
81 /**
82 * Loads the plugin text domain for translation
83 */
84 public function plugin_textdomain() {
85 $domain = 'djd-site-post';
86 $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
87 load_textdomain( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' );
88 load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
89 } // end plugin_textdomain
90
91 /**
92 * Registers and enqueues admin-specific styles.
93 */
94 public function register_admin_styles() {
95 wp_enqueue_style( 'djd-site-post-admin-styles', plugins_url( 'djd-site-post/css/admin.css' ) );
96 } // end register_admin_styles
97
98 /**
99 * Registers and enqueues admin-specific JavaScript.
100 */
101 public function register_admin_scripts() {
102 wp_enqueue_script( 'djd-site-post-admin-script', plugins_url( 'djd-site-post/js/admin.js' ) );
103 } // end register_admin_scripts
104
105 /**
106 * Registers and enqueues plugin-specific styles.
107 */
108 public function register_plugin_styles() {
109 wp_enqueue_style( 'djd-site-post-styles', plugins_url( 'djd-site-post/css/display.css' ) );
110 } // end register_plugin_styles
111
112 /**
113 * Registers and enqueues plugin-specific scripts.
114 */
115 public function register_plugin_scripts() {
116 wp_enqueue_script( 'djd-site-post-script', plugins_url( 'djd-site-post/js/display.js' ) );
117 wp_enqueue_script( 'djd-site-post-ajax-script', plugins_url( 'djd-site-post/js/script.js' ) );
118 } // end register_plugin_scripts
119
120 /**
121 * Registers our post form widget.
122 */
123 public function register_form_widget() {
124 require(sprintf("%s/inc/djdsp-widget.php", dirname(__FILE__)));
125 register_widget( 'djd_site_post_widget' );
126 } // end register_form_widget
127
128 /*
129 * Hook into WP's admin_init action hook
130 */
131 public function admin_init() {
132 // Set up the settings for this plugin
133 $this->init_settings();
134 } // end public static function activate
135
136 /*
137 * Redirect non admin users from dashboard
138 */
139 public function redirect_nonadmin_fromdash() {
140 $djd_options = get_option('djd_site_post_settings');
141
142 if ( $_SERVER['PHP_SELF'] == '/wp-admin/async-upload.php' ) {
143 /* allow users to upload files */
144 return true;
145 } else if ( $djd_options['djd-no-backend'] && ( current_user_can('contributor') || current_user_can('subscriber')) ) {
146 /* custom function get_user_role() checks user role,
147 requires administrator, else redirects */
148 wp_safe_redirect(site_url());
149 exit;
150 }
151 }
152
153 public function djd_login_redirect( $redirect_to, $request, $user ) {
154 return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : site_url();
155 }
156
157 /*
158 * Setting default values and store them in db
159 */
160 public function set_default_options() {
161 $defaultAdminOptions = array(
162 'djd-form-name' => '',
163 'djd-publish-status' => 'publish',
164 'djd-post-confirmation' => '',
165 'djd-post-fail' => '',
166 'djd-redirect' => '',
167 'djd-mail' => '1',
168 'djd-hide-toolbar' => '1',
169 'djd-hide-edit' => '0',
170 'djd-login-link' => '1',
171 'djd-post-format' => '0',
172 'djd-allow-guest-posts' => '0',
173 'djd-guest-account' => '1',
174 'djd-guest-cat-select' => '0',
175 'djd-guest-cat' => '',
176 'djd-categories' => 'list',
177 'djd-default-category' => '1',
178 'djd-allow-new-category' => '0',
179 'djd-category-order' => 'id',
180 'djd-title-required' => '1',
181 'djd-show-excerpt' => '1',
182 'djd-allow-media-upload' => '1',
183 'djd-upload-no-content' => '1',
184 'djd-show-tags' => '0',
185 'djd-guest-info' => '1',
186 'djd-title' => '',
187 'djd-excerpt' => '',
188 'djd-content' => '',
189 'djd-editor-style' => 'rich',
190 'djd-upload' => '',
191 'djd-tags' => '',
192 'djd-categories-label' => '',
193 'djd-create-category' => '',
194 'djd-send-button' => ''
195 );
196 // Check for previous options that might be stored in db
197 $dbOptions = get_option('djd_site_post_settings');
198 if (!empty($dbOptions)) {
199 foreach ($dbOptions as $key => $option)
200 $defaultAdminOptions[$key] = $option;
201 }
202 update_option('djd_site_post_settings', $defaultAdminOptions);
203 } // end set_default_options()
204
205 /*
206 * Initialize some custom settings
207 */
208 public function init_settings() {
209 // Register the settings for this plugin
210 register_setting('djd_site_post_template_group', 'djd_site_post_settings', array($this, 'djd_site_post_validate_input'));
211 } // end public function init_custom_settings()
212
213 /*
214 * Add a menu for our settings page
215 */
216 public function add_menu() {
217 add_options_page(__('DJD Site Post Settings', 'djd-site-post'), __('DJD Site Post', 'djd-site-post'), 'manage_options', 'djd-site-post-settings', array($this, 'plugin_settings_page'));
218 } // end public function add_menu()
219
220 /*
221 * Admin menu callback
222 */
223 public function plugin_settings_page() {
224 if(!current_user_can('manage_options')) {
225 wp_die(__('You do not have sufficient permissions to access this page.', 'djd-site-post'));
226 }
227 // Render the settings template
228 include(sprintf("%s/views/admin.php", dirname(__FILE__)));
229 } // end public function plugin_settings_page()
230
231 //function plugin_options_tabs() {
232 // $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'djdspp_general_settings';
233 //
234 // screen_icon();
235 // echo '<h2 class="nav-tab-wrapper">';
236 // foreach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {
237 // $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
238 // echo '<a class="nav-tab ' . $active . '" href="?page=' . 'djd-site-post-settings' . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
239 // }
240 // echo '</h2>';
241 //}
242
243 /*
244 * Validate input
245 */
246 public function djd_site_post_validate_input($input) {
247
248 // Create our array for storing the validated options
249 $output = array();
250
251 // Loop through each of the incoming options
252 foreach( $input as $key => $value ) {
253
254 // Check to see if the current option has a value. If so, process it.
255 if( isset( $input[$key] ) ) {
256 // Strip all HTML and PHP tags and properly handle quoted strings
257 $output[$key] = esc_attr(strip_tags( stripslashes( $input[ $key ] ) ) );
258 }
259 }
260 // Return the array processing any additional functions filtered by this action
261 return apply_filters( 'djd_site_post_validate_input', $output, $input );
262 }
263
264 // Following two functions make sure that image attachment gets the right post-id
265 public function djd_insert_media_fix( $post_id ) {
266 global $djd_media_post_id;
267 global $post_ID;
268
269 /* WordPress 3.4.2 fix */
270 $post_ID = $post_id;
271
272 /* WordPress 3.5.1 fix */
273 $djd_media_post_id = $post_id;
274 add_filter( 'media_view_settings', array($this, 'djd_insert_media_fix_filter'), 10, 2 );
275 }
276
277 public function djd_insert_media_fix_filter( $settings, $post ) {
278 global $djd_media_post_id;
279
280 $settings['post']['id'] = $djd_media_post_id;
281 $settings['post']['nonce'] = wp_create_nonce( 'update-post_' . $djd_media_post_id );
282 return $settings;
283 }
284
285 /*---------------------------------------------*
286 * Core Functions
287 *---------------------------------------------*/
288
289 /*
290 * Print a link to edit post on front end whenever an edit post link is printed on front end.
291 */
292 function edit_post_link($link, $post_id) {
293 if ( 'page' != get_post_type($post_id) ) {
294 $djd_options = get_option('djd_site_post_settings');
295 if ( $djd_options['djd-edit-page'] ) {
296 if ( $djd_options['djd-hide-edit'] ) {
297 $link = '<a class="post-edit-link" href="' . home_url('/') . '?page_id='.$djd_options['djd-edit-page'] . '&post_id='.$post_id . '" title="Frontend Edit">Frontend Edit</a>';
298 } else {
299 $link = $link . ' | <a class="post-edit-link" href="' . home_url('/') . '?page_id='.$djd_options['djd-edit-page'] . '&post_id='.$post_id . '" title="Frontend Edit">Frontend Edit</a>';
300 }
301 }
302 }
303 return $link;
304 }
305
306 /*
307 * Format error messages for output.
308 */
309 function format_error_msg($message, $type = '', $source = ''){
310 $html = '<p style="color:red"><em>';
311 if(!$type)
312 $type = __("Error", 'djd-site-post');
313 $html .= "<strong>" . htmlspecialchars($type) . "</strong>: ";
314 $html .= $message;
315 $html .= '</em></p>';
316 if($source){
317 $html .= '<pre style="margin-left:5px; border-left:solid 1px red; padding-left:5px;"><code class="xhtml malformed">';
318 $html .= htmlspecialchars($source);
319 $html .= '</code></pre>';
320 }
321 return $html;
322 }
323
324 /*
325 * Hide the WordPress Toolbar.
326 */
327 function hide_toolbar() {
328 $djd_options = get_option('djd_site_post_settings');
329 if ( $djd_options['djd-hide-toolbar'] ) {
330 add_filter('show_admin_bar', '__return_false');
331 }
332 }
333
334 /*
335 * Get current user info. If user is not logged in we check if guest posts are permitted and set variables accordingly.
336 */
337 function verify_user() {
338 $djd_userinfo = array ();
339 $djd_options = get_option('djd_site_post_settings');
340
341 if (is_user_logged_in()) {
342 global $current_user;
343 get_currentuserinfo();
344 $djd_userinfo['djd_user_id'] = $current_user->ID;
345 $djd_userinfo['djd_user_login'] = $current_user->user_login;
346 if ( current_user_can('publish_posts') )
347 $djd_userinfo['djd_can_publish_posts'] = true;
348 if ( current_user_can('manage_categories') )
349 $djd_userinfo['djd_can_manage_categories'] = true;
350
351 if ( current_user_can('contributor') ) {
352 $contributor = get_role('contributor');
353 $contributor->add_cap('upload_files');
354 $contributor->add_cap('read');
355 $contributor->add_cap('edit_posts');
356 $contributor->add_cap('edit_published_pages');
357 $contributor->add_cap('edit_others_pages');
358 $djd_userinfo['media_upload'] = true;
359 }
360 return $djd_userinfo;
361
362 } elseif ( (!is_user_logged_in()) && ($djd_options['djd-allow-guest-posts']) ) {
363 $user_query = get_userdata($djd_options['djd-guest-account']);
364 $djd_userinfo['djd_user_id'] = $user_query->ID;
365 $djd_userinfo['djd_user_login'] = $user_query->user_login;
366
367 // We give guests rights as a subscriber. Very limited, no media uploads.
368 $djd_userinfo['djd_can_manage_categories'] = false;
369 $djd_userinfo['djd_can_publish_posts'] = true;
370 $djd_userinfo['publish_status'] = 'pending';
371 $djd_userinfo['media_upload'] = false;
372
373 return $djd_userinfo;
374 }
375 return false;
376 } // end verify_user()
377
378 function djd_check_user_role( $role, $user_id = null ) {
379
380 if ( is_numeric( $user_id ) )
381 $user = get_userdata( $user_id );
382 else
383 $user = wp_get_current_user();
384
385 if ( empty( $user ) )
386 return false;
387 return in_array( $role, (array) $user->roles );
388 }
389
390 function save_djd_auto_draft( $error_msg = false ) {
391
392 global $djd_post_id;
393
394 if (!function_exists('get_default_post_to_edit')){
395 require_once(ABSPATH . "wp-admin" . '/includes/post.php');
396 }
397
398 /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
399 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID
400 if ( $last_post_id ) {
401 $post = get_post( $last_post_id );
402 if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
403 $post = get_default_post_to_edit( 'post', true );
404 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
405 } else {
406 $post->post_title = ''; // Remove the auto draft title
407 }
408 } else {
409 $post = get_default_post_to_edit( 'post' , true);
410 $user_id = get_current_user_id();
411 // Don't create an option if this is a super admin who does not belong to this site.
412 if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
413 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
414 }
415
416 $djd_post_id = (int) $post->ID;
417
418 // Getting the right post-id for media attachments
419 $this->djd_insert_media_fix( $djd_post_id );
420
421 }
422
423 /*
424 * Registers the shortcode that has a required @name param indicating the function which returns the HTML code for the shortcode.
425 *
426 * Shortcode: [djd-site-post] With parameters: [djd-site-post success_url="url" success_page_id="id"]
427 * Parameters:
428 * success_url: URL of the page to redirect to after the post.
429 * success_page_id: ID of the page to redirect to after the post. Overwrites success_url if set.
430 */
431 function handle_shortcode($atts, $content = null){
432
433 global $shortcode_cache, $post, $djd_post_id;
434
435 extract(shortcode_atts(array(
436 'success_url' => '',
437 'success_page_id' => 0,
438 'called_from_widget' => '0',
439 ), $atts));
440 $form_name = 'site_post_form';
441 $djd_options = get_option('djd_site_post_settings');
442
443 // Check for user logged in or guest posts permitted.
444 if(!$user_verified = $this->verify_user())
445 return $this->format_error_msg(__("Ðта Ñтраница доÑтупна только <br> зарегиÑтрированым пользователÑм.", 'djd-site-post'),__("Внмание", 'djd-site-post'));
446
447 do_action ('save_djd_auto_draft');
448
449 // success_page_id overwrites success_url.
450 if($success_page_id)
451 $success_url = get_permalink($success_page_id);
452
453 // Shortcode 'success_url' attribute. This has priority over redirect set in admin panel.
454 if(!$success_url) {
455 $success_url = $djd_options['djd-redirect'];
456 if (empty($success_url)) $success_url = home_url() . "/";
457 }
458
459 // Call the function and grab the results (if nothing, output a comment noting that it was empty).
460 // This one calls the form presented to the user.
461 return call_user_func_array(array($this, $form_name), array($atts, $content, $user_verified, $djd_post_id, $called_from_widget));
462
463 }
464
465 function process_site_post_form() {
466 if( isset($_POST) ){
467
468 $djd_options = get_option('djd_site_post_settings');
469
470 if ( !empty ($_POST["djd-our-id"])) $djd_post_id = $_POST["djd-our-id"];
471
472 // Create post object with defaults
473 $my_post = array(
474 'ID' => $djd_post_id,
475 'post_title' => '',
476 'post_status' => 'publish',
477 'post_author' => '',
478 'post_category' => '',
479 'comment_status' => 'open',
480 'ping_status' => 'open',
481 'post_content' => '',
482 'post_excerpt' => '',
483 'post_type' => 'post',
484 'tags_input' => '',
485 'to_ping' => ''
486 );
487
488 //Fill our $my_post array
489 $my_post['post_title'] = wp_strip_all_tags($_POST['djd_site_post_title']);
490
491 if( array_key_exists('djdsitepostcontent', $_POST)) {
492 $my_post['post_content'] = $_POST['djdsitepostcontent'];
493 }
494 if( array_key_exists('djd_site_post_excerpt', $_POST)) {
495 $my_post['post_excerpt'] = wp_strip_all_tags($_POST['djd_site_post_excerpt']);
496 }
497 if( array_key_exists('djd_site_post_select_category', $_POST)) {
498 $ourCategory = array($_POST['djd_site_post_select_category']);
499 }
500 if( array_key_exists('djd_site_post_checklist_category', $_POST)) {
501 $ourCategory = $_POST['djd_site_post_checklist_category'];
502 }
503 if( array_key_exists('djd_site_post_new_category', $_POST)) {
504 if (!empty( $_POST['djd_site_post_new_category']) ) {
505 require_once(WP_PLUGIN_DIR . '/../../wp-admin/includes/taxonomy.php');
506 if ($newCatId = wp_create_category(wp_strip_all_tags($_POST['djd_site_post_new_category']))) {
507 $ourCategory = array($newCatId);
508 } else {
509 throw new Exception(__('Unable to create new category. Please try again or select an existing category.', 'djd-site-post'));
510 }
511 }
512 }
513
514 if ( ! is_user_logged_in() && ! $djd_options['djd-guest-cat-select'] ) {
515 $ourCategory = array( $djd_options['djd-guest-cat'] );
516 }
517
518 $my_post['post_category'] = $ourCategory;
519
520 if ( !empty ($_POST["djd-our-author"])) {
521 $my_post['post_author'] = $_POST["djd-our-author"];
522 } else {
523 $my_post['post_author'] = $user_verified['djd_user_id'];
524 }
525
526 if( array_key_exists('djd_site_post_tags', $_POST)) {
527 $my_post['tags_input'] = wp_strip_all_tags($_POST['djd_site_post_tags']);
528 }
529
530 if( $djd_options['djd-publish-status']) {
531 $my_post['post_status'] = $djd_options['djd-publish-status'];
532 }
533 if( array_key_exists('djd-priv-publish-status', $_POST)) {
534 $my_post['post_status'] = wp_strip_all_tags($_POST['djd-priv-publish-status']);
535 }
536
537 // Insert the post into the database
538 $post_success = wp_update_post( $my_post );
539
540 if($post_success === false) {
541 $result = "error";
542 }
543 else {
544 $result = "success";
545 //if ( 'publish' == $my_post['post_status'] ) do_action('publish_post');
546 if (isset($_POST['djd-post-format'])) {
547 set_post_format( $post_success, wp_strip_all_tags($_POST['djd-post-format']));
548 } else {
549 set_post_format( $post_success, wp_strip_all_tags($djd_options['djd-post-format-default']));
550 }
551 }
552
553 if( array_key_exists('djd_site_post_guest_name', $_POST)) {
554 add_post_meta( $post_success, 'guest_name', wp_strip_all_tags($_POST['djd_site_post_guest_name']), true ) || update_post_meta( $post_success, 'guest_name', wp_strip_all_tags($_POST['djd_site_post_guest_name']) );
555 }
556 if( array_key_exists('djd_site_post_guest_email', $_POST)) {
557 add_post_meta( $post_success, 'guest_email', wp_strip_all_tags($_POST['djd_site_post_guest_email']), true ) || update_post_meta( $post_success, 'guest_name', wp_strip_all_tags($_POST['djd_site_post_guest_name']) );
558 }
559
560 if(apply_filters('form_abort_on_failure', true, $form_name))
561 $success = $post_success;
562 if($success){
563 if($djd_options['djd-mail']) {
564 $this->djd_sendmail($post_success, wp_strip_all_tags($_POST['djd_site_post_title']));
565 }
566 if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
567 echo $result;
568 } else {
569 setcookie('form_ok', 1, time() + 10, '/');
570 header("Location: ".$_SERVER["HTTP_REFERER"]);
571 die();
572 }
573 }
574 else {
575 throw new Exception( $djd_options['djd-post-fail'] ? $djd_options['djd-post-fail'] : __('We were unable to accept your post at this time. Please try again. If the problem persists tell the site owner.', 'djd-site-post'));
576 }
577 } // isset($_POST)
578 die();
579 } //function process_site_post_form
580
581 /**
582 * Notify admin about new post via email
583 */
584 function djd_sendmail ($post_id, $post_title) {
585 $blogname = get_option('blogname');
586 $email = get_option('admin_email');
587 $headers = "MIME-Version: 1.0\r\n" . "From: ".$blogname." "."<".$email.">\n" . "Content-Type: text/HTML; charset=\"" . get_option('blog_charset') . "\"\r\n";
588 $content = '<p>'.__('New post submitted from frontend to', 'djd-site-post').' '.$blogname.'.'.'<br/>' .__('To view the entry click here:', 'djd-site-post') . ' '.'<a href="'.get_permalink($post_id).'"><strong>'.$post_title.'</strong></a></p>';
589 wp_mail($email, __('New frontend post to', 'djd-site-post') . ' ' . $blogname . ': ' . $post_title, $content, $headers);
590 }
591
592 /**
593 * Print the post form at the front end
594 */
595 function site_post_form($attrs, $content = null, $verified_user, $djd_post_id, $called_from_widget){
596 ob_start();
597 global $current_user; //Global WordPress variable that stores what get_currentuserinfo() returns.
598 get_currentuserinfo();
599 $djd_options = get_option('djd_site_post_settings'); //Read the plugin's settings out of wpdb table wp_options.
600
601 // Render the form html
602
603 include_once (sprintf("%s/views/display.php", dirname(__FILE__)));
604
605 $ret = ob_get_contents();
606 ob_end_clean();
607 return $ret;
608 }
609
610 /**
611 * Send debug code to the Javascript console
612 */
613 function dtc($data) {
614 if(is_array($data) || is_object($data))
615 {
616 echo("<script>console.log('PHP: ".json_encode($data)."');</script>");
617 } else {
618 echo("<script>console.log('PHP: ".$data."');</script>");
619 }
620 }
621
622 } // end class
623} // end if (!class_exists)
624
625$djd_site_post = new DjdSitePost();