post_type === 'emailkit' && isset( $actions['inline hide-if-no-js'] ) && !class_exists('EmailKit_Essentials') ) { unset( $actions['inline hide-if-no-js'] ); } if ($post->post_type === 'emailkit') { $edit_url = admin_url("post.php?post={$post->ID}&action=emailkit-builder"); $actions['emailkit-builder'] = sprintf("%s",esc_url($edit_url),esc_html__('Edit with Emailkit', 'emailkit')); // unset($actions['edit']); } return $actions; } public function replace($input){ // Define the regular expression pattern $pattern = '/([\w]+)<\/span>/'; // Use preg_match_all to find all matches in the input preg_match_all($pattern, $input, $matches, PREG_SET_ORDER); // Loop through each match and replace the content inside the span tag foreach ($matches as $match) { $shortcode = $match[1]; // Content inside the data-shortcode attribute // Create the replacement string and replace the match in the input $replacement = '{{' . $shortcode . '}}'; $input = str_replace($match[0], $replacement, $input); } return $input; } public function add_author_support() { remove_post_type_support('emailkit', 'author'); remove_post_type_support('emailkit', 'title'); } public function set_columns($columns) { $date_column = $columns['date']; $checkbox = $columns['cb']; unset($columns['title']); unset($columns['date']); unset($columns['author']); unset($columns['cb']); $columns = array_merge( array( 'cb' => esc_html($checkbox), 'title' => esc_html__('Template Title', 'emailkit'), 'type' => esc_html__('Templates Type', 'emailkit'), 'status' => esc_html__('Templates Status', 'emailkit'), 'author' => esc_html__('Author', 'emailkit'), 'date' => esc_html($date_column), ), $columns ); return $columns; } public function add_column_content($col, $post_id) { $type = get_post_meta($post_id, 'emailkit_template_type', true); $status = get_post_meta($post_id, 'emailkit_template_status', true); switch ($col) { case 'type': if ($col === 'type') { // Check for MetForm type first (starts with 'metform_form_' or equals METFORM constant) if (strpos($type, 'metform_form_') === 0 || $type === EmailLists::METFORM) { echo esc_html__('Confirmation Mail To User', 'emailkit'); } // Then check WooCommerce elseif (isset(EmailLists::woocommerce_email()[$type])) { echo esc_html(EmailLists::woocommerce_email()[$type]); } // Then check WordPress elseif (isset(EmailLists::wordpress_email()[$type])) { echo esc_html(EmailLists::wordpress_email()[$type]); } else { echo esc_html($type); } } break; case 'status': $temple_type = str_replace(' ', '-', strtolower($type)); $isStatus = $status; echo wp_kses('
', Utils::get_kses_array()); if (!empty($status)) { ?>
Active
', Utils::get_kses_array()); break; } } function mail_shortcode_replace($mail_content){ return Utils::mail_shortcode_filter($mail_content); } public function modal_view(){ $screen = get_current_screen(); if($screen->id == 'edit-emailkit' ){ include_once EMAILKIT_DIR . 'includes/views/modal-add-new-email.php'; include_once EMAILKIT_DIR . 'includes/views/modal-editor.php'; } } }