[pLog-svn] r3568 - in plog/trunk/class: action/admin template

Jon Daley plogworld at jon.limedaley.com
Tue Jun 13 19:25:52 GMT 2006


 	You should add a "^" or whatever the start-of-line character is to 
your regexp, so it doesn't strip out the number in some other part of the 
name.

On Tue, 13 Jun 2006, mark at devel.lifetype.net wrote:

> Author: mark
> Date: 2006-06-13 17:56:11 +0000 (Tue, 13 Jun 2006)
> New Revision: 3568
>
> Modified:
>   plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php
>   plog/trunk/class/action/admin/adminaddtemplateaction.class.php
>   plog/trunk/class/template/templatesandbox.class.php
> Log:
> Fixed bug http://bugs.lifetype.net/view.php?id=797
>
> Modified: plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php
> ===================================================================
> --- plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php	2006-06-09 08:22:08 UTC (rev 3567)
> +++ plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php	2006-06-13 17:56:11 UTC (rev 3568)
> @@ -120,8 +120,7 @@
>
>             // if the template set was installed ok in the template folder, we can record
>             // it as a valid set
> -            $fileParts = explode( ".", $upload->getFileName());
> -            $templateName = $fileParts[0];
> +			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );
>             $ts->addTemplate( $templateName, $this->_blogInfo->getId());
>
>             // remove the file
>
> Modified: plog/trunk/class/action/admin/adminaddtemplateaction.class.php
> ===================================================================
> --- plog/trunk/class/action/admin/adminaddtemplateaction.class.php	2006-06-09 08:22:08 UTC (rev 3567)
> +++ plog/trunk/class/action/admin/adminaddtemplateaction.class.php	2006-06-13 17:56:11 UTC (rev 3568)
> @@ -119,8 +119,7 @@
>             // if the template set was installed ok in the template folder, we can record
>             // it as a valid set
>             $ts = new TemplateSetStorage();
> -            $fileParts = explode( ".", $upload->getFileName());
> -            $templateName = $fileParts[0];
> +			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );
>             $ts->addTemplate( $templateName );
>
>             $this->_view = new AdminSiteTemplatesListView( $this->_blogInfo );
>
> Modified: plog/trunk/class/template/templatesandbox.class.php
> ===================================================================
> --- plog/trunk/class/template/templatesandbox.class.php	2006-06-09 08:22:08 UTC (rev 3567)
> +++ plog/trunk/class/template/templatesandbox.class.php	2006-06-13 17:56:11 UTC (rev 3568)
> @@ -94,8 +94,7 @@
>
>             // if the file was correctly unpacked, now we will need the TemplateSetValidator
>             // class to do some work for us
> -            $fileNameParts = explode( '.', $file );
> -            $fileNameNoExt = $fileNameParts[0];
> +            $fileNameNoExt = $this->toTemplateSetName( $file );
>
>             // we can use the checkTenmplateFolder which will do all the rest of
>             // the work for us...
> @@ -158,5 +157,19 @@
>
>             return true;
>         }
> +
> +		/**
> +		 * Convert the upload file name to template set name
> +		 *
> +		 * @param $uploadFile The name of the upload file
> +		 * @return Return the template set name
> +		 */
> +		function toTemplateSetName( $uploadFile )
> +		{
> +            $fileWithoutVersion = preg_replace( '/[0-1]\.[0-9.]*_/', '', $uploadFile );
> +            $fileParts = explode( ".", $fileWithoutVersion );
> +            $templateName = $fileParts[0];
> +            return $templateName;
> +		}
>     }
> ?>
> \ No newline at end of file
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>

**************************************
Jon Daley
http://jon.limedaley.com/

Inanimate objects are classified scientifically into
three major categories: those that don't work, those
that break down, and those that get lost.
-- Russell Baker


More information about the pLog-svn mailing list