Dotclear


Ignore:
Timestamp:
02/15/18 13:06:24 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/popup_posts.php

    r3701 r3702  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212 
    13 require dirname(__FILE__).'/../inc/admin/prepend.php'; 
     13require dirname(__FILE__) . '/../inc/admin/prepend.php'; 
    1414 
    1515dcPage::check('usage,contentadmin'); 
    1616 
    17 $q = !empty($_GET['q']) ? $_GET['q'] : null; 
     17$q         = !empty($_GET['q']) ? $_GET['q'] : null; 
    1818$plugin_id = !empty($_GET['plugin_id']) ? html::sanitizeURL($_GET['plugin_id']) : ''; 
    1919 
    20 $page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1; 
    21 $nb_per_page =  10; 
     20$page        = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1; 
     21$nb_per_page = 10; 
    2222 
    2323$type = !empty($_GET['type']) ? $_GET['type'] : null; 
     
    2525$post_types = $core->getPostTypes(); 
    2626foreach ($post_types as $k => $v) { 
    27      $type_combo[__($k)] = (string) $k; 
     27    $type_combo[__($k)] = (string) $k; 
    2828} 
    2929if (!in_array($type, $type_combo)) { 
    30      $type = null; 
     30    $type = null; 
    3131} 
    3232 
    33 $params = array(); 
    34 $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); 
     33$params               = array(); 
     34$params['limit']      = array((($page - 1) * $nb_per_page), $nb_per_page); 
    3535$params['no_content'] = true; 
    36 $params['order'] = 'post_dt DESC'; 
     36$params['order']      = 'post_dt DESC'; 
    3737 
    3838if ($q) { 
    39      $params['search'] = $q; 
     39    $params['search'] = $q; 
    4040} 
    4141 
    4242if ($type) { 
    43      $params['post_type'] = $type; 
     43    $params['post_type'] = $type; 
    4444} 
    4545 
    4646dcPage::openPopup(__('Add a link to an entry'), 
    47      dcPage::jsLoad('js/_posts_list.js'). 
    48     dcPage::jsLoad('js/_popup_posts.js'). 
    49      $core->callBehavior('adminPopupPosts', $plugin_id)); 
     47    dcPage::jsLoad('js/_posts_list.js') . 
     48    dcPage::jsLoad('js/_popup_posts.js') . 
     49    $core->callBehavior('adminPopupPosts', $plugin_id)); 
    5050 
    51 echo '<h2 class="page-title">'.__('Add a link to an entry').'</h2>'; 
     51echo '<h2 class="page-title">' . __('Add a link to an entry') . '</h2>'; 
    5252 
    53 echo '<form action="'.$core->adminurl->get('admin.popup_posts').'" method="get">'. 
    54      '<p><label for="type" class="classic">'.__('Entry type:').'</label> '.form::combo('type',$type_combo,$type).''. 
    55      '<noscript><div><input type="submit" value="'.__('Ok').'" /></div></noscript>'. 
    56      form::hidden('plugin_id',html::escapeHTML($plugin_id)).'</p>'. 
    57      '</form>'; 
     53echo '<form action="' . $core->adminurl->get('admin.popup_posts') . '" method="get">' . 
     54'<p><label for="type" class="classic">' . __('Entry type:') . '</label> ' . form::combo('type', $type_combo, $type) . '' . 
     55'<noscript><div><input type="submit" value="' . __('Ok') . '" /></div></noscript>' . 
     56form::hidden('plugin_id', html::escapeHTML($plugin_id)) . '</p>' . 
     57    '</form>'; 
    5858 
    59 echo '<form action="'.$core->adminurl->get('admin.popup_posts').'" method="get">'. 
    60      '<p><label for="q" class="classic">'.__('Search entry:').'</label> '.form::field('q',30,255,html::escapeHTML($q)). 
    61      ' <input type="submit" value="'.__('Search').'" />'. 
    62      form::hidden('plugin_id',html::escapeHTML($plugin_id)). 
    63      form::hidden('type',html::escapeHTML($type)). 
    64      '</p></form>'; 
     59echo '<form action="' . $core->adminurl->get('admin.popup_posts') . '" method="get">' . 
     60'<p><label for="q" class="classic">' . __('Search entry:') . '</label> ' . form::field('q', 30, 255, html::escapeHTML($q)) . 
     61' <input type="submit" value="' . __('Search') . '" />' . 
     62form::hidden('plugin_id', html::escapeHTML($plugin_id)) . 
     63form::hidden('type', html::escapeHTML($type)) . 
     64    '</p></form>'; 
    6565 
    6666try { 
    67      $posts = $core->blog->getPosts($params); 
    68      $counter = $core->blog->getPosts($params,true); 
    69      $post_list = new adminPostMiniList($core,$posts,$counter->f(0)); 
     67    $posts    = $core->blog->getPosts($params); 
     68    $counter   = $core->blog->getPosts($params, true); 
     69    $post_list = new adminPostMiniList($core, $posts, $counter->f(0)); 
    7070} catch (Exception $e) { 
    71      $core->error->add($e->getMessage()); 
     71    $core->error->add($e->getMessage()); 
    7272} 
    7373 
    7474echo '<div id="form-entries">'; # I know it's not a form but we just need the ID 
    75 $post_list->display($page,$nb_per_page); 
     75$post_list->display($page, $nb_per_page); 
    7676echo '</div>'; 
    7777 
    78 echo '<p><button type="button" id="link-insert-cancel">'.__('cancel').'</button></p>'; 
     78echo '<p><button type="button" id="link-insert-cancel">' . __('cancel') . '</button></p>'; 
    7979 
    8080dcPage::closePopup(); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map