PageRenderTime 54ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/cm-pop-up-banners/libs/wpalchemy/metaboxes/cm-help-items-options.php

https://gitlab.com/thisishayat/itv-2016
PHP | 178 lines | 157 code | 20 blank | 1 comment | 10 complexity | 4222e5a2f0bbf1b505776449f065eaf5 MD5 | raw file
  1. <div class="my_meta_control cm-help-items-options">
  2. <?php
  3. wp_print_styles( 'editor-buttons' );
  4. ob_start();
  5. wp_editor( '', 'content', array(
  6. 'dfw' => true,
  7. 'editor_height' => 1,
  8. 'tinymce' => array(
  9. 'resize' => true,
  10. 'add_unload_trigger' => false,
  11. 'relative_urls' => false,
  12. 'remove_script_host' => false,
  13. 'convert_urls' => false
  14. ),
  15. ) );
  16. $content = ob_get_contents();
  17. ob_end_clean();
  18. $args = array(
  19. 'post_type' => 'page',
  20. 'show_option_none' => CMPopUpFlyIn::__( 'None' ),
  21. 'option_none_value' => '',
  22. );
  23. global $wp_version;
  24. if ( version_compare( $wp_version, '4.3', '<' ) ) {
  25. add_filter( 'the_editor_content', 'wp_richedit_pre' );
  26. } else {
  27. add_filter( 'the_editor_content', 'format_for_editor' );
  28. }
  29. $switch_class = 'tmce-active';
  30. $defaultWidgetType = CMPOPFLY_Settings::getOption( CMPOPFLY_Settings::OPTION_DEFAULT_WIDGET_TYPE );
  31. $widgetType = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_DEFAULT_WIDGET_TYPE );
  32. $displayMethod = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_DISPLAY_METHOD );
  33. $widgetDisplayMethod = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_DISPLAY_METHOD );
  34. $widgetShape = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_CUSTOM_WIDGET_SHAPE );
  35. $widgetShowEffect = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_CUSTOM_WIDGET_SHOW_EFFECT );
  36. $widgetInterval = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_CUSTOM_WIDGET_INTERVAL );
  37. $underlayType = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_CUSTOM_WIDGET_UNDERLAY_TYPE );
  38. $selectedBanner = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_CUSTOM_WIDGET_SELECTE_BANNER );
  39. $clicksCountMethod = CMPOPFLY_Settings::getOptionConfig( CMPOPFLY_Settings::OPTION_CUSTOM_WIDGET_CLICKS_COUNT_METHOD );
  40. if ( isset( $_GET[ 'post' ] ) ) {
  41. $activityDates = get_post_meta( $_GET[ 'post' ], CMPopUpFlyInShared::CMPOPFLY_CUSTOM_ACTIVITY_DATES_META_KEY );
  42. }
  43. if ( !empty( $activityDates ) ) {
  44. $activityDates = maybe_unserialize( $activityDates[ 0 ] );
  45. } else {
  46. $activityDates = false;
  47. }
  48. ?>
  49. <div id="cmpopfly-options-group">
  50. <div class="cmpopfly-options-group">
  51. <label>Type</label>
  52. <p>
  53. <?php $mb->the_field( 'cm-campaign-widget-type' ); ?>
  54. <select name="<?php $mb->the_name(); ?>" id="cm-campaign-widget-type">
  55. <?php
  56. $fieldValue = $mb->get_the_value();
  57. // echo '<option value="0" ' . selected('0', $fieldValue, false) . '>' . CMPopUpFlyIn::__('Default') . ' (' . $widgetType['options'][$defaultWidgetType] . ') </option>';
  58. foreach ( $widgetType[ 'options' ] as $key => $value ) {
  59. echo '<option value="' . $key . '" ' . selected( $key, $fieldValue, false ) . '>' . $value . '</option>';
  60. }
  61. ?>
  62. </select><br />
  63. <span class='field-info'>You can choose the different type for the current campaign.</span>
  64. </p>
  65. <?php $mb->the_field( 'cm-campaign-display-method' ); ?>
  66. <input type="hidden" name="<?php $mb->the_name(); ?>" value="selected"/>
  67. <?php $mb->the_field( 'cm-campaign-widget-selected-banner' ); ?>
  68. <input type="hidden" id="campaign-selected-banner-back" value="0"/>
  69. <input type="hidden" name="<?php $mb->the_name(); ?>" id="cm-campaign-widget-selected-banner" value="0"/>
  70. <label>Width</label>
  71. <p>
  72. <?php $mb->the_field( 'cm-campaign-widget-width' ); ?>
  73. <input type="text" name="<?php $mb->the_name(); ?>" placeholder="250px" value="<?php echo $metabox->get_the_value(); ?>"/>
  74. <span class='field-info'>campaign width. If blank defaults to 250px. Please input value in pixels.</span>
  75. </p>
  76. <label>Height</label>
  77. <p>
  78. <?php $mb->the_field( 'cm-campaign-widget-height' ); ?>
  79. <input type="text" name="<?php $mb->the_name(); ?>" placeholder="350px" value="<?php echo $metabox->get_the_value(); ?>"/>
  80. <span class='field-info'>campaign height. If blank defaults to 350px. Please input value in pixels.</span>
  81. </p>
  82. <label>Background color</label>
  83. <p>
  84. <?php $mb->the_field( 'cm-campaign-widget-background-color' ); ?>
  85. <input type="text" name="<?php $mb->the_name(); ?>" placeholder="#ffffff" value="<?php echo $metabox->get_the_value(); ?>"/>
  86. <span class='field-info'>Campaign background color. Please enter it in hexadecimal color format (eg. #abc123). If blank defaults to #ffffff (white).</span>
  87. </p>
  88. <label>Shape</label>
  89. <p>
  90. <?php $mb->the_field( 'cm-campaign-widget-shape' ); ?>
  91. <select name="<?php $mb->the_name(); ?>">
  92. <?php
  93. $fieldValue = $mb->get_the_value();
  94. if ( empty( $fieldValue ) ) {
  95. $fieldValue = $widgetShape[ 'default' ];
  96. }
  97. foreach ( $widgetShape[ 'options' ] as $key => $value ) {
  98. echo '<option value="' . $key . '" ' . selected( $key, $fieldValue, false ) . '>' . $value . '</option>';
  99. }
  100. ?>
  101. </select>
  102. <br />
  103. <span class='field-info'>You can choose the different shape for the current campaign.</span>
  104. </p>
  105. </div>
  106. <div class="cmpopfly-options-group">
  107. <?php $mb->the_field( 'cm-campaign-widget-show-effect' ); ?>
  108. <input type="hidden" name="<?php $mb->the_name(); ?>" placeholder="0" value="<?php echo $mb->get_the_value(); ?>"/>
  109. <span id="underlayTypeContainer" style="display: none;">
  110. <label>Underlay type</label>
  111. <p>
  112. <?php $mb->the_field( 'cm-campaign-widget-underlay-type' ); ?>
  113. <select name="<?php $mb->the_name(); ?>">
  114. <?php
  115. $fieldValue = $mb->get_the_value();
  116. if ( empty( $fieldValue ) ) {
  117. $fieldValue = $underlayType[ 'default' ];
  118. }
  119. foreach ( $underlayType[ 'options' ] as $key => $value ) {
  120. echo '<option value="' . $key . '" ' . selected( $key, $fieldValue, false ) . '>' . $value . '</option>';
  121. }
  122. ?>
  123. </select>
  124. <br />
  125. <span class='field-info'>You can choose the different underlay type for current campaign.</span>
  126. </p>
  127. </span>
  128. </div>
  129. <div class="cmpopfly-options-group">
  130. <label>Show on every page</label>
  131. <p>
  132. <?php
  133. $mb->the_field( 'cm-campaign-show-allpages' );
  134. $value = $mb->get_the_value();
  135. $checked = is_string( $value ) ? $value : '1';
  136. ?>
  137. <input type="hidden" name="<?php $mb->the_name(); ?>" value="0"/>
  138. <input type="checkbox" name="<?php $mb->the_name(); ?>" value="1" <?php checked( '1', $checked ); ?> class="<?php $mb->the_name(); ?>"/>
  139. <span class='field-info'>If this checkbox is selected then this campaign will be displayed on each post and page of your website</span>
  140. </p>
  141. <label>Show on selected post/page</label>
  142. <p>
  143. <?php $mb->the_field( 'title' ); ?>
  144. <?php // need to html_entity_decode() the value b/c WP Alchemy's get_the_value() runs the data through htmlentities() ?>
  145. <?php
  146. $mb->the_field( 'cm-help-item-url' );
  147. $args[ 'name' ] = $mb->get_the_name();
  148. $args[ 'selected' ] = $metabox->get_the_value();
  149. $args[ 'custom_post_types' ] = 1;
  150. cmpopfly_cminds_dropdown( $args );
  151. ?>
  152. </p>
  153. </div>
  154. </div>
  155. <p class="meta-save">
  156. <strong>To save the settings use the "Publish/Update" button in the right column.</strong>
  157. </p>
  158. </div>