Skip to content
Browse files

updates from Ben McClure applied and merged

  • Loading branch information...
2 parents 31948f4 + 7c9d611 commit d0b2ab8a2e98aa874781221abc3303d3e62c8b32 @sams committed Apr 11, 2012
View
153 Config/bootstrap.php
@@ -94,155 +94,4 @@
* define('MEDIA_TRANSFER_URL', false);
* }}}
*/
-if (!defined('MEDIA') && (basename($_SERVER['SCRIPT_NAME']) !== 'test.php')) {
- define('MEDIA', WWW_ROOT . 'media' . DS);
-} elseif(!defined('MEDIA') && (basename($_SERVER['SCRIPT_NAME']) == 'test.php')) {
- define('MEDIA', TMP . 'tests' . DS);
-}
-if (!defined('MEDIA_STATIC')) {
- define('MEDIA_STATIC', MEDIA . 'static' . DS);
-}
-if (!defined('MEDIA_FILTER')) {
- define('MEDIA_FILTER', MEDIA . 'filter' . DS);
-}
-if (!defined('MEDIA_TRANSFER')) {
- define('MEDIA_TRANSFER', MEDIA . 'transfer' . DS);
-}
-
-/**
- * URL paths
- *
- * Each constant is defined with a value which is
- * an (slash terminated) URL path fragment relative to your webroot.
- *
- * In case the corresponding directory isn't served use `false` as a value.
- */
-if (!defined('MEDIA_URL')) {
- define('MEDIA_URL', 'media/');
-}
-if (!defined('MEDIA_STATIC_URL')) {
- define('MEDIA_STATIC_URL', MEDIA_URL . 'static/');
-}
-if (!defined('MEDIA_FILTER_URL')) {
- define('MEDIA_FILTER_URL', MEDIA_URL . 'filter/');
-}
-if (!defined('MEDIA_TRANSFER_URL')) {
- define('MEDIA_TRANSFER_URL', MEDIA_URL . 'transfer/');
-}
-
-/*
- * Test for features on this system.
- */
-$hasFileinfo = extension_loaded('fileinfo');
-$hasImagick = extension_loaded('imagick');
-
-/*
- * Bootstrap the `mm` library. We are putting the library into the include path which
- * is expected (by the library) in order to be able to load classes.
- */
-$mm = dirname(dirname(__FILE__)) . DS . 'Lib' . DS . 'mm';
-
-if (strpos(ini_get('include_path'), $mm) === false) {
- ini_set('include_path', $mm.DS.'src'.PATH_SEPARATOR.ini_get('include_path'));
-}
-
-/**
- * Configure the MIME type detection. The detection class is two headed which means it
- * uses both a glob (for matching against file extensions) and a magic adapter (for
- * detecting the type from the content of files). Available `Glob` adapters are `Apache`,
- * `Freedesktop`, `Memory` and `Php`. These adapters are also available as a `Magic`
- * variant with the addtion of a `Fileinfo` magic adapter. Not all adapters require
- * a file to be passed along with the configuration.
- *
- * @see TransferBehavior
- * @see MetaBehavior
- * @see MediaHelper
- */
-require_once 'Mime/Type.php';
-
-if ($hasFileinfo) {
- Mime_Type::config('Magic', array(
- 'adapter' => 'Fileinfo'
- ));
-} else {
- Mime_Type::config('Magic', array(
- 'adapter' => 'Freedesktop',
- 'file' => $mm . DS . 'data' . DS . 'magic.db'
- ));
-}
-if ($cached = Cache::read('mime_type_glob')) {
- Mime_Type::config('Glob', array(
- 'adapter' => 'Memory'
- ));
- foreach ($cached as $item) {
- Mime_Type::$glob->register($item);
- }
-} else {
- Mime_Type::config('Glob', array(
- 'adapter' => 'Freedesktop',
- 'file' => $mm . DS . 'data' . DS . 'glob.db'
- ));
- Cache::write('mime_type_glob', Mime_Type::$glob->to('array'));
-}
-
-/**
- * Configure the adpters to be used by media process class. Adjust this
- * mapping of media names to adapters according to your environment. For example:
- * most PHP installations have GD enabled thus should choose the `Gd` adapter for
- * image transformations. However the `Imagick` adapter may be more desirable
- * in other cases and also supports transformations for documents.
- *
- * @see GeneratorBehavior
- */
-require_once 'Media/Process.php';
-
-Media_Process::config(array(
- // 'audio' => 'SoxShell',
- 'document' => $hasImagick ? 'Imagick' : null,
- 'image' => $hasImagick ? 'Imagick' : 'Gd',
- // 'video' => 'FfmpegShell'
-));
-
-/**
- * Configure the adpters to be used by media info class. Adjust this
- * mapping of media names to adapters according to your environment. In contrast
- * to `Media_Proces` which operates only with one adapter per media type
- * `Media_Info` can use multiple adapter per media type.
- *
- * @see MetaBehavior
- */
-require_once 'Media/Info.php';
-
-Media_Info::config(array(
- 'audio' => array('NewWave'),
- 'document' => $hasImagick ? array('Imagick') : array(),
- 'image' => $hasImagick ? array('ImageBasic', 'Imagick') : array('ImageBasic'),
- //'video' => array()
-));
-
-/**
- * Filters and versions
- *
- * For each media type a set of filters keyed by version name is configured.
- * A filter is a set of instructions which are processed by the Media_Process class.
- *
- * For more information on available methods see the classes
- * located in `libs/mm/src/Media/Process`.
- *
- * @see GeneratorBehavior
- */
-// $sRGB = $mm . DS . 'data' . DS . 'sRGB_IEC61966-2-1_black_scaled.icc';
-
-$s = array('convert' => 'image/png', 'zoomCrop' => array(100, 100));
-$m = array('convert' => 'image/png', 'fitCrop' => array(300, 300));
-$l = array('convert' => 'image/png', 'fit' => array(600, 440));
-
-Configure::write('Media.filter', array('default' => array(
- 'audio' => compact('s', 'm'),
- 'document' => compact('s', 'm'),
- 'generic' => array(),
- 'image' => compact('s', 'm', 'l'),
- 'video' => compact('s', 'm')
-)));
-
-?>
+?>
View
3 Console/Command/MediaShell.php
@@ -19,6 +19,7 @@
App::uses('Shell', 'Console');
App::uses('ConnectionManager', 'Model');
require_once(dirname(dirname(dirname(__FILE__))) . DS . 'Config' . DS.'bootstrap.php');
+require_once(dirname(dirname(dirname(__FILE__))) . DS . 'Config' . DS. 'core.php');
App::uses('Folder', 'Utility');
Configure::write('Cache.disable', true);
@@ -288,4 +289,4 @@ function progress($value, $text = null) {
}
}
}
-?>
+?>
View
4 README.markdown
@@ -19,9 +19,9 @@
``git submodule add https://aeolu@github.com/aeolu/CakePHP-Media-Plugin.git Plugin/Media``
3. Load the plugin.
<pre>
- ``//Within you bootstrap.php``
+ ``//Within your bootstrap.php``
``CakePlugin::load('Media');``
- ``require_once APP . 'Plugin/Media/config/core.php';``
+ ``require APP . 'Plugin' . DS . 'Media' . DS . 'Config' . DS . 'core.php';``
</pre>
4. Initialize Media files.
``cake Media.Media init``
View
3 Test/Case/Model/AttachmentTest.php
@@ -28,6 +28,7 @@
trigger_error('MEDIA constant already defined and not pointing to tests directory.', E_USER_ERROR);
}
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DS . 'Config' . DS . 'bootstrap.php';
+require_once dirname(dirname(dirname(dirname(__FILE__)))) . DS . 'Config' . DS . 'core.php';
require_once 'Media/Process.php';
require_once 'Media/Info.php';
@@ -288,4 +289,4 @@ function _model($assocType, $assoc = null) {
return $Model;
}
}
-?>
+?>
View
5 Test/Case/Model/Behavior/BaseBehaviorTest.php
@@ -27,6 +27,9 @@
trigger_error('MEDIA constant already defined and not pointing to tests directory.', E_USER_ERROR);
}
require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DS . 'Config' . DS . 'bootstrap.php';
+require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DS . 'Config' . DS . 'core.php';
+
+SimpleTest::ignore('BaseBehaviorTestCase');
/**
* Base Behavior Test Case Class
@@ -78,4 +81,4 @@ function tearDown() {
}
}
-?>
+?>
View
3 Test/Case/View/Helper/MediaHelperTest.php
@@ -25,6 +25,7 @@
}
require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DS . 'Config' . DS . 'bootstrap.php';
+require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DS . 'Config' . DS . 'core.php';
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DS . 'Fixture' . DS . 'test_data.php';
//App::import('Core', array('Helper', 'AppHelper', 'ClassRegistry'));
@@ -202,4 +203,4 @@ function testSize() {
}
}
-?>
+?>
View
14 docs/TUTORIAL
@@ -14,9 +14,9 @@ application's plugins directory.
$ git clone git://github.com/davidpersson/media.git plugins/media
Now we go and load the configuration that comes with the plugin. Edit
-your app's config/core.php and add the following code.
+your app's Config/core.php and add the following code.
{{{
- require APP . '/plugins/media/config/core.php';
+ require APP . 'Plugin' . DS . 'Media' . DS . 'Config' . DS . 'core.php';
}}}
In order to initialize the directories for storing i.e. uploaded files
@@ -120,7 +120,7 @@ var $virtualFields = array(
Filtering Uploaded Files
------------------------
Most of this should Just Work(TM) as it is expected that you have a pretty
-default setup. Have a look at the plugin's config/core.php file on more options
+default setup. Have a look at the plugin's Config/core.php file on more options
to configure the Media_Process class which is used by the following behavior
class if something doesn't work the way expected here.
@@ -133,7 +133,7 @@ class Post extends AppModel {
}}}
As the generator behavior will make versions of the uploaded file according to
-configuration, we open up the plugin's config/core.php to have a look on the
+configuration, we open up the plugin's Config/core.php to have a look on the
defaults.
{{{
...
@@ -152,7 +152,7 @@ Configure::write('Media.filter', array(
This set of configurations is called instructions. Basically these are methods
which get called on the Media_Process_* class. However the defaults should work
fine for us. Keep in mind that if you'd like to change the defaults you should
-do so in your app's config/core.php right after the statement where you load
+do so in your app's Config/core.php right after the statement where you load
the plugin's configuration.
Repeat uploading the file as you did in prior steps. This time - assuming
@@ -171,7 +171,7 @@ user's can access any files they uploaded there. If you can't trust
the user's being able to upload stuff you better go with the following
steps:
- - Relocate the transfer directory. In your app's config/core.php add
+ - Relocate the transfer directory. In your app's Config/core.php add
following code right above the statement where you load the plugin
configuration.
{{{
@@ -183,7 +183,7 @@ steps:
$ cake/console/cake media init
- Block requests through the webserver's configuration. In your app's
- config/core.php add following code right above the statement where you load
+ Config/core.php add following code right above the statement where you load
the plugin configuration.
{{{
define('MEDIA_TRANSFER_URL', false);

0 comments on commit d0b2ab8

Please sign in to comment.
Something went wrong with that request. Please try again.