Beispiel #1
0
 /**
  * Utility function to read the folders in a folder.
  * @author Howard <*****@*****.**>
  * @param string $path
  * @param string $filter
  * @param int $recurse
  * @param boolean $full
  * @param array $exclude
  * @param array $excludefilter
  * @return mixed
  */
 public static function folders($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludefilter = array('^\\..*'))
 {
     // Check to make sure the path valid and clean
     $path = wpl_path::clean($path);
     // Is the path a folder?
     if (!is_dir($path)) {
         return false;
     }
     // Compute the excludefilter string
     if (count($excludefilter)) {
         $excludefilter_string = '/(' . implode('|', $excludefilter) . ')/';
     } else {
         $excludefilter_string = '';
     }
     // Get the folders
     $arr = self::_items($path, $filter, $recurse, $full, $exclude, $excludefilter_string, false);
     // Sort the folders
     asort($arr);
     return array_values($arr);
 }
Beispiel #2
0
 /**
  * Wrapper for the standard file_exists function
  * @author Howard <*****@*****.**>
  * @param string $file
  * @return boolean
  */
 public static function exists($file)
 {
     return is_file(wpl_path::clean($file));
 }
Beispiel #3
0
 /**
  * Check
  * @author Howard <*****@*****.**>
  * @param string $path
  * @param string $ds
  * @return string
  */
 public static function check($path, $ds = DIRECTORY_SEPARATOR)
 {
     $path = wpl_path::clean($path);
     return $path;
 }
Beispiel #4
0
 /**
  * Imports a language file
  * @author Howard <*****@*****.**>
  * @return void
  */
 public function import_language()
 {
     $locale = apply_filters('plugin_locale', get_locale(), WPL_TEXTDOMAIN);
     $overriden_language_filepath = WP_LANG_DIR . DS . WPL_BASENAME . DS . WPL_TEXTDOMAIN . '-' . $locale . '.mo';
     $overriden_language_filepath = wpl_path::clean($overriden_language_filepath);
     /** check if the language file is overridden **/
     if (wpl_file::exists($overriden_language_filepath)) {
         load_textdomain(WPL_TEXTDOMAIN, WP_LANG_DIR . DS . WPL_BASENAME . DS . WPL_TEXTDOMAIN . '-' . $locale . '.mo');
     } else {
         load_plugin_textdomain(WPL_TEXTDOMAIN, false, WPL_BASENAME . DS . 'languages');
     }
 }