PHP 8.2.31
Preview: Skill.php Size: 2.18 KB
/home/nshryvcy/blissfulnepal.com/wp-content/plugins/tlp-team/app/Controllers/Admin/Ajax/Skill.php

<?php
/**
 * Skill Ajax Class.
 *
 * @package RT_Team
 */

namespace RT\Team\Controllers\Admin\Ajax;

use RT\Team\Helpers\Fns;

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}

/**
 * Skill Ajax Class.
 */
class Skill {
	use \RT\Team\Traits\SingletonTrait;

	/**
	 * Class Init.
	 *
	 * @return void
	 */
	protected function init() {
		add_action( 'wp_ajax_tlpTeamSkillInput', [ $this, 'response' ] );
	}

	/**
	 * Ajax Response.
	 *
	 * @return void
	 */
	public function response() {
		if ( ! ( current_user_can( 'manage_options' ) || current_user_can( 'edit_pages' ) ) ) {
            wp_send_json( [
                'error' => true,
                'msg'   => esc_html__( 'Permission denied', 'tlp-team' ),
            ] );
        }
		if ( wp_verify_nonce( Fns::getNonce(), Fns::nonceText()) ) {
			$count  = isset( $_REQUEST['id'] ) ? absint( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ) : '';
			$html   = null;
			$html   .= '<div class="tlp-field-holder skillHolder" id="sh-' . $count . '" >';
			$html   .= '<div class="tlp-label">';
			$html   .= '<select class="rt-select2" name="skill[' . $count . '][id]">';
			$skills = get_terms( array(
				'taxonomy'   => rttlp_team()->taxonomies['skill'],
				'orderby'    => 'name',
				'hide_empty' => false,
			) );
            // $skills = get_terms( rttlp_team()->taxonomies['skill'], 'orderby=name&hide_empty=0' );
			if ( ! empty( $skills ) ) {
				foreach ( $skills as $skill ) {
					$html .= "<option value='{$skill->name}'>{$skill->name}</option>";
				}
			}
			$html .= '</select>';
			$html .= '</div>';
			$html .= '<div class="tlp-field">';
			$html .= '<select name="skill[' . $count . '][percent]" class="tlpfield">';
			for ( $i = 0; $i <= 100; $i ++ ) {
				$html .= "<option value='$i'>$i</option>";
			}
			$html .= '</select> %';
			$html .= '<span data-id="' . $count . '" class="skRemove dashicons dashicons-trash"></span> <span class="dashicons dashicons-admin-settings"></span>';
			$html .= '</div>';
			$html .= '</div>';

			Fns::print_html( $html, true );
		}
		die();
	}
}

Directory Contents

Dirs: 0 × Files: 7

Name Size Perms Modified Actions
1.70 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download
39.22 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download
1.41 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download
2.12 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download
2.53 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download
2.18 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download
1.87 KB lrw-r--r-- 2026-06-03 14:57:33
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).