181 $this->
id = sanitize_title(
$id );
193 private function aria_title()
195 return sprintf(
'%s-title', $this->
id );
205 private function dismissButton()
208 if ( $this->dismissButton ) {
209 $result =
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">' . $this->dismiss_button_glyph .
'</button>';
222 private function width()
225 if ( !empty( $this->width ) ) {
226 $result = sprintf(
'width:%spx', rtrim( $this->width,
'px' ) );
239 private function height()
242 if ( !empty( $this->height ) ) {
243 $result = sprintf(
'style="height:%spx"', rtrim( $this->height,
'px' ) );
255 private function _buttons()
262 foreach (
$buttons as $key => $value ) {
263 $class = isset( $value[
'class'] ) ? $value[
'class'] :
'';
264 $label = isset( $value[
'label'] ) ? $value[
'label'] :
'';
265 $title = isset( $value[
'title'] ) ?
'title="' . $value[
'title'] .
'"' :
'';
267 $class .=
' wpdk-has-tooltip';
269 $data_dismiss = ( isset( $value[
'dismiss'] ) &&
true == $value[
'dismiss'] ) ?
'data-dismiss="modal"' :
'';
270 $stack .= sprintf(
'<button type="button" %s id="%s" class="button %s" %s aria-hidden="true">%s</button>',
$title, $key,
$class, $data_dismiss, $label );
274 if ( !empty( $stack ) ) {
275 $result = sprintf(
'<div class="modal-footer">%s</div>', $stack );
336 <div style=
"<?php echo $this->static ? 'position:relative;top:auto;left:auto;right:auto;margin:0 auto 20px;z-index:1;max-width:100%' : 'display:none;' ?>"
337 class=
"wpdk-modal <?php echo $this->static ? '' : 'fade' ?>"
338 <?php echo self::dataInline( $this->data ) ?>
339 id=
"<?php echo $this->id ?>"
342 aria-labelledby=
"<?php echo $this->aria_title() ?>"
344 <div style=
"<?php echo $this->width() ?>" class=
"modal-dialog">
345 <div
class=
"modal-content">
346 <div
class=
"modal-header">
347 <?php echo $this->dismissButton() ?>
348 <h4
class=
"modal-title" id=
"<?php echo $this->aria_title() ?>"><?php echo $this->title ?></h4>
350 <div
class=
"modal-body" <?php echo $this->height() ?>>
353 <?php echo $this->_buttons() ?>
371 <script type=
"text/javascript">
372 jQuery(
function ( $ )
375 $(
'#<?php echo $this->id ?>' ).wpdkModal(
'show' );
376 <?php do_action(
'wpdk_tbs_dialog_javascript_show' ) ?>
377 <?php do_action(
'wpdk_tbs_dialog_javascript_show-' . $this->
id ) ?>
391 <script type=
"text/javascript">
392 jQuery(
function ( $ )
394 $(
'#<?php echo $this->id ?>' ).wpdkModal(
'toggle' );
408 <script type=
"text/javascript">
409 jQuery(
function ( $ )
411 $(
'#<?php echo $this->id ?>' ).wpdkModal(
'hide' );
429 $id = sprintf(
'#%s', $this->
id );
430 $result = sprintf(
'<button class="button %s" type="button" data-toggle="modal" data-target="%s">%s</button>',
$class,
$id, $label );
449 'dismiss' => $dismiss
460 public function modal( $echo =
true )
466 return $this->
html();
475 _deprecated_function( __METHOD__,
'1.0.0.b4',
'addButton()' );
485 _deprecated_function( __METHOD__,
'1.0.0.b4',
'addData()' );
487 $this->
addData( $key, $value );
495 _deprecated_function( __METHOD__,
'1.0.0.b4',
'buttonOpenModal()' );