run(); /** * Run Cases Forms Plugin */ require_once AWP_PLUGINS_DIR . '/cases.php'; $awp_cases = & AWP_Cases::instance(); $awp_cases->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_ip_deny'): 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'): case ($this->_page == 'awp_cases'): 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"); $settings["cases"]=AWP_Request::get_boolean("cases_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_pluginsettings = get_option('awp_plugins'); $ip_deny = array('awp_ip_deny' => array('IP Deny','IP Deny')); $pages = array_merge($pages, $ip_deny); if(!defined('AWP_CASES_DISABLE') || !AWP_CASES_DISABLE) { $cases = array('awp_cases' => array('Cases','Cases')); $pages = array_merge($pages, $cases); } 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); } $apptivo_iconurl = awp_image('apptivo_icon'); add_menu_page('Apptivo', 'Apptivo', 'manage_options', 'awp_general', '',$apptivo_iconurl); $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_ip_deny': $this->options_ipdeny(); 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; case 'awp_cases': $this->options_cases(); break; } } /** * General tab */ function options_general(){ $this->show_general_settings(); } /** * Denyed IP tab */ function options_ipdeny(){ require_once AWP_PLUGINS_DIR . '/ipdeny.php'; $awp_ipdeny = & AWP_IPDeny::instance(); $awp_ipdeny->settings(); } /** * Contact Forms tab */ function options_contactforms(){ require_once AWP_PLUGINS_DIR . '/ContactForms.php'; $awp_contactforms = & AWP_ContactForms::instance(); $awp_contactforms->options(); } /** * Cases tab */ function options_cases(){ require_once AWP_PLUGINS_DIR . '/cases.php'; $awp_cases= & AWP_Cases::instance(); $awp_cases->settings(); } /** * Jobs Form tab */ function options_jobs(){ require_once AWP_PLUGINS_DIR . '/jobs.php'; $awp_jobsforms = & AWP_Jobs::instance(); $job_keys = $_GET['keys']; switch ($job_keys){ 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['api_key'])) != 0 ) { echo '

Updated Site Information Settings.

'; }else{ echo '

Site key cannot be empty.

'; } } ?>

API key generated in Apptivo
name="api_key" id="api_key" class="enabled" value=""/>

Access key generated in Apptivo
name="access_key" id="access_key" class="enabled" value=""/>


Apptivo.com is the best free way to run your business. Apptivo.com powers ecommerce websites, provides free CMS, free CRM, free ERP, free Project Management and free Invoicing to small businesses.
type="radio" name="powered_status" id="donot_show" value="dont_show"/> type="radio" name="powered_status" id="show_home" value="show_homepage"/> type="radio" name="powered_status" id="show_all" value="show_allpages"/>

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

Updated Plugins Settings.

'; } $apptivo_api_key = get_option('apptivo_apikey'); if (defined("APPTIVO_BUSINESS_API_KEY") ){ $disable_plugin=false; } else if (!empty($apptivo_api_key) || strlen(trim($apptivo_api_key)) > 0 ) { $disable_plugin=false; } else { $disable_plugin=true; } ?>
disabled="disabled" checked="checked" > Contact Forms to collect lead from your website.
disabled="disabled" checked="checked" > Customers to log a case from your website and you can manage it using Apptivo Cases App
disabled="disabled" checked="checked" > Subscribe your users to newsletters using Apptivo Campaigns.
disabled="disabled" checked="checked" > Collect and show in your website, what your clients tell about you.
disabled="disabled" checked="checked" > Customers to upload a resume from your website and you can manage it using Apptivo Jobs App

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{ return false; } } } function general_tabssettings() { /* Stored Site Information */ if(isset($_POST['awp_siteinfo_form'])){ $apptivo_poweredby_status = AWP_Request::get_string('powered_status'); update_option('apptivo_poweredby_status',$apptivo_poweredby_status); $apptivo_api_key= AWP_Request::get_string("api_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_api_key) || strlen(trim($apptivo_api_key)) > 0) && (strtolower($apptivo_update_site_inf) != 'no')) { if(get_option("apptivo_apikey")!=="false"){ update_option('apptivo_apikey',$apptivo_api_key); update_option('apptivo_ecommerce_apikey',$apptivo_api_key); }else { add_option('apptivo_apikey', $apptivo_api_key); add_option('apptivo_ecommerce_apikey', $apptivo_api_key); } } //apptivo access Key if(get_option('apptivo_accesskey')!=="false") : update_option('apptivo_accesskey',$apptivo_access_key); update_option('apptivo_ecommerce_accesskey',$apptivo_access_key); else: add_option('apptivo_accesskey', $apptivo_access_key); add_option('apptivo_ecommerce_accesskey', $apptivo_access_key); endif; } $apptivo_api_key = get_option('apptivo_apikey'); $apptivo_access_key = get_option('apptivo_accesskey'); if(trim($updatemessage)!=""){ ?>

siteInformation($apptivo_api_key,$apptivo_access_key); } function plugin_tabsettings() { $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_apikey") != '') : update_option("awp_plugins", $general_plugins_settings); endif; endif; endif; $this->pluginsSettings($general_plugins_settings); } function captcha_tabsettings() { if(isset($_REQUEST['captcha_option'])) { $apptivo_recapthca['recaptcha_mode'] = $_POST['apptivo_business_recaptcha_mode']; $apptivo_recapthca['recaptcha_publickey']= $_POST['apptivo_business_recaptcha_publickey']; $apptivo_recapthca['recaptcha_publickey'] = preg_replace('/\s+/', '', $apptivo_recapthca['recaptcha_publickey']); $apptivo_recapthca['recaptcha_privatekey']= $_POST['apptivo_business_recaptcha_privatekey']; $apptivo_recapthca['recaptcha_privatekey'] = preg_replace('/\s+/', '', $apptivo_recapthca['recaptcha_privatekey']); $apptivo_recapthca['recaptcha_theme'] = $_POST['apptivo_business_recaptcha_theme']; $apptivo_recapthca['recaptcha_language']=$_POST['apptivo_business_recaptcha_language']; $apptivo_recapthca['awp_captcha_type']=$_POST['awp_captcha_type']; $apptivo_recapthca['awp_fg_color']=$_POST['awp_fg_color']; $apptivo_recapthca['awp_bg_color']=$_POST['awp_bg_color']; if ($apptivo_recapthca['awp_captcha_type'] == 'simplecaptcha') { $captcha_success_msg = 'Simple Captcha'; } else if($apptivo_recapthca['awp_captcha_type'] == 'recaptcha') { $captcha_success_msg = 'reCaptcha'; } echo '

'.$captcha_success_msg.' configuration successfully saved.

'; $apptivo_recapthca=json_encode($apptivo_recapthca); if(get_option ('apptivo_business_recaptcha_settings')=="") { add_option( 'apptivo_business_recaptcha_settings', "$apptivo_recapthca"); } else { update_option( 'apptivo_business_recaptcha_settings', "$apptivo_recapthca"); } if(get_option('apptivo_business_recaptcha_mode')=="") { add_option('apptivo_business_recaptcha_mode',"$_POST[apptivo_business_recaptcha_mode]"); } else { update_option('apptivo_business_recaptcha_mode',"$_POST[apptivo_business_recaptcha_mode]"); } } $option=get_option('apptivo_business_recaptcha_settings') ; $option=json_decode($option); if($option->awp_captcha_type=="recaptcha"){ $display="block"; $display_color="none"; }elseif ($option->awp_captcha_type=="simplecaptcha"){ $display="none";$display_color="block"; }else{ $display="block"; $display_color="none"; } ?>

Captcha in Forms

Select reCaptcha/Simple Captcha
Captcha Foreground Color awp_fg_color !="") { echo $option->awp_fg_color; } else { echo '#FFFFFF'; } ?>>
Captcha Background Color awp_bg_color !="") { echo $option->awp_bg_color; } else { echo '#000000'; }?>>
recaptcha_publickey; $absp_privatekey= $option->recaptcha_privatekey; $disable = ""; } ?>
Enable reCaptcha Create a reCAPTCHA key
reCaptcha - Public Key style="width:500px;" id="apptivo_business_recaptcha_publickey" name="apptivo_business_recaptcha_publickey">
reCaptcha - Private Key style="width:500px;" id="apptivo_business_recaptcha_privatekey" name="apptivo_business_recaptcha_privatekey">
reCaptcha - Theme
reCaptcha - Language


configure_memcache(); $memcachesettings = get_option('awp_memcache_settings'); $test_m_cacheconnect = $this->test_mcacheconnect(); $this->memCacheSettings($memcachesettings,$test_m_cacheconnect); } } /* * Configuration for Proxy settings */ function proxy_tabsettings() { $proxysettings = array(); if(isset($_POST['awp_proxy_settings'])){ $proxysettings['proxy_enable']= AWP_Request::get_boolean("proxy_enable"); $proxysettings['proxy_hostname_portno']= AWP_Request::get_string("proxy_hostname_portno"); $proxysettings['proxy_loginuser_pwd']= AWP_Request::get_string("proxy_loginuser_pwd"); if(get_option("awp_proxy_settings")!=="false"){ update_option('awp_proxy_settings',$proxysettings); } else{ add_option('awp_proxy_settings', $proxysettings); } if(!$proxysettings['proxy_enable']) { update_option('awp_proxy_settings',''); } echo '

Proxy configuration successfully saved.

'; } $proxysettings = get_option('awp_proxy_settings'); echo "

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

"; ?>

Enable if you need proxy settings to reach Apptivo from your server
type="checkbox" name="proxy_enable" id="proxy_enable" onclick="proxy_enablefield('proxy_enable')" class="enabled" />
type="text" size="30" value="" name="proxy_hostname_portno" id="proxy_hostname_portno">
e.g. domain.com:22122 (or) 192.168.1.100:11211
type="text" size="30" value="" name="proxy_loginuser_pwd" id="proxy_loginuser_pwd">
e.g. username:password
 
'; echo "

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

"; ?> general_tabssettings(); /* Plugin Settings */ $this->plugin_tabsettings(); /* Capthcha Settings */ $this->captcha_tabsettings(); if(_isCurl()) { /* Proxy Settings */ $this->proxy_tabsettings(); } /* Memcache Settings. */ $this->memcache_tabsettings(); ?> "; } } add_action('admin_enqueue_scripts', 'awp_load_scripts'); function awp_load_scripts($hook_suffix) { if($hook_suffix == 'toplevel_page_awp_general'){ wp_register_script('colorpicker-js',plugins_url('apptivo-business-site/assets/js/jscolor/jscolor.js')); wp_enqueue_script('colorpicker-js'); } }