/** * Default show-coordinates parameter for the chessboard widgets. * * @return boolean */ public function getDefaultShowCoordinates() { if (!isset(self::$showCoordinates)) { $value = RPBChessboardHelperValidation::validateBooleanFromInt(get_option('rpbchessboard_showCoordinates')); self::$showCoordinates = isset($value) ? $value : self::DEFAULT_SHOW_COORDINATES; } return self::$showCoordinates; }
/** * Whether the compatibility mode is activated or not for the [pgn][/pgn] shortcode * (which means that [pgn_compat][/pgn_compat] would be used instead). * * @return boolean */ public function getPGNCompatibilityMode() { if (!isset(self::$pgnCompatibilityMode)) { $value = RPBChessboardHelperValidation::validateBooleanFromInt(get_option('rpbchessboard_pgnCompatibilityMode')); self::$pgnCompatibilityMode = isset($value) ? $value : false; } return self::$pgnCompatibilityMode; }
/** * Whether the small-screen compatibility mode is enabled or not. * * @return boolean */ public function getSmallScreenCompatibility() { if (!isset(self::$smallScreenCompatibility)) { $value = RPBChessboardHelperValidation::validateBooleanFromInt(get_option('rpbchessboard_smallScreenCompatibility')); self::$smallScreenCompatibility = isset($value) ? $value : true; } return self::$smallScreenCompatibility; }
/** * Load and validate a boolean post parameter with the given name. * * @param string $fieldName * @return boolean */ private static function loadBooleanParameter($fieldName) { return isset($_POST[$fieldName]) ? RPBChessboardHelperValidation::validateBooleanFromInt($_POST[$fieldName]) : null; }
/** * Load and validate the small-screen mode corresponding to the given index. * * @param int $index * @return string */ private static function loadSmallScreenMode($index) { $screenWidthKey = 'smallScreenMode' . $index . '-screenWidth'; $squareSizeKey = 'smallScreenMode' . $index . '-squareSize'; $hideCoordinatesKey = 'smallScreenMode' . $index . '-hideCoordinates'; if (isset($_POST[$screenWidthKey]) && isset($squareSizeKey) && isset($hideCoordinatesKey)) { $screenWidth = RPBChessboardHelperValidation::validateInteger($_POST[$screenWidthKey], 1); $squareSize = RPBChessboardHelperValidation::validateSquareSize($_POST[$squareSizeKey]); $hideCoordinates = RPBChessboardHelperValidation::validateBooleanFromInt($_POST[$hideCoordinatesKey]); if (isset($screenWidth) && isset($squareSize) && isset($hideCoordinates)) { return $screenWidth . ':' . $squareSize . ':' . ($hideCoordinates ? 'true' : 'false'); } } return null; }
/** * Default show-move-arrow parameter. * * @return boolean */ public function getDefaultShowMoveArrow() { if (!isset(self::$showMoveArrow)) { $value = RPBChessboardHelperValidation::validateBooleanFromInt(get_option('rpbchessboard_showMoveArrow')); self::$showMoveArrow = isset($value) ? $value : self::DEFAULT_SHOW_MOVE_ARROW; } return self::$showMoveArrow; }