*/ class Adamrob_Parallax_Scroll_Meta_Fields_Option extends Adamrob_Parallax_Scroll_Meta_Fields { /** * Array containing the valid options * EG: array ( * 'one' => array ( * 'label' => 'Left', * 'value' => 'left' * ), * 'two' => array ( * 'label' => 'Centre', * 'value' => 'center' * ), * 'three' => array ( * 'label' => 'Right', * 'value' => 'right' * ) * * @since 3.0.0 * @access protected * @var array $options * } */ protected $options; /** * Initialize the class and set its properties. * * @since 3.0.0 */ public function __construct( $tab, $order, $label, $desc, $id, $options ) { /** Set parent data */ $this->type = 'option'; $this->tab = $tab; $this->order = $order; $this->label = $label; $this->desc = $desc; $this->set_id( $id); /** Set number data */ $this->options = $options; } /** * Returns the required HTML markup to display * the numeric field on a page * * @param boolean $echo Set wether the markup should be echoed * @return string */ public function get_markup( $echo = true){ $value = $this->get_value(); $markup = '
'; /** Echo or return the markup */ if( $echo ){ echo $markup; } else{ return $markup; } } /** * Returns the current value of the field * fully sanatised for the datatype * * @return mixed The fields value */ private function get_value(){ return $this->sanitize_option( $this->get_raw_value( get_the_ID() ) ); } /** * Checks the POST data for valid data and saves / * deletes if required * * @since 3.0.0 * @param int $post_id The ID of the post containing the meta data * @return void */ public function save_value($post_id){ if ( $this->post_value_exists() ) { $this->update_post_meta( $post_id, $this->sanitize_option( $_POST[ $this->id ] ) ); } else { $this->delete_post_meta( $post_id); } } /** * Sanatise function for option fields * * @since 3.0.0 * @param string $var * @return string Sanatised string */ private function sanitize_option($var){ //Sanitizes and validates a string //$url="Is Peter