Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created November 12, 2012 23:06
Show Gist options
  • Select an option

  • Save objectivehtml/4062662 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/4062662 to your computer and use it in GitHub Desktop.
public function get_file_upload_groups()
{
if(!isset($this->session->cache['photo_frame']['upload_prefs']))
{
$groups = $this->db->get('upload_prefs')->result_array();
$this->session->set_cache('photo_frame', 'upload_prefs', $groups);
}
else
{
$groups = $this->EE->session->cache['photo_frame']['upload_prefs'];
}
return $this->channel_data->utility->reindex('id', $groups);
}
public function parse_file($string, $type = 'url')
{
$file_uploads = $this->get_file_upload_groups();
preg_match("/".LD."filedir_(\d*)".RD."/", $string, $matches);
$tag = $matches[0];
$id = $matches[1];
return str_replace($tag, $file_uploads[$id][$type], $string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment