예제 #1
0
파일: fen.php 프로젝트: eigentor/sbl
 /**
  * Return the arguments to pass to the uichess-chessboard widget.
  *
  * @return array
  */
 public function getWidgetArgs()
 {
     if (!isset($this->widgetArgs)) {
         $this->widgetArgs = array('position' => $this->getContent());
         $atts = $this->getAttributes();
         // Square markers
         if (isset($atts['csl']) && is_string($atts['csl'])) {
             $this->widgetArgs['squareMarkers'] = $atts['csl'];
         }
         // Arrow markers
         if (isset($atts['cal']) && is_string($atts['cal'])) {
             $this->widgetArgs['arrowMarkers'] = $atts['cal'];
         }
         // Orientation
         $value = isset($atts['flip']) ? RPBChessboardHelperValidation::validateBoolean($atts['flip']) : null;
         if (isset($value)) {
             $this->widgetArgs['flip'] = $value;
         }
         // Square size
         $value = isset($atts['square_size']) ? RPBChessboardHelperValidation::validateSquareSize($atts['square_size']) : null;
         $this->widgetArgs['squareSize'] = isset($value) ? $value : $this->getDefaultSquareSize();
         // Show coordinates
         $value = isset($atts['show_coordinates']) ? RPBChessboardHelperValidation::validateBoolean($atts['show_coordinates']) : null;
         $this->widgetArgs['showCoordinates'] = isset($value) ? $value : $this->getDefaultShowCoordinates();
     }
     return $this->widgetArgs;
 }
예제 #2
0
파일: pgn.php 프로젝트: eigentor/sbl
 /**
  * Return the arguments to pass to the uichess-chessboard widget.
  *
  * @return array
  */
 public function getWidgetArgs()
 {
     if (!isset($this->widgetArgs)) {
         $this->widgetArgs = array('pgn' => $this->getContent());
         $atts = $this->getAttributes();
         $chessboardOptions = array();
         // Orientation
         $value = isset($atts['flip']) ? RPBChessboardHelperValidation::validateBoolean($atts['flip']) : null;
         if (isset($value)) {
             $chessboardOptions['flip'] = $value;
         }
         // Square size
         $value = isset($atts['square_size']) ? RPBChessboardHelperValidation::validateSquareSize($atts['square_size']) : null;
         $chessboardOptions['squareSize'] = isset($value) ? $value : $this->getDefaultSquareSize();
         // Show coordinates
         $value = isset($atts['show_coordinates']) ? RPBChessboardHelperValidation::validateBoolean($atts['show_coordinates']) : null;
         $chessboardOptions['showCoordinates'] = isset($value) ? $value : $this->getDefaultShowCoordinates();
         // Animation speed
         $value = isset($atts['animation_speed']) ? RPBChessboardHelperValidation::validateAnimationSpeed($atts['animation_speed']) : null;
         $chessboardOptions['animationSpeed'] = isset($value) ? $value : $this->getDefaultAnimationSpeed();
         // Move arrow
         $value = isset($atts['show_move_arrow']) ? RPBChessboardHelperValidation::validateBoolean($atts['show_move_arrow']) : null;
         $chessboardOptions['showMoveArrow'] = isset($value) ? $value : $this->getDefaultShowMoveArrow();
         // Piece symbols
         $value = isset($atts['piece_symbols']) ? RPBChessboardHelperValidation::validatePieceSymbols($atts['piece_symbols']) : null;
         $this->widgetArgs['pieceSymbols'] = isset($value) ? $value : $this->getDefaultPieceSymbols();
         // Navigation board
         $value = isset($atts['navigation_board']) ? RPBChessboardHelperValidation::validateNavigationBoard($atts['navigation_board']) : null;
         $this->widgetArgs['navigationBoard'] = isset($value) ? $value : $this->getDefaultNavigationBoard();
         // Use the same aspect parameters for the navigation board and the text comment diagrams.
         $this->widgetArgs['navigationBoardOptions'] = $chessboardOptions;
         $this->widgetArgs['diagramOptions'] = $chessboardOptions;
     }
     return $this->widgetArgs;
 }
예제 #3
0
파일: pgndiagram.php 프로젝트: eigentor/sbl
 /**
  * Options specific to the current diagram, that may override the settings defined either
  * at the [pgn][/pgn] shortcode level or at the global level.
  *
  * @return array
  */
 public function getDiagramOptions()
 {
     if (!isset($this->diagramOptions)) {
         $this->diagramOptions = array();
         $atts = $this->getAttributes();
         // Orientation
         $value = isset($atts['flip']) ? RPBChessboardHelperValidation::validateBoolean($atts['flip']) : null;
         if (isset($value)) {
             $this->diagramOptions['flip'] = $value;
         }
         // Square size
         $value = isset($atts['square_size']) ? RPBChessboardHelperValidation::validateSquareSize($atts['square_size']) : null;
         if (isset($value)) {
             $this->diagramOptions['squareSize'] = $value;
         }
         // Show coordinates
         $value = isset($atts['show_coordinates']) ? RPBChessboardHelperValidation::validateBoolean($atts['show_coordinates']) : null;
         if (isset($value)) {
             $this->diagramOptions['showCoordinates'] = $value;
         }
     }
     return $this->diagramOptions;
 }