Exemplo n.º 1
0
 function options_engine()
 {
     $option_engine = new PL_Form_Engine($this->set);
     if ('settings' == $this->set['render']) {
         printf('<form id="%s" action="%s" method="POST">', $this->current_tab_slug, admin_url('admin-post.php'));
     }
     echo '<div class="pl-admin-settings tabinfo">';
     if (isset($_GET['msg']) && $_GET['msg'] == 'updated') {
         printf('<div class="updated"><p><i class="pl-icon pl-icon-save"></i> %s</p></div>', __('PageLines Settings Updated!', 'pl-platform'));
     }
     printf('<div class="pl-settings-tabs render-%s" data-selected="%s">', $this->set['render'], $this->settings_tab_slug);
     $nav_items = false;
     foreach ($this->current_tab_config['groups'] as $ind => $groups) {
         $key = isset($groups['key']) ? $groups['key'] : 'key_' . $ind;
         $disabled = isset($groups['disabled']) && $groups['disabled'] ? 'tab-disabled' : '';
         $nav_items .= sprintf('<li><a class="%s" href="#%s"><i class="pl-icon pl-icon-%s"></i> %s</a></li>', $disabled, $key, $groups['icon'], $groups['title']);
     }
     if (!$nav_items) {
         return;
     }
     printf('<div class="pl-settings-nav-wrap"><ul class="pl-settings-nav">%s</ul>%s</div>', $nav_items, $this->get_save());
     printf('<div class="pl-tab-panel-container">');
     foreach ($this->current_tab_config['groups'] as $ind => $groups) {
         $key = isset($groups['key']) ? $groups['key'] : 'key_' . $ind;
         $disabled = isset($groups['disabled']) && $groups['disabled'] ? 'tab-disabled' : '';
         printf('<div id="%s" class="pl-tab-panel %s">', $key, $disabled);
         printf('<h3 class="pl-panel-header"><i class="pl-icon pl-icon-%s"></i>%s</h3>', $groups['icon'], $groups['title']);
         if (isset($groups['desc'])) {
             printf('<div class="pl-panel-description">%s</div>', $groups['desc']);
         }
         foreach ($groups['opts'] as $o) {
             $option_engine->option_engine($o);
         }
         echo '</div>';
     }
     echo '</div></div>';
     echo '<div class="clear"></div></div>';
     if ('settings' == $this->set['render']) {
         echo '</form>';
     }
 }
Exemplo n.º 2
0
function pl_create_form($config)
{
    $config = wp_parse_args($config, array('auth' => true, 'perm' => 'read', 'auth_fail' => __("You don't have the account permissions to do this.", 'pl-platform'), 'msg_sent' => __('The form was submitted. Thank you!', 'pl-platform')));
    $engine = new PL_Form_Engine($config);
    $title = !empty($config['title']) ? sprintf('<h3 class="pl-standard-form-title">%s</h3>', $config['title']) : '';
    $submit = !empty($config['submit']) ? $config['submit'] : 'Submit';
    ?>
  
  <form class="pl-standard-form" data-state="form" action="#" method="post" data-callback="<?php 
    echo $config['callback'];
    ?>
">

    <div class="pl-form-sending pl-banner">
      <i class="pl-icon pl-icon-cog pl-icon-spin"></i>
    </div>
    <div class="pl-form-sent pl-banner">
      <div clas=s="pl-form-sent-message"><?php 
    echo $config['msg_sent'];
    ?>
</div>
    </div>
    <div class="pl-form">

<?php 
    if ($config['auth'] && (!is_user_logged_in() || !current_user_can($config['perm']))) {
        printf('<div class="pl-banner">%s</div>', $config['auth_fail']);
    } else {
        echo $title;
        foreach ($config['opts'] as $o) {
            $engine->option_engine($o);
        }
        ?>
      <input type="submit" class="pl-btn pl-btn-primary" value="<?php 
        echo $submit;
        ?>
" />
<?php 
    }
    ?>


    </div>
  </form>
  
  <?php 
}