HEX
Server: Apache
System: Linux nc-ph-0707-26.instaforreviews.com 3.10.0-1160.119.1.el7.tuxcare.els13.x86_64 #1 SMP Fri Nov 22 06:29:45 UTC 2024 x86_64
User: qirgxuo4hkuv (1004)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: /home/qirgxuo4hkuv/public_html/shovago.com/wp-content/themes/ShovaGo copy/inc/shovago-options.php
<?php
/**
  * Theme: Shovago - Larbi Fatach - With Spaider - ALL in Lab
  * Desc: System Options
**/
class shovago__Options_Settings_Page {
	public function __construct() {
		add_action( 'admin_menu', array( $this, 'shovago__create_settings' ) );
		add_action( 'admin_init', array( $this, 'shovago__setup_sections' ) );
		add_action( 'admin_init', array( $this, 'shovago__setup_fields' ) );
	}
	public function shovago__create_settings() {
		$page_title = 'Shovago Options';
		$menu_title = 'Shovago Options';
		$capability = 'manage_options';
		$slug = 'shovago__Options';
		$callback = array($this, 'shovago__settings_content'); $icon = 'dashicons-admin-settings';
		$position = 2;
		add_menu_page($page_title, $menu_title, $capability, $slug, $callback, $icon, $position);
	}
	public function shovago__settings_content() { ?>
		<div class="wrap shovago__Options">
			<?php settings_errors(); ?>
			<form method="POST" action="options.php">
				<div><?php do_settings_sections( 'shovago__Options' ); ?></div>
				<?php settings_fields( 'shovago__Options' ); submit_button(); ?>
			</form>
		</div> <?php
	}
	public function shovago__setup_sections() {
		add_settings_section( 'shovago__Options_section', '', array(), 'shovago__Options' );
	}
	public function shovago__setup_fields() {
		$fields = array(
			array( 'id' => 'CMI IFRAME', 'section' => 'shovago__Options_section', 'label' => '', 'type' => 'title', ),
			array( 'label' => 'تفعيل CMI IFRAME', 'id' => 'shovago__Option_ActiveCmiIframe', 'type' => 'checkbox', 'section' => 'shovago__Options_section',),
			
		);
		foreach( $fields as $field ){
			add_settings_field( $field['id'], $field['label'], array( $this, 'shovago__field_callback' ), 'shovago__Options', $field['section'], $field );
			register_setting( 'shovago__Options', $field['id'] );
		}
	}
	public function shovago__field_callback( $field ) {
		$value = get_option( $field['id'] );
		$placeholder = '';
		if ( isset($field['placeholder']) ) {
			$placeholder = $field['placeholder'];
		}
		switch ( $field['type'] ) {
			case 'title':
    		printf( '<h3>%1$s</h3>',
	        $field['id'],
	        $placeholder,
	        $value
        );
      break;
			case 'checkbox':
				printf('<input %s id="%s" name="%s" type="checkbox" value="1">',
				$value === '1' ? 'checked' : '',
					$field['id'],
					$field['id']
				);
			break;
			case 'textarea':
        printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="5" cols="50">%3$s</textarea>',
        $field['id'],
        $placeholder,
        $value
        );
      break;
			default:
				printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />',
					$field['id'],
					$field['type'],
					$placeholder,
					$value
				);
		}
		if( isset($field['desc']) ) {
			if( $desc = $field['desc'] ) {
				printf( '<p class="description">%s </p>', $desc );
			}
		}
	}
}
new shovago__Options_Settings_Page();
/**** shovago:: Options Css **********************************************************************************************************/
function shovago__Options_Css() {
	global $pagenow;
	if ( $pagenow == 'admin.php' ) {
	  echo '<style>
			.shovago__Options{
			}
			.shovago__Options textarea {
				width: 100%;
				height: 100px;
				padding: 15px 17px;
			}
			.shovago__Options input {
				width: 100%;
				padding: 10px 20px;
			}
			.shovago__Options .button-primary {
				padding: 5px 40px;
				font-size: 17px;
				background-color: #5db94a;
				border: 0;
				width: 100%;
				float: left;
			}
			.shovago__Options  h1{
				font-family: tahoma;
				border: 0;
				background-color: #fff;
				padding: 13px 20px;
				margin: 40px 10px -30px;
			}
			.shovago__Options  h3 {
				background-color: #000;
				padding: 10px 15px;
				color: #fff;
				font-family: Tahoma,sans-serif;
				font-weight: lighter;
				margin-bottom: 0;
			}
			.shovago__Options  h4 {
				background-color: #59bb5a;
				padding: 10px 15px;
				color: #fff;
				font-family: Tahoma,sans-serif;
				font-weight: lighter;
				margin: 0 0 -5px;
			}
			.form-table tbody tr.Special{
				background-color: #602fcc;
				display: block;
				padding: 0 15px;
				margin: 20px 10px 0 0;
			}
			.form-table tbody tr.Specials {
			  background-color: #602fcc;
			  display: block;
			  padding: 0 15px;
			  margin: 20px 0 20px 0;
			}
			.form-table tbody tr.Special th, .form-table tbody tr.Specials th{
				color: #fff;
			}
			.shovago__Options input[type="color"] {
			  height: 60px;
			  padding: 6px;
			}
			.form-table th {
				text-align: left;
				font-family: tahoma;
				line-height: 25px;
			}
			.form-table tbody tr.Special td {
				color: #fff;
			}
			input[type="checkbox"]{
				width: 1rem !important;
			}
	  </style>';
	}
}
add_action('admin_head', 'shovago__Options_Css');