Appointmind.com. Version: 3.8.1 Author: GentleSource Author URI: https://www.appointmind.com/?tracking=wordpress Text Domain: appointmind Domain Path: /languages */ require_once dirname(__FILE__) . '/settings.php'; require_once dirname(__FILE__) . '/widget.php'; /** * */ class Appointmind { /** * View object */ private $view = null; /** * Settings */ private $settings = null; /** * Register Hooks and do other constructing stuff */ public function __construct() { add_shortcode('appointmind_calendar', array(&$this, 'displayArticleCalendarShortCode')); add_shortcode('appointmind_patient_order', array(&$this, 'displayArticlePatientOrderFormShortCode')); add_filter('the_content', array(&$this, 'displayArticleCalendar')); add_action('widgets_init', array(&$this, 'registerSidebarWidget')); add_action('init', array(&$this, 'defineLocale')); add_action('init', array(&$this, 'init')); add_action('wp_footer', array(&$this, 'footerCode'), 9999); $this->settings = new AppointmindSettings; add_action('admin_menu', array(&$this->settings, 'settingsMenu')); $this->view = new stdClass; $this->view->placeHolder = $this->settings->placeHolder; $this->view->settingOptionName = $this->settings->settingOptionName; } /** * Define locale stuff */ public function defineLocale() { load_plugin_textdomain($this->settings->settingOptionName, dirname(__FILE__) . '/languages', basename(dirname(__FILE__)) . '/languages'); } /** * Init */ public function init() { wp_enqueue_script('jquery'); } /** * Footer */ public function footerCode() { $settings = $this->settings->readSettings(); $this->view = (object) array_merge((array) $this->view, $settings); $urlParts = parse_url($this->view->calendarUrl); $appointmindUrlDomain = $urlParts['scheme'] . '://' . $urlParts['host']; $appointmindUrlPath = $urlParts['path']; $appointmindUrlParameters = ''; if (!empty($urlParts['query'])) { $appointmindUrlParameters = '?' . $urlParts['query']; } $view = $this->view; include dirname(__FILE__) . '/templates/footer_code.php'; } /** * Display calendar in article */ public function displayArticleCalendar($content) { if (strpos($content, '{' . $this->settings->placeHolder . '}') === false) { return $content; } $settings = $this->settings->readSettings(); $this->view = (object) array_merge((array) $this->view, $settings); if (empty($this->view->calendarUrl) or $this->view->calendarUrl == 'http://') { return str_replace('{' . $this->settings->placeHolder . '}', '', $content); } $urlParts = parse_url($this->view->calendarUrl); $appointmindUrlDomain = $urlParts['scheme'] . '://' . $urlParts['host']; $appointmindUrlPath = $urlParts['path']; $appointmindUrlParameters = ''; if (!empty($urlParts['query'])) { $appointmindUrlParameters = '?' . $urlParts['query']; } $calendarContent = ''; $view = $this->view; ob_start(); include dirname(__FILE__) . '/templates/article_calendar.php'; $calendarContent = ob_get_contents(); ob_end_clean(); $content = str_replace('{' . $this->settings->placeHolder . '}', $calendarContent, $content); return $content; } /** * Display calendar in article */ public function displayArticleCalendarShortCode($params) { $settings = $this->settings->readSettings(); $this->view = (object) array_merge((array) $this->view, $settings); if (empty($this->view->calendarUrl) or $this->view->calendarUrl == 'http://') { return ''; } $urlParts = parse_url($this->view->calendarUrl); $appointmindUrlDomain = $urlParts['scheme'] . '://' . $urlParts['host']; $appointmindUrlPath = $urlParts['path']; $appointmindUrlParameters = ''; if (!empty($urlParts['query'])) { $appointmindUrlParameters = '?' . $urlParts['query']; } $attributes = shortcode_atts(array( 'id' => null, ), $params ); if (!empty($attributes['id'])) { if (empty($appointmindUrlParameters)) { $appointmindUrlParameters = '?cap=' . $attributes['id']; } else { $appointmindUrlParameters .= '&cap=' . $attributes['id']; } } $calendarContent = ''; $view = $this->view; ob_start(); include dirname(__FILE__) . '/templates/article_calendar.php'; $calendarContent = ob_get_contents(); ob_end_clean(); return $calendarContent; } /** * Display order forms in article */ public function displayArticlePatientOrderFormShortCode($params) { $formType = ''; $settings = $this->settings->readSettings(); $this->view = (object) array_merge((array) $this->view, $settings); if (empty($this->view->calendarUrl) or $this->view->calendarUrl == 'http://') { return ''; } $urlParts = parse_url($this->view->calendarUrl); $appointmindUrlDomain = $urlParts['scheme'] . '://' . $urlParts['host']; $appointmindUrlPath = $urlParts['path']; $appointmindUrlParameters = ''; if (!empty($urlParts['query'])) { $appointmindUrlParameters = '?' . $urlParts['query']; } $attributes = shortcode_atts(array( 'form' => null, ), $params ); if (empty($attributes['form'])) { return ''; } $formType = trim($attributes['form']); $calendarContent = ''; $view = $this->view; ob_start(); include dirname(__FILE__) . '/templates/article_order_form.php'; $calendarContent = ob_get_contents(); ob_end_clean(); return $calendarContent; } /** * Register sidebar widget */ public function registerSidebarWidget() { register_widget('AppointmindWidget'); } /** * Translate */ public function __($string) { return __($string, $this->settings->settingOptionName); } } new Appointmind;