Dotclear

Changeset 3340:30cec05f4e63


Ignore:
Timestamp:
09/09/16 13:30:35 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

PHP 5.3+ : (expr1 ? expr1 : expr2) may be written → (expr1 ?: expr2)

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • admin/categories.php

    r3210 r3340  
    4747          $mov_cat = (int) $_POST['mov_cat'][$cat_id]; 
    4848 
    49           $mov_cat = $mov_cat ? $mov_cat : null; 
     49          $mov_cat = $mov_cat ?: null; 
    5050          if ($mov_cat !== null) { 
    5151               $c = $core->blog->getCategory($mov_cat); 
  • admin/media.php

    r3325 r3340  
    3535 
    3636$page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1; 
    37 $nb_per_page = ((integer) $core->auth->user_prefs->interface->media_by_page ? (integer) $core->auth->user_prefs->interface->media_by_page : 30); 
     37$nb_per_page = ((integer) $core->auth->user_prefs->interface->media_by_page ?: 30); 
    3838 
    3939# We are on home not comming from media manager 
     
    161161               $zip->addDirectory($core->media->root.'/'.$d,'',true); 
    162162 
    163                header('Content-Disposition: attachment;filename='.date('Y-m-d').'-'.$core->blog->id.'-'.($d ? $d : 'media').'.zip'); 
     163               header('Content-Disposition: attachment;filename='.date('Y-m-d').'-'.$core->blog->id.'-'.($d ?: 'media').'.zip'); 
    164164               header('Content-Type: application/x-zip'); 
    165165               $zip->write(); 
  • admin/post.php

    r3209 r3340  
    272272 
    273273     $cur->post_title = $post_title; 
    274      $cur->cat_id = ($cat_id ? $cat_id : null); 
     274     $cur->cat_id = ($cat_id ?: null); 
    275275     $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    276276     $cur->post_format = $post_format; 
  • admin/preferences.php

    r3333 r3340  
    4747$user_ui_iconset = @$core->auth->user_prefs->interface->iconset; 
    4848$user_ui_nofavmenu = $core->auth->user_prefs->interface->nofavmenu; 
    49 $user_ui_media_by_page = ($core->auth->user_prefs->interface->media_by_page ? $core->auth->user_prefs->interface->media_by_page : 30); 
     49$user_ui_media_by_page = ($core->auth->user_prefs->interface->media_by_page ?: 30); 
    5050$user_ui_media_nb_last_dirs = $core->auth->user_prefs->interface->media_nb_last_dirs; 
    5151 
  • inc/admin/lib.dc.page.php

    r3326 r3340  
    106106               // Get directives from settings if exist, else set defaults 
    107107               $csp = new ArrayObject(array()); 
    108                $csp['default-src'] = $core->blog->settings->system->csp_admin_default ? $core->blog->settings->system->csp_admin_default : "'self'"; 
    109                $csp['script-src'] = $core->blog->settings->system->csp_admin_script ? $core->blog->settings->system->csp_admin_script : "'self' 'unsafe-inline' 'unsafe-eval'"; 
    110                $csp['style-src'] = $core->blog->settings->system->csp_admin_style ? $core->blog->settings->system->csp_admin_style : "'self' 'unsafe-inline'"; 
    111                $csp['img-src'] = $core->blog->settings->system->csp_admin_img ? $core->blog->settings->system->csp_admin_img : "'self' data: media.dotaddict.org"; 
     108               $csp['default-src'] = $core->blog->settings->system->csp_admin_default ?: "'self'"; 
     109               $csp['script-src'] = $core->blog->settings->system->csp_admin_script ?: "'self' 'unsafe-inline' 'unsafe-eval'"; 
     110               $csp['style-src'] = $core->blog->settings->system->csp_admin_style ?: "'self' 'unsafe-inline'"; 
     111               $csp['img-src'] = $core->blog->settings->system->csp_admin_img ?: "'self' data: media.dotaddict.org"; 
    112112 
    113113               # Cope with blog post preview (via public URL in iframe) 
     
    298298     { 
    299299          global $core; 
    300           $tag = (isset($n['divtag'])&& $n['divtag'])?'div':'p'; 
     300          $tag = (isset($n['divtag']) && $n['divtag']) ? 'div' : 'p'; 
    301301          $ts = ''; 
    302302          if (!isset($n['with_ts']) || ($n['with_ts'] == true)) { 
     
    442442     { 
    443443          global $core; 
    444           $with_home_link = isset($options['home_link'])?$options['home_link']:true; 
    445           $hl = isset($options['hl'])?$options['hl']:true; 
    446           $hl_pos = isset($options['hl_pos'])?$options['hl_pos']:-1; 
     444          $with_home_link = isset($options['home_link']) ? $options['home_link'] : true; 
     445          $hl = isset($options['hl']) ? $options['hl'] : true; 
     446          $hl_pos = isset($options['hl_pos']) ? $options['hl_pos'] : -1; 
    447447          // First item of array elements should be blog's name, System or Plugins 
    448448          $res = '<h2>'.($with_home_link ? 
  • inc/admin/lib.themeconfig.php

    r2660 r3340  
    7171 
    7272          // Eval font size in em (assume base font size in pixels equal to 16) 
    73           if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$size,$m)) { 
     73          if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex|rem)?$/',$size,$m)) { 
    7474               if (empty($m[2])) { 
    7575                    $m[2] = 'em'; 
     
    144144     public static function adjustFontSize($s) 
    145145     { 
    146           if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$s,$m)) { 
     146          if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex|rem)?$/',$s,$m)) { 
    147147               if (empty($m[2])) { 
    148148                    $m[2] = 'em'; 
  • inc/core/class.dc.auth.php

    r3298 r3340  
    217217          # Check here for user and IP address 
    218218          $this->checkUser($_SESSION['sess_user_id']); 
    219           $uid = $uid ? $uid : http::browserUID(DC_MASTER_KEY); 
     219          $uid = $uid ?: http::browserUID(DC_MASTER_KEY); 
    220220 
    221221          $user_can_log = $this->userID() !== null && $uid == $_SESSION['sess_browser_uid']; 
  • inc/core/class.dc.blog.php

    r3263 r3340  
    15061506          $cur = $this->con->openCursor($this->prefix.'post'); 
    15071507 
    1508           $cur->cat_id = ($cat_id ? $cat_id : null); 
     1508          $cur->cat_id = ($cat_id ?: null); 
    15091509          $cur->post_upddt = date('Y-m-d H:i:s'); 
    15101510 
     
    15301530          $cur = $this->con->openCursor($this->prefix.'post'); 
    15311531 
    1532           $cur->cat_id = ($new_cat_id ? $new_cat_id : null); 
     1532          $cur->cat_id = ($new_cat_id ?: null); 
    15331533          $cur->post_upddt = date('Y-m-d H:i:s'); 
    15341534 
  • inc/core/class.dc.media.php

    r3299 r3340  
    393393          } 
    394394 
    395           $media_dir = $this->relpwd ? $this->relpwd : '.'; 
     395          $media_dir = $this->relpwd ?: '.'; 
    396396 
    397397          $strReq = 
     
    660660     protected function rebuildDB($pwd) 
    661661     { 
    662           $media_dir = $pwd ? $pwd : '.'; 
     662          $media_dir = $pwd ?: '.'; 
    663663 
    664664          $strReq = 
     
    919919     public function getDBDirs() 
    920920     { 
    921           $media_dir = $this->relpwd ? $this->relpwd : '.'; 
     921          $media_dir = $this->relpwd ?: '.'; 
    922922 
    923923          $strReq = 
  • inc/core/class.dc.trackback.php

    r2674 r3340  
    171171          $comment = 
    172172          "<!-- TB -->\n". 
    173           '<p><strong>'.($title ? $title : $blog_name)."</strong></p>\n". 
     173          '<p><strong>'.($title ?: $blog_name)."</strong></p>\n". 
    174174          '<p>'.$excerpt.'</p>'; 
    175175 
  • plugins/blowupConfig/index.php

    r2849 r3340  
    318318     '<h5 class="pretty-title">'.__('Top image').'</h5>'. 
    319319     '<p class="field"><label for="top_image">'.__('Top image').'</label> '. 
    320      form::combo('top_image',$top_images,($blowup_user['top_image'] ? $blowup_user['top_image'] : 'default')).'</p>'. 
     320     form::combo('top_image',$top_images,($blowup_user['top_image'] ?: 'default')).'</p>'. 
    321321     '<p>'.__('Choose "Custom..." to upload your own image.').'</p>'. 
    322322 
  • plugins/importExport/inc/class.dc.import.feed.php

    r3269 r3340  
    144144               $cur->clean(); 
    145145               $cur->user_id = $this->core->auth->userID(); 
    146                $cur->post_content = $item->content ? $item->content : $item->description; 
    147                $cur->post_title = $item->title ? $item->title : text::cutString(html::clean($cur->post_content),60); 
     146               $cur->post_content = $item->content ?: $item->description; 
     147               $cur->post_title = $item->title ?: text::cutString(html::clean($cur->post_content),60); 
    148148               $cur->post_format = 'xhtml'; 
    149149               $cur->post_status = -2; 
  • plugins/importExport/inc/class.dc.import.wp.php

    r2566 r3340  
    658658          } 
    659659          $cur->post_type         = $rs->post_type; 
    660           $cur->post_password     = $rs->post_password ? $rs->post_password : NULL; 
     660          $cur->post_password     = $rs->post_password ?: NULL; 
    661661          $cur->post_open_comment = $rs->comment_status == 'open' ? 1 : 0; 
    662662          $cur->post_open_tb      = $rs->ping_status == 'open' ? 1 : 0; 
  • plugins/maintenance/_admin.php

    r3324 r3340  
    277277                    } 
    278278                    if (!empty($res_task)) { 
    279                          $desc = $group_obj->description ? $group_obj->description : $group_obj->summary; 
     279                         $desc = $group_obj->description ?: $group_obj->summary; 
    280280 
    281281                         $res_group .= 
     
    286286               } 
    287287               if (!empty($res_group)) { 
    288                     $desc = $tab_obj->description ? $tab_obj->description : $tab_obj->summary; 
     288                    $desc = $tab_obj->description ?: $tab_obj->summary; 
    289289 
    290290                    $res_tab .= 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.indexcomments.php

    r2566 r3340  
    3535          $this->code = $this->core->indexAllComments($this->code, $this->limit); 
    3636 
    37           return $this->code ? $this->code : true; 
     37          return $this->code ?: true; 
    3838     } 
    3939 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.indexposts.php

    r2044 r3340  
    3535          $this->code = $this->core->indexAllPosts($this->code, $this->limit); 
    3636 
    37           return $this->code ? $this->code : true; 
     37          return $this->code ?: true; 
    3838     } 
    3939 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.synchpostsmeta.php

    r2044 r3340  
    3535          $this->code = $this->synchronizeAllPostsmeta($this->code, $this->limit); 
    3636 
    37           return $this->code ? $this->code : true; 
     37          return $this->code ?: true; 
    3838     } 
    3939 
Note: See TracChangeset for help on using the changeset viewer.

Sites map