[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/admin/ -> class.options.ui.php (source)

   1  <?php
   2  /**
   3   *
   4   *
   5   *  Options Layout Class
   6   *
   7   *
   8   *  @package PageLines DMS
   9   *  @subpackage Options
  10   *  @since 4.0
  11   *
  12   */
  13  
  14  class PageLinesOptionsUI {
  15  
  16  /*
  17      Build The Layout
  18  */
  19  	function __construct( $args = array() ) {
  20  
  21          $defaults = array(
  22                  'title'            => sprintf( '%s %s', ( is_child_theme() ) ? PL_NICECHILDTHEMENAME : '', __( 'Global Settings', 'pagelines') ),
  23                  'callback'        => null,
  24                  'settings'        => PAGELINES_SETTINGS,
  25                  'sanitize'        => '',
  26                  'show_save'        => true,
  27                  'show_reset'    => true,
  28                  'basic_reset'    => false,
  29                  'reset_cb'        => false,
  30                  'title_size'    => 'normal',
  31                  'fullform'        => true,
  32                  'tabs'            => true,
  33                  'reset_store'    => false,
  34              );
  35  
  36          $this->set = wp_parse_args( $args, $defaults );
  37  
  38          // Set option array callbacks
  39          $this->option_array = (isset($this->set['callback'])) ? call_user_func( $this->set['callback'] ) : get_option_array( false );
  40  
  41          $this->primary_settings = ($this->set['settings'] == PAGELINES_SETTINGS) ? true : false;
  42  
  43          $this->tab_cookie = 'PLTab_'.$this->set['settings'];
  44  
  45  
  46  
  47          // Draw the thing
  48          $this->build_header();
  49          $this->build_body();
  50          $this->build_footer();
  51  
  52      }
  53  
  54  
  55          /**
  56           * Option Interface Header
  57           *
  58           */
  59  		function build_header(){?>
  60              <div class='plwrap'>
  61                  <table id="optionstable" class="pl_opt_ui"><tbody><tr><td valign="top" width="100%">
  62                      <?php
  63  
  64                               if( $this->set['fullform'] )
  65                                  $this->fullform_head();
  66  
  67                              $this->get_tab_setup();
  68  
  69                              $this->_get_confirmations_and_system_checking();
  70  
  71                          ?>
  72  
  73                          <div class="clear"></div>
  74                          <div id="dialog" class="thedialog pldialog" title="PageLines Store"></div>
  75                          <div id="optionsheader" class="fix">
  76                              <div class="ohead fix">
  77                                  <div class="ohead-pad fix">
  78                                      
  79                                      <div class="ohead-title">
  80                                          <?php
  81  
  82                                              if(VDEV)
  83                                                  $title_tag = 'Developer Edition';
  84                                              elseif(VPRO)
  85                                                  $title_tag = 'Professional Edition';
  86                                              else
  87                                                  $title_tag = 'Lite Edition';
  88  
  89                                              $panel_title = sprintf('%s', $this->set['title'] );
  90  
  91                                              echo apply_filters( 'pagelines_settings_main_title', $panel_title );
  92  
  93                                          ?>
  94                                          <a class='btag grey viewsitetag' href="<?php echo home_url();?>" target="_blank" style="display: none;">View Your Site &rarr;</a>
  95                                      </div>
  96                                      <div class="ohead-title-right">
  97                                          <?php if($this->set['show_save']):?>
  98                                          <div class="superlink-wrap osave-wrap">
  99                                              <input class="superlink osave" type="submit" name="submit" value="<?php _e('Save Options', 'pagelines');?>" />
 100                                          </div>
 101                                          <?php endif;?>
 102                                      </div>
 103                                  </div>
 104                              </div>
 105                          </div>
 106  <?php }
 107  
 108  
 109          /**
 110          *
 111          * @TODO document
 112          *
 113          */
 114  		function fullform_head(){ ?>
 115              <form id="pagelines-settings-form" method="post" action="options.php" class="main_settings_form">
 116              <?php
 117                          wp_nonce_field('update-options'); // security for option saving
 118                          settings_fields($this->set['settings']); // namespace for options important!
 119                          echo OptEngine::input_hidden('input-full-submit', 'input-full-submit', 0); // submit the form fully, page refresh needed
 120  
 121          }
 122  
 123  
 124          /**
 125          *
 126          * @TODO document
 127          *
 128          */
 129  		function fullform_foot(){ ?>
 130              <?php if($this->set['show_reset']):?>
 131              <div class="optionrestore fix">
 132                  <?php echo OptEngine::superlink(__('Restore To Default', 'pagelines' ), 'grey', 'reset-options', 'submit', 'onClick="return ConfirmRestore();"', plname('reset', array('setting' => $this->set['settings'])));?>
 133                  <div class="ortext">Use this button to restore these settings to default. &mdash; <strong>Note</strong>: Restore template and layout information in their individual tabs.</p></div>
 134                  <?php pl_action_confirm('ConfirmRestore', __( 'Are you sure? This will restore these settings to default.', 'pagelines' ));?>
 135              </div>
 136              <?php endif;?>
 137              </form><!-- close entire form -->
 138          <?php  }
 139  
 140  
 141          /**
 142          *
 143          * @TODO document
 144          *
 145          */
 146  		function _get_confirmations_and_system_checking(){
 147  
 148                  // Load Ajax confirmation
 149                  printf('<div class="ajax-saved" style=""><div class="ajax-saved-pad"><div class="ajax-saved-icon"></div></div></div>');
 150  
 151                  // get confirmations
 152                  pagelines_draw_confirms();
 153  
 154                  // Get server error messages
 155                  pagelines_error_messages();
 156  
 157          }
 158  
 159          /**
 160           * Option Interface Footer
 161           *
 162           */
 163  		function build_footer(){?>
 164                  <div id="optionsfooter" class="fix">
 165                      <div class="ohead fix">
 166                          <div class="ohead-pad fix">
 167                              <?php if($this->set['show_save']):?>
 168                              <div class="superlink-wrap osave-wrap">
 169                                  <input class="superlink osave" type="submit" name="submit" value="<?php _e('Save Options', 'pagelines');?>" />
 170                              </div>
 171                              <?php elseif($this->set['reset_store']):?>
 172                                  <div class="superlink-wrap">
 173                                      <form method="post">
 174                                          <input type="hidden" name='reset_store' value="true" />
 175                                          <input class="superlink osave" type="submit" name="submit" value="<?php _e('Refresh Store', 'pagelines');?>" />
 176                                      </form>
 177                                  </div>
 178                              <?php endif;?>
 179                          </div>
 180                      </div>
 181                  </div>
 182  
 183                  <?php
 184  
 185                      if( $this->set['fullform'] )
 186                          $this->fullform_foot();
 187  
 188                      if($this->set['basic_reset'])
 189                          $this->basic_reset();
 190  
 191                          ?>
 192  
 193              </td></tr></tbody></table>
 194  
 195              <div class="clear"></div>
 196              </div>
 197          <?php }
 198  
 199  
 200          /**
 201          *
 202          * @TODO document
 203          *
 204          */
 205  		function basic_reset(){ ?>
 206              <form method="post">
 207                  <div class="optionrestore fix">
 208  
 209                          <?php
 210                          echo OptEngine::input_hidden('the_pl_setting', 'the_pl_setting', $this->set['settings']);
 211  
 212                          if($this->set['reset_cb'])
 213                              echo OptEngine::input_hidden('reset_callback', 'reset_callback', $this->set['reset_cb']);
 214  
 215                          echo OptEngine::superlink( sprintf( __('Restore %s To Default', 'pagelines'), strip_tags( $this->set['title'] ) ), 'grey', 'reset-options', 'submit', 'onClick="return ConfirmRestore();"',  'pl_reset_settings' );
 216  
 217                          pl_action_confirm('ConfirmRestore', __( 'Are you sure? This will restore these settings to default.', 'pagelines' ) );
 218                          ?>
 219  
 220                          <div class="ortext"><?php _e('Use this button to restore these settings to default.', 'pagelines');?></div>
 221  
 222                  </div>
 223              </form>
 224  <?php }
 225  
 226  
 227          /**
 228           * Option Interface Body, including vertical tabbed nav
 229           *
 230           */
 231  		function build_body(){
 232              $option_engine = new OptEngine( $this->set['settings'] );
 233              global $pl_section_factory;
 234  
 235              $tabs = ($this->set['tabs']) ? true : false;
 236  
 237  ?>
 238              <div id="tabs" class="<?php if(!$tabs) echo 'no_tabs';?>">
 239  
 240                  <?php if( $tabs ): ?>
 241                  <ul id="tabsnav">
 242                      <li><span class="graphic top">&nbsp;</span></li>
 243                      <?php
 244  
 245  
 246                      foreach($this->option_array as $menu => $oids){
 247  
 248                          $pro_tab = (!VPRO && isset($oids['version']) && $oids['version'] == 'pro') ? true : false;
 249  
 250                          $bg = (isset($oids['icon'])) ? sprintf('style="background: transparent url(%s) no-repeat 0 0;"', $oids['icon']) : '';
 251  
 252                          $name = ($pro_tab) ? sprintf('%s <span class="sss-tag">(Pro)</span>', ui_key($menu)) : ui_key($menu);
 253  
 254                          $special_class = ($pro_tab) ? 'pro_tab' : '';
 255  
 256                          printf('<li><a class="%1$s tabnav-element %4$s" href="#%1$s"><span class="icn" %3$s >%2$s</span></a></li>', $menu, $name, $bg, $special_class);
 257                      }
 258  
 259                      ?>
 260                      <li><span class="graphic bottom">&nbsp;</span></li>
 261  
 262                      <li class="framework_loading">
 263                          <a href="http://forum.pagelines.com/discussion/6489" target="_blank" title="Javascript Issue Detector">
 264                              <span class="framework_loading_gif" >&nbsp;</span>
 265                          </a>
 266                      </li>
 267                      <script type="text/javascript">/*<![CDATA[*/ jQuery(document).ready(function(){ jQuery('.framework_loading').hide(); }); /*]]>*/</script>
 268                  </ul>
 269                  <?php endif; ?>
 270                  <div id="thetabs" class="plpanel <?php echo $this->set['settings'];?>-panel fix">
 271  <?php                 if(!VPRO) $this->get_pro_call();
 272  
 273                      foreach($this->option_array as $menu => $oids){
 274  
 275                          $pro_tab = (!VPRO && isset($oids['version']) && $oids['version'] == 'pro') ? true : false;
 276  
 277                          $bg = (isset($oids['icon'])) ? sprintf('style="background: transparent url(%s) no-repeat 10px 16px;"', $oids['icon']) : '';
 278  
 279                          $is_htabs = ( isset($oids['htabs']) ) ? true : false;
 280  
 281                          // The tab container start....
 282                          printf('<div id="%s" class="tabinfo %s">', $menu, ($is_htabs) ? 'htabs-interface' : '');
 283  
 284                              // Draw Menu Title w/ Icon
 285                              if( stripos($menu, '_') !== 0 )
 286                                  printf('<div class="tabtitle" %s><div class="tabtitle-pad">%s</div></div>', $bg, ui_key($menu) );
 287  
 288  
 289                              // Render Options
 290                              if( isset($oids['htabs']))
 291                                  OptEngine::get_horizontal_nav( $menu, $oids );
 292  
 293                              elseif( $pro_tab )
 294                                  echo $this->show_banner(
 295                                      sprintf('The pro or dev version is needed for "%s" meta options.<br/> Please use "Blog Page" options instead.',  ui_key($menu)),
 296                                      'http://www.pagelines.com/pricing',
 297                                      'Upgrade &raquo;'
 298                                  );
 299  
 300                              elseif( isset($oids['metapanel']))
 301                                  echo $oids['metapanel'];
 302  
 303                              else{
 304  
 305                                  foreach( $oids as $oid => $o ){
 306  
 307                                      if( $oid != 'icon' )
 308                                          $option_engine->option_engine($oid, $o);
 309  
 310  
 311                                  }
 312                              }
 313  
 314                          echo '<div class="clear"></div></div>';
 315                      }
 316                      ?>
 317                  </div>
 318              </div>
 319  <?php     }
 320  
 321  
 322      /**
 323      *
 324      * @TODO document
 325      *
 326      */
 327  	function show_banner( $text, $click = '', $button_text = 'Add Some &rarr;' ){
 328  
 329          if($click != ''){
 330              $thebutton = OptEngine::superlink($button_text, 'blue', 'install_now iblock', $click );
 331              $button = sprintf('<br/><br/>%s', $thebutton );
 332  
 333          } else
 334              $button = '';
 335  
 336          // The banner
 337          return sprintf('<div class="user-banner fix"><span class="banner-text">%s</span>%s</div>', $text, $button);
 338      }
 339  
 340      /**
 341       *  Tab Stuff
 342       */
 343  	function get_tab_setup(){ ?>
 344          <script type="text/javascript">
 345                  jQuery(document).ready(function() {
 346  
 347                      var myTabs = jQuery("#tabs").tabs({
 348                          cookie: {
 349                              name: "<?php echo $this->set['settings'];?>-tabs"
 350                          }
 351                          , fx: {
 352                              opacity: "toggle",
 353                              duration: 100
 354                          }
 355                      })
 356  
 357  
 358                  // var tabsID = "<?php echo $this->set['settings'];?>-tabs"
 359                  //             ,     tabSelected = jQuery.cookie(tabsID)
 360                  //
 361                  //             console.log(tabSelected)
 362                  //                 jQuery("#tabs").tabs({
 363                  //                         selected: tabSelected -2
 364                  //                         , fx: {
 365                  //                             opacity: "toggle",
 366                  //                             duration: 100
 367                  //                         }
 368                  //                         , show: function(event, ui) {
 369                  //                             jQuery.cookie(tabsID, ui.index)
 370                  //
 371                  //                         }
 372                  //                     }
 373                  //                 );
 374  
 375                  })
 376          </script>
 377      <?php }
 378  
 379  
 380  
 381      /**
 382      *
 383      * @TODO document
 384      *
 385      */
 386  	function get_pro_call(){
 387          global $pl_section_factory;
 388  
 389          $usections = $pl_section_factory->unavailable_sections;
 390  
 391          ?>
 392          <div id="vpro_billboard" class="vpro-billboard">
 393              <div class="vpro-billboard-pad">
 394                  <div class="vpro_billboard_height fix">
 395                      <a class="vpro_thumb" href="<?php echo VPRO_TOUR.'?ref=le-admin';?>"><img src="<?php echo PL_IMAGES;?>/pro-thumb.png" alt="<?php echo VPRO_NAME;?>" /></a>
 396                      <div class="vpro_desc">
 397                          <strong style="font-size: 1.2em">You Are Using PageLines Lite Edition</strong><br/>
 398                          <strong>PageLines Lite</strong> is the <strong>free version</strong> of <?php echo VPRO_NAME;?>.<br/>
 399                          Upgrade to the Pro edition for more sections &amp; options, no credit link, enhanced social &amp; SEO, support and <a href="http://www.pagelines.com/tour?ref=le-admin">more...</a><br/>
 400  
 401                          <?php
 402  
 403                          $features_js = 'onClick="jQuery(\'.vpro-billboard\').find(\'.whatsmissing\').fadeToggle();"';
 404  
 405                          $pro_buttons = OptEngine::superlink(__( 'Why Upgrade? &darr;', 'pagelines' ), 'grey', 'left', '#', $features_js);
 406  
 407                          $target = 'target="_blank"';
 408                          $pro_buttons .= OptEngine::superlink(__( 'PageLines Tour', 'pagelines' ), 'grey', 'left', VPRO_TOUR.'?ref=le-admin', $target);
 409  
 410                          $pro_buttons .= OptEngine::superlink(__( 'Upgrade Now &rarr;', 'pagelines' ), 'blue', 'left', VPRO_PRICING.'?ref=le-admin', $target);
 411  
 412                          printf('<div class="pro_buttons fix">%s</div>', $pro_buttons);
 413  
 414                          ?>
 415                      </div>
 416  
 417                  </div>
 418                  <div class="whatsmissing">
 419                       <h3>
 420                          Why You'll Love the Professional or Developer edition...
 421                      </h3>
 422  
 423                      <p>
 424                          When you upgrade you get 30+ pro drag &amp; drop sections, 200+ CMS options, SEO and social enhancements and way, way more.
 425                      </p>
 426                      <p>
 427                          The pro version way more control options. For advanced users, there is also a Developer version that supports "integrations" and WP "multisite"... To learn more see the <a href="http://www.pagelines.com/pricing?ref=le-admin">pricing page</a> or <a href="http://www.pagelines.com/tour?ref=le-admin">PageLines tour</a>...
 428                      </p>
 429                      <p>
 430                          <strong>Some specifics:</strong>
 431                      </p>
 432  
 433                      <?php if(isset($usections) && is_array($usections)):?>
 434                          <p class="mod"><strong>Professional Sections In Pro Version</strong><br/>
 435                          <?php
 436  
 437                              $list_sections = array();
 438                              foreach( $usections as $unavailable_section )
 439                                  $list_sections[] = $unavailable_section->name;
 440  
 441                              echo join(' &middot; ', $list_sections);
 442                          ?>
 443                          </p>
 444                      <?php endif;?>
 445  
 446                      <?php
 447                      $unavailable_section_areas = get_unavailable_section_areas();
 448                      if(isset($unavailable_section_areas) && is_array($unavailable_section_areas)):?>
 449                          <p class="mod"><strong>New Templates and Template Areas</strong> (i.e. places to put sections)<br/>
 450                          <?php foreach( $unavailable_section_areas as $unavailable_section_area_name ):?>
 451                              <?php echo $unavailable_section_area_name; if($unavailable_section_area_name !== end($unavailable_section_areas)) echo ' &middot; ';?>
 452                          <?php endforeach;?></p>
 453                      <?php endif;?>
 454  
 455                      <p class="mod"><strong>New Settings &amp; Options</strong><br/>
 456                      <?php
 457  
 458                          $list = array();
 459                          foreach( get_option_array(true) as $optionset ){
 460                              foreach ( $optionset as $oid => $o){
 461                                  if( isset($o['version']) && $o['version'] == 'pro' )
 462                                      $list[] = $o['title'];
 463                              }
 464                          }
 465  
 466                          echo join(' &middot; ', $list);
 467  
 468                      ?></p>
 469  
 470  
 471  
 472                  </div>
 473  
 474              </div>
 475          </div>
 476  
 477      <?php }
 478  
 479  } // End Class


Generated: Fri Aug 30 18:26:24 2013 Cross-referenced by PHPXref 0.7.1