Changeset 985
- Timestamp:
- 08/26/08 23:45:41 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/StyleCatcher-2.1-dev/plugins/StyleCatcher/lib/StyleCatcher/CMS.pm
r984 r985 151 151 or return; 152 152 153 # Break up the css url in to a couple useful pieces154 153 my @url = split( /\//, $url ); 155 156 my $theme_url = join(q{/}, @url[0..-2]) . '/'; 157 my ($basename, $extension) = split( /\./, $url[-1] ); 154 my $stylesheet_filename = pop @url; 155 my $theme_url = join(q{/}, @url) . '/'; 156 157 my ($basename, $extension) = split /\./, $stylesheet_filename; 158 158 if ($basename eq 'screen' || $basename eq 'style') { 159 $basename = $url[- 2];159 $basename = $url[-1]; 160 160 } 161 161 … … 168 168 $stylesheet =~ s!/\*.*?\*/!!gs; # strip all comments first 169 169 my @images = $stylesheet =~ m{ 170 \b url\( \s* # opening url() reference171 ( [\w\.- ]+\.(?:gif|jpe?g|png) ) # a filename ending in an image extension172 \s* \) # close of url() reference170 \b url\( \s* # opening url() reference 171 ( [\w\.-/]+\.(?:gif|jpe?g|png) ) # a filename ending in an image extension 172 \s* \) # close of url() reference 173 173 }xmsgi; 174 174 … … 198 198 my $canon_rel_url = URI->new($rel_url)->rel($theme_url); 199 199 my @image_path = split /\//, $canon_rel_url->as_string(); 200 my $image_filename = File::Spec->catfile($theme_path, @image_path); 201 $filemgr->put_data($res->content, $image_filename, 'upload') 200 my $image_filename = pop @image_path; 201 202 my $image_path = File::Spec->catdir($theme_path, @image_path); 203 if (!$filemgr->exists($image_path) && !$filemgr->mkpath($image_path)) { 204 my $error = $app->translate("Could not create [_1] folder - Check that your 'themes' folder is webserver-writable.", 205 $basename); 206 return $app->json_error($error); 207 } 208 209 my $image_full_path = File::Spec->catfile($image_path, $image_filename); 210 $filemgr->put_data($res->content, $image_full_path, 'upload') 202 211 or return $app->json_error( $filemgr->errstr ); 203 212 }
