} } // Get all template locations. Returns array of locations containing path and url function get_all_locations(){ $ds = DIRECTORY_SEPARATOR; $template_locations = array(); $template_locations[0] = array( 'path'=>$this->template_slider_dir, //this resides in the plugin 'url'=>$this->plugin_url.'templates/' ); $template_locations[1] = array( 'path'=> realpath(get_stylesheet_directory())."{$ds}cycloneslider{$ds}",//this resides in the current theme or child theme 'url'=> get_stylesheet_directory_uri()."/cycloneslider/" ); return $template_locations; } // Get all templates from all locations. Returns array of templates with keys as name containing array of path and url function get_all_templates(){ $template_locations = $this->get_all_locations(); $template_folders = array(); foreach($template_locations as $location){ if($files = @scandir($location['path'])){ $c = 0; foreach($files as $name){ if($name!='.' and $name!='..' and is_dir($location['path'].$name)){ $name = sanitize_title($name);//change space to dash and all lowercase $template_folders[$name] = array( //here we override template of the same names. templates inside themes take precedence 'path'=>$location['path'].$name, 'url'=>$location['url'].$name, ); } } } } return $template_folders; } } // end class endif;