Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
firepot
/
next_old
/
wp-content
/
plugins
/
cyarb-toolkit
:
cyarb-toolkit.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /* * Plugin Name: Cyarb Toolkit * Author: Envytheme * Author URI: http://envytheme.com * Description: A Light weight and easy toolkit for Elementor page builder widgets. * Version: 2.0 */ if (!defined('ABSPATH')) { exit; //Exit if accessed directly } define('CYARB_ACC_PATH', plugin_dir_path(__FILE__)); if( !defined('CYARB_FRAMEWORK_VAR') ) define('CYARB_FRAMEWORK_VAR', 'cyarb_opt'); // Disable Elementor's Default Colors and Default Fonts update_option( 'elementor_disable_color_schemes', 'yes' ); update_option( 'elementor_disable_typography_schemes', 'yes' ); $theme = wp_get_theme(); // gets the current theme if ( 'Cyarb' == $theme->name || 'Cyarb' == $theme->parent_theme ) { /** * Classes */ require_once(CYARB_ACC_PATH . 'inc/classes/Cyarb_base.php'); require_once(CYARB_ACC_PATH . 'inc/classes/Cyarb_rt.php'); require_once(CYARB_ACC_PATH . 'inc/classes/Cyarb_admin_page.php'); require_once(CYARB_ACC_PATH . 'inc/admin/dashboard/Cyarb_admin_dashboard.php'); require_once(CYARB_ACC_PATH . 'inc/functions.php'); $pcs = trim( get_option( 'cyarb_purchase_code_status' ) ); if ( $pcs == 'valid' ) { require_once(CYARB_ACC_PATH . 'inc/demo-importer.php'); require_once CYARB_ACC_PATH . 'inc/demo-importer-ocdi.php'; } /** * Redirect after theme activation */ add_action( 'after_switch_theme', function() { if ( isset( $_GET['activated'] ) ) { wp_safe_redirect( admin_url('admin.php?page=cyarb') ); update_option( 'cyarb_purchase_code_status', '', 'yes' ); update_option( 'cyarb_purchase_code', '', 'yes' ); exit; } update_option('notice_dismissed', '0'); }); } // Select page for link function cyarb_toolkit_get_page_as_list() { $args = wp_parse_args(array( 'post_type' => 'page', 'numberposts' => -1, )); $posts = get_posts($args); $post_options = array(esc_html__('--Select Page--', 'cyarb-toolkit') => ''); if ($posts) { foreach ($posts as $post) { $post_options[$post->post_title] = $post->ID; } } $flipped = array_flip($post_options); return $flipped; } // Main Elementor Cyarb Extension Class final class Elementor_cyarb_Extension { const VERSION = '1.0.0'; const MINIMUM_ELEMENTOR_VERSION = '2.0.0'; const MINIMUM_PHP_VERSION = '7.0'; // Instance private static $_instance = null; public static function instance() { if ( is_null( self::$_instance ) ) { self::$_instance = new self(); } return self::$_instance; } // Constructor public function __construct() { add_action( 'plugins_loaded', [ $this, 'init' ] ); } // init public function init() { load_plugin_textdomain( 'cyarb-toolkit' ); // Check if Elementor installed and activated if ( ! did_action( 'elementor/loaded' ) ) { add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] ); return; } // Check for required Elementor version if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] ); return; } // Check for required PHP version if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] ); return; } // Add Plugin actions add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] ); add_action('elementor/elements/categories_registered',[ $this, 'register_new_category'] ); } public function register_new_category($manager){ $manager->add_category('cyarb-elements',[ 'title'=>esc_html__('Cyarb','cyarb-toolkit'), 'icon'=> 'fa fa-image' ]); } // Admin notice public function admin_notice_missing_main_plugin() { if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); $message = sprintf( /* translators: 1: Plugin name 2: Elementor */ esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'cyarb-toolkit' ), '<strong>' . esc_html__( 'Cyarb Toolkit', 'cyarb-toolkit' ) . '</strong>', '<strong>' . esc_html__( 'Elementor', 'cyarb-toolkit' ) . '</strong>' ); printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); } public function admin_notice_minimum_elementor_version() { if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); $message = sprintf( /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'cyarb-toolkit' ), '<strong>' . esc_html__( 'Cyarb Toolkit', 'cyarb-toolkit' ) . '</strong>', '<strong>' . esc_html__( 'Elementor', 'cyarb-toolkit' ) . '</strong>', self::MINIMUM_ELEMENTOR_VERSION ); printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); } public function admin_notice_minimum_php_version() { if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); $message = sprintf( /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'cyarb-toolkit' ), '<strong>' . esc_html__( 'Cyarb Toolkit', 'cyarb-toolkit' ) . '</strong>', '<strong>' . esc_html__( 'PHP', 'cyarb-toolkit' ) . '</strong>', self::MINIMUM_PHP_VERSION ); printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); } // Toolkit Widgets public function init_widgets() { // Include Widget files $pcs = trim( get_option( 'cyarb_purchase_code_status' ) ); if ( $pcs == 'valid' ) { require_once( __DIR__ . '/widgets/banner.php' ); require_once( __DIR__ . '/widgets/features.php' ); require_once( __DIR__ . '/widgets/about.php' ); require_once( __DIR__ . '/widgets/partner.php' ); require_once( __DIR__ . '/widgets/web-security.php' ); require_once( __DIR__ . '/widgets/case-area.php' ); require_once( __DIR__ . '/widgets/testimonial-area.php' ); require_once( __DIR__ . '/widgets/blog-posts.php' ); require_once( __DIR__ . '/widgets/cta-area.php' ); require_once( __DIR__ . '/widgets/funfacts.php' ); require_once( __DIR__ . '/widgets/team-slider.php' ); require_once( __DIR__ . '/widgets/pricing.php' ); require_once( __DIR__ . '/widgets/faq.php' ); require_once( __DIR__ . '/widgets/terms-policy.php' ); require_once( __DIR__ . '/widgets/contact-area.php' ); require_once( __DIR__ . '/widgets/security-area.php' ); require_once( __DIR__ . '/widgets/ser-details-area.php' ); require_once( __DIR__ . '/widgets/service-area.php' ); require_once( __DIR__ . '/widgets/case-details.php' ); require_once( __DIR__ . '/widgets/contact-form.php' ); require_once( __DIR__ . '/widgets/tab-expert-support.php' ); // V1.2 require_once( __DIR__ . '/widgets/banner-two.php' ); require_once( __DIR__ . '/widgets/banner-three.php' ); require_once( __DIR__ . '/widgets/banner-four.php' ); // V1.4 require_once( __DIR__ . '/widgets/banner-five.php' ); require_once( __DIR__ . '/widgets/services.php' ); require_once( __DIR__ . '/widgets/funfacts-two.php' ); require_once( __DIR__ . '/widgets/approach-tab.php' ); require_once( __DIR__ . '/widgets/keep-world.php' ); require_once( __DIR__ . '/widgets/testimonial-two.php' ); require_once( __DIR__ . '/widgets/team-two.php' ); require_once( __DIR__ . '/widgets/how-we-work.php' ); require_once( __DIR__ . '/widgets/pricing-two.php' ); require_once( __DIR__ . '/widgets/banner-six.php' ); require_once( __DIR__ . '/widgets/service-features.php' ); require_once( __DIR__ . '/widgets/banner-seven.php' ); require_once( __DIR__ . '/widgets/approach-tab-two.php' ); // V2.0 require_once( __DIR__ . '/widgets/button.php' ); require_once( __DIR__ . '/widgets/section.php' ); } } } Elementor_cyarb_Extension::instance(); // Redux Theme Options $pcs = trim( get_option( 'cyarb_purchase_code_status' ) ); if ( $pcs == 'valid' ) { require_once(CYARB_ACC_PATH . 'redux/ReduxCore/framework.php'); require_once(CYARB_ACC_PATH . 'redux/sample/sample-config.php'); require_once(CYARB_ACC_PATH . 'redux/ReduxCore/custom-fonts/custom-fonts.php' ); require_once(CYARB_ACC_PATH . 'inc/widgets.php'); require_once(CYARB_ACC_PATH . 'inc/cyarb-about.php'); require_once(CYARB_ACC_PATH . 'inc/cyarb-contact.php'); require_once(CYARB_ACC_PATH . 'inc/cyarb-newsletter.php'); } function cyarb_toolkit_js_code() { if ( !class_exists('Cyarb_RT') || !class_exists('Cyarb_base') || !class_exists('Cyarb_admin_page') ) { ?> <script> const body = document.getElementsByTagName('body'); body[0].style.opacity = "0"; </script> <?php } } add_action('wp_footer', 'cyarb_toolkit_js_code'); function cyarb_admin_css() { echo '<style>.#fw-ext-brizy,#fw-extensions-list-wrapper .toggle-not-compat-ext-btn-wrapper,.fw-brz-dismiss{display:none}.fw-brz-dismiss{display:none}.fw-extensions-list-item{display:none!important}#fw-ext-backups{display:block!important}#update-nag,.update-nag{display:block!important} .fw-sole-modal-content.fw-text-center .fw-text-danger.dashicons.dashicons-warning:before { content: "Almost finished! Please check with a reload." !important;}.fw-sole-modal-content.fw-text-center .fw-text-danger.dashicons.dashicons-warning {color: green !important; width:100%} .fw-modal.fw-modal-open > .media-modal-backdrop {width: 100% !important;}</style>'; } add_action('admin_head', 'cyarb_admin_css'); //Registering crazy toolkit files function cyarb_toolkit_files() { wp_enqueue_style('cyarb-toolkit', plugin_dir_url(__FILE__) . 'assets/css/cyarb-toolkit.css'); } add_action('wp_enqueue_scripts', 'cyarb_toolkit_files'); // Extra P tag from widget remove_filter('widget_text_content', 'wpautop'); add_filter('script_loader_tag', 'cyarb_clean_script_tag'); function cyarb_clean_script_tag($input) { $input = str_replace( array( 'type="text/javascript"', "type='text/javascript'" ), '', $input ); return $input; } //Custom Post function cyarb_toolkit_custom_post() { global $cyarb_opt; if( isset( $cyarb_opt['service_permalink'] ) ): $service_permalink = $cyarb_opt['service_permalink']; else: $service_permalink = 'service-post'; endif; // Caser Permalink if( isset( $cyarb_opt['case_permalink'] ) ): $case_permalink = $cyarb_opt['case_permalink']; else: $case_permalink = 'case-post'; endif; // Service Custom Post register_post_type('service', array( 'labels' => array( 'name' => esc_html__('Services', 'cyarb-toolkit'), 'singular_name' => esc_html__('Service', 'cyarb-toolkit'), ), 'menu_icon' => 'dashicons-editor-kitchensink', 'supports' => array('title', 'thumbnail', 'editor', 'custom-fields', 'excerpt'), 'public' => true, 'has_archive' => true, 'rewrite' => array( 'slug' => $service_permalink ), ) ); // Case Custom Post register_post_type('case', array( 'labels' => array( 'name' => esc_html__('Cases', 'cyarb-toolkit'), 'singular_name' => esc_html__('Case', 'cyarb-toolkit'), ), 'menu_icon' => 'dashicons-editor-kitchensink', 'supports' => array('title', 'thumbnail', 'editor', 'custom-fields', 'excerpt'), 'public' => true, 'has_archive' => true, 'rewrite' => array( 'slug' => $case_permalink ), ) ); } add_action('init', 'cyarb_toolkit_custom_post'); // Cyarb Taxonomy Custom Post function cyarb_toolkit_custom_post_taxonomy(){ // Service Cat register_taxonomy( 'service_cat', 'service', array( 'hierarchical' => true, 'label' => esc_html__('Service Category', 'cyarb-toolkit' ), 'query_var' => true, 'show_admin_column' => true, 'rewrite' => array( 'slug' => 'service-category', 'with_front' => true ) ) ); // Case Cat register_taxonomy( 'case_cat', 'case', array( 'hierarchical' => true, 'label' => esc_html__('Case Category', 'cyarb-toolkit' ), 'query_var' => true, 'show_admin_column' => true, 'rewrite' => array( 'slug' => 'case-category', 'with_front' => true ) ) ); // Case Tags register_taxonomy( 'case_tag', 'case', array( 'hierarchical' => true, 'label' => esc_html__('Case Tags', 'cyarb-toolkit' ), 'query_var' => true, 'show_admin_column' => true, 'rewrite' => array( 'slug' => 'case-tag', 'with_front' => true ) ) ); } add_action('init', 'cyarb_toolkit_custom_post_taxonomy'); // Service Category Select function cyarb_toolkit_get_product_cat_list() { $service_category_id = get_queried_object_id(); $args = array( 'parent' => $service_category_id ); $terms = get_terms( 'service_cat', get_the_ID()); $cat_options = array(esc_html__('', 'cyarb-toolkit') => ''); if ($terms) { foreach ($terms as $term) { $cat_options[$term->name] = $term->name; } } return $cat_options; } // Case Category Select function cyarb_toolkit_get_case_cat_list() { $case_category_id = get_queried_object_id(); $args = array( 'parent' => $case_category_id ); $terms = get_terms( 'case_cat', get_the_ID()); $cat_options = array(esc_html__('', 'cyarb-toolkit') => ''); if ($terms) { foreach ($terms as $term) { $cat_options[$term->name] = $term->name; } } return $cat_options; } // Post Category Select function cyarb_toolkit_get_post_cat_list() { $post_category_id = get_queried_object_id(); $args = array( 'parent' => $post_category_id ); $terms = get_terms( 'category', get_the_ID()); $cat_options = array(esc_html__('', 'cyarb-toolkit') => ''); if ($terms) { foreach ($terms as $term) { $cat_options[$term->name] = $term->name; } } return $cat_options; } function cyarb_toolkit_required_scripts() { global $cyarb_opt; if(isset($cyarb_opt['ga_code'])){ echo '<script>'.$cyarb_opt['ga_code'].'</script>'; } } add_action('wp_head', 'cyarb_toolkit_required_scripts'); // This is your option name where all the Redux data is stored. // Post View Count function cyarb_set_post_views($postID) { $count_key = 'cyarb_post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); /** * Remove pages from search result */ if ( ! function_exists( 'cyarb_remove_pages_from_search' ) ) : function cyarb_remove_pages_from_search() { global $cyarb_opt; global $wp_post_types; if( isset( $cyarb_opt['cyarb_search_page'] ) ){ if( $cyarb_opt['cyarb_search_page'] != true ){ $wp_post_types['page']->exclude_from_search = true; if ( post_type_exists( 'service' ) ) { $wp_post_types['service']->exclude_from_search = true; } if ( post_type_exists( 'case' ) ) { $wp_post_types['case']->exclude_from_search = true; } } else { $wp_post_types['page']->exclude_from_search = false; } } else { $wp_post_types['page']->exclude_from_search = false; if ( post_type_exists( 'service' ) ) { $wp_post_types['service']->exclude_from_search = true; } if ( post_type_exists( 'case' ) ) { $wp_post_types['case']->exclude_from_search = true; } } } endif; add_action('init', 'cyarb_remove_pages_from_search'); function cyarb_add_actual_link_to_footer(){ $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; if ( strpos($actual_link, 'themes.envytheme.com/cyarb') != false ): ?> <div class="et-demo-options-toolbar"> <?php global $wp; $current_url = home_url(add_query_arg(array(), $wp->request)); $home_url = home_url(); ?> <?php if( cyarb_rtl() == true ): ?> <a href="<?php echo esc_url( $current_url ); ?>" class="hint--bounce hint--left hint--black" id="toggle-quick-options" aria-label="LTR Demo"> <i class="fas fa-align-left"></i> </a> <?php else: ?> <a href="<?php echo esc_url( $current_url ); ?>/?rtl=enable" class="hint--bounce hint--left hint--black" id="toggle-quick-options" aria-label="RTL Demo"> <i class="fas fa-align-right"></i> </a> <?php endif; ?> <a href="https://support.envytheme.com/" target="_blank" rel="nofollow" class="hint--bounce hint--left hint--black" aria-label="Reach Us"> <i class="fas fa-life-ring"></i> </a> <a href="https://docs.envytheme.com/docs/cyarb-theme-documentation/" target="_blank" rel="nofollow" class="hint--bounce hint--left hint--black" aria-label="Documentation"> <i class="fas fa-book"></i> </a> <a href="https://1.envato.market/15g446" target="_blank" rel="nofollow" class="hint--bounce hint--left hint--black" aria-label="Purchase Cyarb"> <i class="fas fa-shopping-cart"></i> </a> </div> <?php endif; } add_action( 'wp_footer', 'cyarb_add_actual_link_to_footer' ); $opt_name = CYARB_FRAMEWORK_VAR;