run(); /** * Run Forms Plugin */ require_once AWP_PLUGINS_DIR . '/jobs.php'; $awp_jobsforms = & AWP_Jobs::instance(); $awp_jobsforms->run(); /** * Run Newsletter Plugin */ require_once AWP_PLUGINS_DIR . '/Newsletter.php'; $awp_testimonials = & AWP_Newsletter::instance(); $awp_testimonials->run(); /** * Run Testimonials Plugin */ require_once AWP_PLUGINS_DIR . '/Testimonials.php'; $awp_testimonials = & AWP_Testimonials::instance(); $awp_testimonials->run(); /** * Run News Plugin */ require_once AWP_PLUGINS_DIR . '/News.php'; $awp_testimonials = & AWP_News::instance(); $awp_testimonials->run(); /** * Run Events Plugin */ require_once AWP_PLUGINS_DIR . '/Events.php'; $awp_testimonials = & AWP_Events::instance(); $awp_testimonials->run(); } /** * Returns plugin instance * * @return AWP_Controller */ function &instance() { static $instances = array(); if (!isset($instances[0])) { $class = __CLASS__; $instances[0] = & new $class(); } return $instances[0]; } /** * Init action */ function init() { } /** * Load action */ function load() { require_once AWP_LIB_DIR . '/Request.php'; $this->_page = AWP_Request::get_string('page'); switch (true) { case ($this->_page == 'awp_general'): case ($this->_page == 'awp_contactforms'): case ($this->_page == 'awp_newsletter'): case ($this->_page == 'awp_testimonials'): case ($this->_page == 'awp_news'): case ($this->_page == 'awp_events'): case ($this->_page == 'awp_jobs'): break; default: $this->_page = 'awp_general'; } /** * Save config */ if (isset($_REQUEST['awp_generalform_commonplugin_settings'])) { $this->save_generalsettings(); } } /** * Save General Settings form * */ function save_generalsettings(){ $settings=array(); $settings["contactforms"]=AWP_Request::get_boolean("contactforms_enable"); $settings["newsletters"]=AWP_Request::get_boolean("newsletters_enable"); $settings["testimonials"]=AWP_Request::get_boolean("testimonials_enable"); $settings["news"]=AWP_Request::get_boolean("news_enable"); $settings["events"]=AWP_Request::get_boolean("events_enable"); $settings["jobs"]=AWP_Request::get_boolean("jobs_enable"); if(get_option("awp_plugins")!=="false"){ update_option("awp_plugins", $settings); }else{ add_option("awp_plugins", $settings); } } /** * Admin menu */ function admin_menu() { /*$pages = array( 'awp_general' => array('General Settings', 'General Settings' ), 'awp_contactforms' => array('Contact Forms','Contact Forms'), 'awp_newsletter' => array('Newsletter', 'Newsletter' ), 'awp_events' => array('Events','Events'), 'awp_news' => array('News','News'), 'awp_testimonials' => array('Testimonials', 'Testimonials'), 'awp_jobs' => array('Jobs', 'Jobs') );*/ $pages = array('awp_general' => array('General Settings', 'General Settings' )); $awp_pluginsettings = get_option('awp_plugins'); if(!defined('AWP_CONTACTFORM_DISABLE') || !AWP_CONTACTFORM_DISABLE) { $contact_pages = array('awp_contactforms' => array('Contact Forms','Contact Forms')); $pages = array_merge($pages, $contact_pages); } if(!defined('AWP_NEWSLETTER_DISABLE') || !AWP_NEWSLETTER_DISABLE) { $newsletter_pages = array('awp_newsletter' => array('Newsletter', 'Newsletter' )); $pages = array_merge($pages, $newsletter_pages); } if(!defined('AWP_TESTIMONIALS_DISABLE') || !AWP_TESTIMONIALS_DISABLE) { $testimonials_pages = array('awp_testimonials' => array('Testimonials', 'Testimonials')); $pages = array_merge($pages, $testimonials_pages); } if(!defined('AWP_NEWS_DISABLE') || !AWP_NEWS_DISABLE) { $news_pages = array('awp_news' => array('News','News')); $pages = array_merge($pages, $news_pages); } if(!defined('AWP_EVENTS_DISABLE') || !AWP_EVENTS_DISABLE) { $events_pages = array('awp_events' => array('Events','Events')); $pages = array_merge($pages, $events_pages); } if(!defined('AWP_JOBS_DISABLE') || !AWP_JOBS_DISABLE) { $jobs_pages = array('awp_jobs' => array('Jobs', 'Jobs' )); $pages = array_merge($pages, $jobs_pages); } add_menu_page('Apptivo', 'Apptivo', 'manage_options', 'awp_general', '',"http://d3piu9okvoz5ps.cloudfront.net/awp-content_1/12377wp10031/uploads/2011/07/apptivo-1.png"); $submenu_pages = array(); foreach ($pages as $slug => $titles) { $submenu_pages[] = add_submenu_page('awp_general', $titles[0] . ' | Apptivo', $titles[1], 'manage_options', $slug, array( &$this, 'options' )); } if (current_user_can('manage_options')) { /** * Only admin can modify AIP settings */ foreach ($submenu_pages as $submenu_page) { add_action('load-' . $submenu_page, array(&$this,'load')); } } } /** * Options page */ function options() { /** * Show tab */ switch ($this->_page) { case 'awp_general': $this->options_general(); break; case 'awp_contactforms': $this->options_contactforms(); break; case 'awp_newsletter': $this->options_newsletter(); break; case 'awp_testimonials': $this->options_testimonials(); break; case 'awp_news': $this->options_news(); break; case 'awp_events': $this->options_events(); break; case 'awp_jobs': $this->options_jobs(); break; } } /** * General tab */ function options_general(){ $this->show_general_settings(); } /** * Contact Forms tab */ function options_contactforms(){ require_once AWP_PLUGINS_DIR . '/ContactForms.php'; $awp_contactforms = & AWP_ContactForms::instance(); $awp_contactforms->options(); } /** * Jobs Form tab */ function options_jobs(){ require_once AWP_PLUGINS_DIR . '/jobs.php'; $awp_jobsforms = & AWP_Jobs::instance(); $page = $_GET['keys']; switch ($page){ case jobcreation: $awp_jobsforms->createJobsoptions(); break; case configuration: $awp_jobsforms->jobconfiguration(); break; case jobsearch: $awp_jobsforms->jobsearch(); break; default : $awp_jobsforms->createJobsoptions(); } } /** * Testimonials tab */ function options_testimonials(){ require_once AWP_PLUGINS_DIR . '/Testimonials.php'; $awp_testimonials = & AWP_Testimonials::instance(); $awp_testimonials->options(); } /** * Newsletter tab */ function options_newsletter(){ require_once AWP_PLUGINS_DIR . '/Newsletter.php'; $awp_testimonials = & AWP_Newsletter::instance(); $awp_testimonials->options(); } /** * News tab */ function options_news(){ require_once AWP_PLUGINS_DIR . '/News.php'; $awp_testimonials = & AWP_News::instance(); $awp_testimonials->options(); } /** * Events tab */ function options_events(){ require_once AWP_PLUGINS_DIR . '/Events.php'; $awp_testimonials = & AWP_Events::instance(); $awp_testimonials->options(); } /** * Mem cache Settings. * * @param unknown_type $memcachesettings * @param unknown_type $test_m_cacheconnect */ function memCacheSettings($memcachesettings,$test_m_cacheconnect) { echo "

" . __( 'Memcache Settings', 'apptivo-businesssite' ) . "

"; ?>
/>
type="text" size="30" value="" name="hostname_portno" id="hostname_portno"> type="submit" name="awp_memcache_test" id="awp_memcache_test" class="button-primary" value="Test"> Test passed.'; }else if($_POST['awp_memcache_test']) { echo 'Test Failed.'; } ?>
e.g. domain.com:22122 (or) 192.168.1.100:11211
 
" . __( 'Site Information', 'apptivo-businesssite' ) . ""; if(isset($_POST['awp_siteinfo_form'])) { if(strlen(trim($_POST['site_key'])) != 0 ) { echo '

Updated Site Information Settings.

'; }else{ echo '

Site key cannot be empty.

'; } } ?>

Site key generated in Apptivo

Access key generated in Apptivo

" . __( 'Plugins Settings', 'apptivo-businesssite' ) . ""; if(isset($_POST['awp_generalform_commonplugin_settings'])) { echo '

Updated Plugins Settings.

'; } $apptivo_site_key = get_option('apptivo_sitekey'); if (defined("APPTIVO_SITE_KEY") ){ $disable_plugin=false; } else if (!empty($apptivo_site_key) || strlen(trim($apptivo_site_key)) > 0 ) { $disable_plugin=false; } else { $disable_plugin=true; } /* if($disable_plugin) { echo 'Save Site Key to update settings.'; } */ ?>

Contact Forms to collect lead from your website.
disabled="disabled" checked="checked" > Enable
Subscribe your users to newsletters using Apptivo Campaigns.
disabled="disabled" checked="checked" > Enable

Collect and show in your website, what your clients tell about you.
disabled="disabled" checked="checked" > Enable
Show what's News about your company in your websites.
disabled="disabled" checked="checked" > Enable

Show various events organized by you in your website.
disabled="disabled" checked="checked" > Enable
Jobs
disabled="disabled" checked="checked" > Enable

type="submit" name="awp_generalform_commonplugin_settings" id="awp_generalform_commonplugin_settings" class="button-primary" value="" />

PHP Memcache is not detected in this system. Install PHP Memcache and configure for better performance.'; //trigger_error("PHP Class 'Memcache' does not exist!", E_USER_ERROR); } $memcachesettings = array(); $memcachesettings['memcache_enable']= AWP_Request::get_boolean("memcache_enable"); $memcachesettings['hostname_portno']= AWP_Request::get_string("hostname_portno"); if(isset($_POST['awp_memcache_settings'])){ if(get_option("awp_memcache_settings")!=="false"){ update_option('awp_memcache_settings',$memcachesettings); } else{ add_option('awp_memcache_settings', $memcachesettings); } if(!$memcachesettings['memcache_enable']) { update_option('awp_memcache_settings',''); } echo '

Memcache configuration successfully saved.

'; } } function test_mcacheconnect() { if($_POST['awp_memcache_test']) { if(class_exists('Memcache')) { $awp_datacache = new AWP_Cache_Util(); //Create Object in AWP_DataCache clss] $memcachesettings = array(); $memcachesettings['memcache_enable']= AWP_Request::get_boolean("memcache_enable"); $memcachesettings['hostname_portno']= AWP_Request::get_string("hostname_portno"); $test_connect = $awp_datacache->connectmcache( $memcachesettings['hostname_portno']); return $test_connect; }else{ //echo 'PHP Memcache is not detected in this system. Install PHP Memcache and configure to Test Memcache connection.'; return false; //trigger_error("PHP Class 'Memcache' does not exist!", E_USER_ERROR); } } } /** * Render Apptivo General Settings page */ function show_general_settings(){ /* Stored Site Information */ if(isset($_POST['awp_siteinfo_form'])){ $apptivo_site_key= AWP_Request::get_string("site_key"); $apptivo_access_key= AWP_Request::get_string("access_key"); $apptivo_update_site_inf= AWP_Request::get_string("update_site_inf"); // To check options or delete or not. if ((!empty($apptivo_site_key) || strlen(trim($apptivo_site_key)) > 0) && (strtolower($apptivo_update_site_inf) != 'no')) { //apptivo site key. if(get_option("apptivo_sitekey")!=="false"){ //options are deleted if changinging the sitekey. So check apptivo-update_site_inf is 'yes' or 'no',in default apptivo-update_site_inf is 'yes' update_option('apptivo_sitekey',$apptivo_site_key); delete_option('awp_contactforms'); //Contactform configuration delete_option('awp_events_settings'); //Events Full view configuration. delete_option('awp_events_inline_settings'); //Events InlineView configurayion. delete_option('awp_jobsforms'); //job forms configuraion. delete_option('awp_jobs_settings'); //Job settings page confiduration. delete_option('awp_jobsearchforms'); //Job search form configuration. delete_option('awp_news_inline_settings'); //News Inline View configuration. delete_option('awp_news_settings'); //News Full View Configuration. delete_option('awp_newsletterforms'); //Newsletter Form Configuration. delete_option('awp_testimonials_inline_settings');//Testimonials Inline view Configuration. delete_option('awp_testimonials_settings'); //Testimonials Full View Configuration. } else{ add_option('apptivo_sitekey', $apptivo_site_key); } } //apptivo access Key if(get_option('apptivo_accesskey')!=="false") : update_option('apptivo_accesskey',$apptivo_access_key); else: add_option('apptivo_accesskey', $apptivo_access_key); endif; } $apptivo_site_key = get_option('apptivo_sitekey'); $apptivo_access_key = get_option('apptivo_accesskey'); // Now display the settings editing screen echo '
'; echo "

" . __( 'Apptivo General Settings', 'apptivo-businesssite' ) . "

"; if(trim($updatemessage)!=""){ ?>

siteInformation($apptivo_site_key,$apptivo_access_key); else if (!empty($apptivo_site_key)){ $this->siteInformation($apptivo_site_key,$apptivo_access_key); } $general_plugins_settings=get_option("awp_plugins"); if($general_plugins_settings == '' || empty($general_plugins_settings)) : if( basename(dirname(AWP_LIB_DIR)) == 'apptivo-businesssite-crm') : $general_plugins_settings = array( 'contactforms' => 1, 'newsletters' => 1, 'testimonials' => 1, 'news'=>1, 'events'=> 1 ); if(get_option("apptivo_sitekey") != '') : update_option("awp_plugins", $general_plugins_settings); endif; endif; if( basename(dirname(AWP_LIB_DIR)) == 'apptivo-businesssite-hrms') : $general_plugins_settings = array( 'newsletters' => 1, 'jobs'=> 1 ); if(get_option("apptivo_sitekey") != '') : update_option("awp_plugins", $general_plugins_settings); endif; endif; endif; $this->pluginsSettings($general_plugins_settings); if(!defined("AWP_MEMCACHED_HOST") && !defined("AWP_MEMCACHED_PORT") ) { $this->configure_memcache(); $memcachesettings = get_option('awp_memcache_settings'); $test_m_cacheconnect = $this->test_mcacheconnect(); $this->memCacheSettings($memcachesettings,$test_m_cacheconnect); } ?> "; } }