-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a method to remove an aside from any resource
- Loading branch information
Romain
committed
Aug 12, 2011
1 parent
065c232
commit 9421d4b
Showing
7 changed files
with
117 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Asides | ||
* | ||
* Copyright 2011 by Romain Tripault // Melting Media <[email protected]> | ||
* | ||
* Asides is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU General Public License as published by the Free Software | ||
* Foundation; either version 2 of the License, or (at your option) any later | ||
* version. | ||
* | ||
* Asides is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* Asides; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
* Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* @package asides | ||
*/ | ||
/** | ||
* Remove an aside chunk from any resource (clears its name from the aside TV). | ||
* | ||
* @package asides | ||
* @subpackage processors | ||
*/ | ||
|
||
$Asides = $modx->getService('asides','Asides',$modx->getOption('asides.core_path',null,$modx->getOption('core_path').'components/asides/').'model/asides/',$scriptProperties); | ||
if (!($Asides instanceof Asides)) return ''; | ||
|
||
if (empty($scriptProperties['id'])) return $modx->error->failure($modx->lexicon('asides.aside_err_ns')); | ||
$aside = $modx->getObject('modChunk',$scriptProperties['id']); | ||
if (!$aside) return $modx->error->failure($modx->lexicon('asides.aside_err_nf')); | ||
|
||
// grabs the resources where this aside is | ||
$resources = $Asides->inResource($aside); | ||
if (!$resources) { | ||
return $modx->error->failure($modx->lexicon('asides.aside_err_remove_not_in_use')); | ||
} | ||
$Asides->cleanAside($aside->get('name'), $resources); | ||
|
||
// output | ||
return $modx->error->success('',$aside); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters