Server IP : 66.29.132.124 / Your IP : 3.143.7.53 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/tacafoundation.org/wp-content/plugins/charite-core/inc/ |
Upload File : |
<?php class Charite_Utility { public function __construct() { $this->register_image_size(); //widget init add_action('init', array($this, 'comments_support')); add_action('init', array($this, 'give_setup_taxonomies'), 1); add_action('widgets_init', array($this, 'widgets_init')); add_action('init', array($this, 'elementor_cpt_support')); add_filter('single_template', [$this, 'portfolio_details_Page']); add_filter('single_template', [$this, 'volunteer_details_Page']); add_filter('single_template', [$this, 'project_details_page']); add_filter('single_template', [$this, 'event_details_page']); add_filter('single_template', [$this, 'service_details_page']); } public function register_image_size() { add_image_size('charite_portfolio_524X462', 524, 462, true); // in use add_image_size('charite_portfolio_794X320', 794, 320, true); // in use add_image_size('charite_donate_form_274X249', 274, 249, true); // in use add_image_size('charite_donate_form_111X122', 111, 122, true); // in use add_image_size('charite_donate_form_266X242', 266, 242, true); // in use add_image_size('charite_donate_form_416X347', 416, 347, true); // in use add_image_size('charite_donate_form_416X328', 416, 328, true); // in use add_image_size('charite_donate_form_416X328', 412, 344, true); // in use add_image_size('charite_event_119X109', 119, 109, true); // in use add_image_size('charite_event_388X250', 388, 250, true); // in use add_image_size('charite_event_373X240', 373, 240, true); // in use add_image_size('charite_service_750X390', 750, 390, true); // in use add_image_size('charite_blog_80X80', 80, 80, true); // in use add_image_size('charite_blog_97X99', 97, 97, true); // in use add_image_size('charite_blog__416X267', 416, 267, true); // in use add_image_size('charite_blog__360X308', 360, 308, true); // in use add_image_size('charite_blog__360X254', 360, 254, true); // in use add_image_size('charite_blog__67X67', 67, 67, true); // in use add_image_size('charite_volunteer__376X388', 376, 388, true); // in use add_image_size('charite_volunteer__306X353', 306, 353, true); // in use add_image_size('charite_portfolio__269X286', 269, 286, true); // in use add_image_size('charite_portfolio__86X86', 86, 86, true); // in use add_image_size('charite_project__357X472', 357, 472, true); // in use add_image_size('charite_project__362X410', 362, 410, true); // in use add_image_size('charite_project__360X554', 360, 554, true); // in use add_image_size('charite_project__362X262', 362, 262, true); // in use add_image_size('charite_project_details__756X305', 756, 305, true); } /** * widgets_init * @since 1.0.0 * */ public function widgets_init() { register_sidebar(array( 'name' => esc_html__('Event Sidebar', 'charite'), 'id' => 'event', 'description' => esc_html__('Add Event Sidebar widgets here.', 'charite'), 'before_widget' => '<div id="%1$s" class="widget %2$s widget-border">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', )); } /** *cpt in elementor * @since 1.0.0 * */ public function elementor_cpt_support() { //if exists, assign to $cpt_support var $cpt_support = get_option('elementor_cpt_support'); //check if option DOESN'T exist in db if (!$cpt_support) { $cpt_support = ['page', 'post', 'footer-builder', 'header-builder', 'give_forms']; //create array of our default supported post types update_option('elementor_cpt_support', $cpt_support); //write it to the database } //if it DOES exist, but footer is NOT defined else if (!in_array('footer-builder', $cpt_support)) { $cpt_support[] = 'footer-builder'; //append to array update_option('elementor_cpt_support', $cpt_support); //update database } //if it DOES exist, but header is NOT defined else if (!in_array('header-builder', $cpt_support)) { $cpt_support[] = 'header-builder'; //append to array update_option('elementor_cpt_support', $cpt_support); //update database } //if it DOES exist, but header is NOT defined else if (!in_array('give_forms', $cpt_support)) { $cpt_support[] = 'give_forms'; //append to array update_option('elementor_cpt_support', $cpt_support); //update database } } public function portfolio_details_Page($template) { global $post; if ('portfolio' === $post->post_type && locate_template(array('single-portfolio.php')) !== $template) { /* * This is a 'portfolio' post * AND a 'single portfolio template' is not found on * theme or child theme directories, so load it * from our plugin directory. */ return CHARITE_CORE_ROOT_PATH . '/post-templates/single-portfolio.php'; } return $template; } public function volunteer_details_Page($template) { global $post; if ('volunteer' === $post->post_type && locate_template(array('single-volunteer.php')) !== $template) { /* * This is a 'volunteer' post * AND a 'single volunteer template' is not found on * theme or child theme directories, so load it * from our plugin directory. */ return CHARITE_CORE_ROOT_PATH . '/post-templates/single-volunteer.php'; } return $template; } public function project_details_page($template) { global $post; if ('project' === $post->post_type && locate_template(array('single-project.php')) !== $template) { /* * This is a 'project' post * AND a 'single project template' is not found on * theme or child theme directories, so load it * from our plugin directory. */ return CHARITE_CORE_ROOT_PATH . '/post-templates/single-project.php'; } return $template; } public function event_details_page($template) { global $post; if ('event' === $post->post_type && locate_template(array('single-event.php')) !== $template) { /* * This is a 'event' post * AND a 'single event template' is not found on * theme or child theme directories, so load it * from our plugin directory. */ return CHARITE_CORE_ROOT_PATH . '/post-templates/single-event.php'; } return $template; } public function service_details_page($template) { global $post; if ('service' === $post->post_type && locate_template(array('single-service.php')) !== $template) { /* * This is a 'service' post * AND a 'single service template' is not found on * theme or child theme directories, so load it * from our plugin directory. */ return CHARITE_CORE_ROOT_PATH . '/post-templates/single-service.php'; } return $template; } public function comments_support() { if (class_exists('Give')) { add_post_type_support('give_forms', 'comments'); } } function give_setup_taxonomies() { if (class_exists('Give')) { if (give_get_option('categories', '')) { give_update_option('categories', 'enabled'); } if (give_get_option('tags', '')) { give_update_option('tags', 'enabled'); } } } } new Charite_Utility();