Example #1
0
 public function valid()
 {
     if (!$this->has_archive()) {
         return false;
     }
     $template = $this->find_template();
     // no template available
     if (empty($template)) {
         return false;
     }
     // do not check if there are no fields assigned to current post
     // this check is not placed very well as it's out of class scope
     $check_fields_assigned = new Types_Helper_Condition_Type_Fields_Assigned();
     if (!$check_fields_assigned->valid()) {
         return false;
     }
     $file = new Toolset_Filesystem_File();
     // abort if file can't be found
     if (!$file->open($template)) {
         return false;
     }
     // check for fields, abort if there results in true
     if ($file->search('types_render_field')) {
         return false;
     }
     return true;
 }
Example #2
0
 public function valid()
 {
     // theme + theme integration running
     if (defined('LAYOUTS_INTEGRATION_THEME_NAME')) {
         return true;
     }
     $filesystem = new Toolset_Filesystem_File();
     foreach ($this->templates as $name => $file) {
         // file exists
         if ($filesystem->open(get_stylesheet_directory() . '/' . $file)) {
             // supports layouts
             if ($filesystem->search('the_ddlayout')) {
                 return true;
             }
             // if for example single.php exists and it does not support Layouts we don't need to look at index.php
             return false;
         }
     }
     // no file exists
     return false;
 }