public function __construct() { global $wpdb; global $psp; $this->the_plugin = $psp; $this->fb_details = $this->the_plugin->getAllSettings('array', 'facebook_planner'); // store wpdb instance self::$db = $wpdb; // start instance of fb post planner self::$fbUtils = psp_fbPlannerUtils::getInstance(); // tmp array $wplannerfb_settings = $this->fb_details; // create utils self::$utils = array('email_prompt' => $wplannerfb_settings['email'], 'email_subject' => $wplannerfb_settings['email_subject'], 'email_message' => $wplannerfb_settings['email_message'], 'email_message_lock' => 0, 'cron' => array('table' => self::$db->prefix . 'psp_post_planner_cron', 'time_zone' => $wplannerfb_settings['timezone'], 'first_time ' => time())); // set new timezone if (trim(self::$utils['cron']['time_zone']) != "") { $this->setTImezone(); } // update now self::$now = strtotime(date("Y-m-d H:i:s")); }
public function fb_postFB_callback() { $id = (int) $_POST['postId']; $wherePost = serialize($_POST['postTo']); $privacy = $_POST['privacy']; $postData = array('name' => $_POST['psp_wplannerfb_title'], 'link' => trim($_POST['psp_wplannerfb_permalink']) == 'custom_link' ? trim($_POST['psp_wplannerfb_permalink_value']) : get_permalink($id), 'description' => $_POST['psp_wplannerfb_description'], 'caption' => $_POST['psp_wplannerfb_caption'], 'message' => $_POST['psp_wplannerfb_message'], 'picture' => $_POST['psp_wplannerfb_image'], 'use_picture' => $_POST['psp_wplannerfb_useimage']); // Plugin facebook utils load require_once 'app.fb-utils.class.php'; // start instance of fb post planner $fbUtils = psp_fbPlannerUtils::getInstance(); $publishToFBResponse = $fbUtils->publishToWall($id, $wherePost, $privacy, $postData); if ($publishToFBResponse === true) { echo 'OK'; } else { echo 'ERROR'; } die; // this is required to return a proper result }