Plugin Directory

Changeset 998050


Ignore:
Timestamp:
09/28/2014 05:09:47 PM (12 years ago)
Author:
loumray
Message:

adjust PSR-2 standard

Location:
remote-medias-lite/trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • remote-medias-lite/trunk/autoload.php

    r992903 r998050  
    44class PluginAutoloader
    55{
    6   private static $loader;
     6    private static $loader;
    77
    8   public static function getLoader()
    9   {
    10     if (null !== self::$loader) {
    11       return self::$loader;
     8    public static function getLoader()
     9    {
     10        if (null !== self::$loader) {
     11            return self::$loader;
     12        }
     13
     14        $vendorDir = __DIR__.'/vendor';
     15
     16        if (!class_exists('\Composer\Autoload\ClassLoader')) {
     17            require $vendorDir . '/composer/ClassLoader.php';
     18        }
     19        $loaderClass = __NAMESPACE__.'\WPCore\WPpluginLoader';
     20        if (!class_exists($loaderClass)) {
     21            require $vendorDir.'/loumray/wpcore/src/WPpluginLoader.php';
     22        }
     23
     24        self::$loader = $loader = new $loaderClass;
     25
     26        $map = require $vendorDir . '/composer/autoload_namespaces.php';
     27        foreach ($map as $namespace => $path) {
     28            $loader->add(__NAMESPACE__.'\\'.$namespace, $path);
     29        }
     30
     31        $map = require $vendorDir . '/composer/autoload_psr4.php';
     32        foreach ($map as $namespace => $path) {
     33            //If namespace already start with wrapper namespace
     34            if (strpos($namespace, __NAMESPACE__) === 0) {
     35                $loader->addPsr4($namespace, $path);
     36            } else {
     37                $loader->addPsr4(__NAMESPACE__.'\\'.$namespace, $path);
     38            }
     39        }
     40
     41        $classMap = require $vendorDir . '/composer/autoload_classmap.php';
     42        if ($classMap) {
     43            $loader->addClassMap($classMap);
     44        }
     45        $loader->register(true);
     46
     47        return $loader;
    1248    }
    13 
    14     $vendorDir = __DIR__.'/vendor';
    15     $baseDir   = __DIR__;
    16 
    17     if(!class_exists('\Composer\Autoload\ClassLoader'))
    18     {
    19         require $vendorDir . '/composer/ClassLoader.php';
    20     }
    21     $loaderClass = __NAMESPACE__.'\WPCore\WPpluginLoader';
    22     if(!class_exists($loaderClass))
    23     {
    24       require $vendorDir.'/loumray/wpcore/src/WPpluginLoader.php';
    25     }
    26 
    27     self::$loader = $loader = new $loaderClass;
    28 
    29     $map = require $vendorDir . '/composer/autoload_namespaces.php';
    30     foreach ($map as $namespace => $path) {
    31         $loader->add(__NAMESPACE__.'\\'.$namespace, $path);
    32     }
    33 
    34     $map = require $vendorDir . '/composer/autoload_psr4.php';
    35     foreach ($map as $namespace => $path) {
    36         //If namespace already start with wrapper namespace
    37         if (strpos($namespace, __NAMESPACE__) === 0) {
    38             $loader->addPsr4($namespace, $path);
    39         } else {
    40             $loader->addPsr4(__NAMESPACE__.'\\'.$namespace, $path);
    41         }
    42     }
    43 
    44     $classMap = require $vendorDir . '/composer/autoload_classmap.php';
    45     if ($classMap) {
    46         $loader->addClassMap($classMap);
    47     }
    48     $loader->register(true);
    49 
    50     return $loader;
    51   }
    5249}
    5350return PluginAutoloader::getLoader();
    54 
  • remote-medias-lite/trunk/src/RemoteMediaExt/AccountPostType.php

    r997433 r998050  
    5454    }
    5555
    56     public function addPostUpdateMsgParam($link) {
     56    public function addPostUpdateMsgParam($link)
     57    {
    5758        $params = array();
    58         if(isset($_REQUEST['rmlmsg'])) {
     59        if (isset($_REQUEST['rmlmsg'])) {
    5960            $params['rmlmsg'] = absint($_REQUEST['rmlmsg']);
    6061        }
     
    7071        $messages[$this->getSlug()] = array(
    7172            0  => '', // Unused. Messages start at index 1.
    72             1  => __( 'Remote library settings updated.', 'remote-medias-lite' ),
    73             4  => __( 'Remote library settings updated.', 'remote-medias-lite' ),
     73            1  => __('Remote library settings updated.', 'remote-medias-lite'),
     74            4  => __('Remote library settings updated.', 'remote-medias-lite'),
    7475            /* translators: %s: date and time of the revision */
    75             5  => isset( $_GET['revision'] ) ? sprintf( __( 'Remote library settings restored to revision from %s', 'remote-medias-lite' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    76             6  => __( 'Remote library settings published.', 'remote-medias-lite' ),
    77             7  => __( 'Remote library settings saved.', 'remote-medias-lite' ),
    78             8  => __( 'Remote library settings submitted.', 'remote-medias-lite' ),
     76            5  => isset( $_GET['revision'] ) ? sprintf(__('Remote library settings restored to revision from %s', 'remote-medias-lite'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
     77            6  => __('Remote library settings published.', 'remote-medias-lite'),
     78            7  => __('Remote library settings saved.', 'remote-medias-lite'),
     79            8  => __('Remote library settings submitted.', 'remote-medias-lite'),
    7980            9  => sprintf(
    80                 __( 'Remote library settings scheduled for: <strong>%1$s</strong>.', 'remote-medias-lite' ),
     81                __('Remote library settings scheduled for: <strong>%1$s</strong>.', 'remote-medias-lite'),
    8182                // translators: Publish box date format, see http://php.net/date
    82                 date_i18n( __( 'M j, Y @ G:i', 'remote-medias-lite' ), strtotime( $post->post_date ) )
     83                date_i18n(__('M j, Y @ G:i', 'remote-medias-lite'), strtotime($post->post_date))
    8384            ),
    84             10 => __( 'Remote library settings draft updated.', 'remote-medias-lite' )
     85            10 => __('Remote library settings draft updated.', 'remote-medias-lite')
    8586        );
    8687
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php

    r997433 r998050  
    1414    protected $service;
    1515
    16     public static function getType($id)
     16    public static function getType($aid)
    1717    {
    18         $type = get_post_meta($id,'remote_account_type', true);
     18        $type = get_post_meta($aid, 'remote_account_type', true);
    1919
    2020        if (empty($type)) {
     
    2424    }
    2525
    26     public function __construct($id = null, $type = null)
     26    public function __construct($aid = null, $type = null)
    2727    {
    28         $this->localID = (int)$id;
     28        $this->localID = (int)$aid;
    2929        $this->type    = $type;
    3030        $this->fetch();
     
    6767        $this->validate();
    6868
    69         $return = update_post_meta($this->localID,'remote_attr',$this->attributes);
    70         $return = update_post_meta($this->localID,'remote_account_type',$this->type) && $return;
     69        $return = update_post_meta($this->localID, 'remote_attr', $this->attributes);
     70        $return = update_post_meta($this->localID, 'remote_account_type', $this->type) && $return;
    7171
    7272        return $return;
     
    7676    {
    7777        $this->service = $service;
    78         if(!is_null($this->service)) {
     78        if (!is_null($this->service)) {
    7979            $this->service->setAccount($this);
    8080        }
     
    8787    }
    8888
    89     public function get($name) {
     89    public function get($name)
     90    {
    9091        if ($name === null) {
    9192            return $this->attributes;
     
    142143    public function validate()
    143144    {
    144       if (!($this->service instanceof AbstractRemoteService)) {
    145           return false;
    146       }
     145        if (!($this->service instanceof AbstractRemoteService)) {
     146            return false;
     147        }
    147148
    148       $return = array();
     149        $return = array();
     150        $return['validate'] = false;
     151       
     152        try {
     153            $return['validate'] = $this->service->validate($this);
     154        } catch (ClientErrorResponseException $e) {
     155            $return['error'] = true;
     156            $return['statuscode'] = $e->getResponse()->getStatusCode();
     157            $return['msg']        = $e->getResponse()->getReasonPhrase();
     158        } catch (\Exception $e) {
     159            $return['error'] = true;
     160            $return['statuscode'] = $e->getCode();
     161            $return['msg']        = $e->getMessage();
     162        }
    149163
    150       $response = array();
    151       $return['validate'] = false;
    152       try {
    153           $return['validate'] = $this->service->validate($this);
    154       } catch(ClientErrorResponseException $e) {
    155           $return['error'] = true;
    156           $return['statuscode'] = $e->getResponse()->getStatusCode();
    157           $return['msg']        = $e->getResponse()->getReasonPhrase();
    158       } catch(\Exception $e) {
    159           $return['error'] = true;
    160           $return['statuscode'] = $e->getCode();
    161           $return['msg']        = $e->getMessage();
    162       }
     164        $lastValidQuery = null;
    163165
    164       $lastValidQuery = null;
     166        if ($return['validate'] === true) {
     167            $lastValidQuery =  $this->get('remote_user_id');
     168            $this->set('isValid', true);
     169        } else {
     170            $this->set('isValid', false);
     171        }
    165172
    166       if ($return['validate'] === true) {
    167           $lastValidQuery =  $this->get('remote_user_id');
    168           $this->set('isValid', true);
    169       } else {
    170           $this->set('isValid', false);
    171       }
     173        $this->set('last_valid_query', $lastValidQuery);
    172174
    173       $this->set('last_valid_query', $lastValidQuery);
    174 
    175       return $return['validate'];
     175        return $return['validate'];
    176176    }
    177177}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/AbstractRemoteClient.php

    r992903 r998050  
    66abstract class AbstractRemoteClient extends Client
    77{
    8   /**
    9    * Factory method to create a new RemoteClient
    10    *
    11    * @param array|Collection $config Configuration data
    12    *
    13    * @return self
    14    */
    15 
     8    /**
     9    * Factory method to create a new RemoteClient
     10    *
     11    * @param array|Collection $config Configuration data
     12    *
     13    * @return self
     14    */
    1615}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/AbstractRemoteMedia.php

    r997748 r998050  
    131131     */
    132132    abstract public function toMediaManagerAttachment();
    133 
    134133}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Dailymotion/RemoteMedia.php

    r997433 r998050  
    1919    {
    2020        $attachment = array_merge(
    21             $this->getBasicAttachment(), 
     21            $this->getBasicAttachment(),
    2222            $attachment = array(
    2323                'id'          => $this->metadata['id'],
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Dailymotion/Service.php

    r997433 r998050  
    5252            'fields'  => 'id,screenname,status,username'
    5353        );
    54         $command = $this->client->getCommand('UserRequest',$params);
     54        $command = $this->client->getCommand('UserRequest', $params);
    5555        $response = $this->client->execute($command);
    5656
     
    7272            'fields'  => 'id,title,description,created_time,modified_time,owner,thumbnail_120_url,thumbnail_url,url'
    7373        );
    74         $command = $this->client->getCommand('UserRequest',$params);
     74        $command = $this->client->getCommand('UserRequest', $params);
    7575        $response = $this->client->execute($command);
    7676
     
    8484            'fields'  => 'id,title,description,created_time,modified_time,owner,thumbnail_120_url,thumbnail_url,url'
    8585        );
    86         $command = $this->client->getCommand('UserVideosRequest',$params);
     86        $command = $this->client->getCommand('UserVideosRequest', $params);
    8787        $response = $this->client->execute($command);
    8888
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Flickr/Client.php

    r997433 r998050  
    88class Client extends AbstractRemoteClient
    99{
    10   /**
    11    * Factory method to create a new VimeoClient
    12    *
    13    */
    14   public static function factory($config = array())
    15   {
     10    /**
     11     * Factory method to create a new VimeoClient
     12     *
     13     */
     14    public static function factory($config = array())
     15    {
    1616
    17     $default  = array(
    18       'base_url' => '{scheme}://api.flickr.com/services/feeds',
    19       'scheme'   => 'https',
    20       'curl.options' => array(
    21             CURLOPT_TIMEOUT   => 30,
    22             CURLOPT_CONNECTTIMEOUT   => 30,
    23       )
    24     );
    25     $required = array('base_url');
     17        $default  = array(
     18            'base_url' => '{scheme}://api.flickr.com/services/feeds',
     19            'scheme'   => 'https',
     20            'curl.options' => array(
     21                  CURLOPT_TIMEOUT   => 30,
     22                  CURLOPT_CONNECTTIMEOUT   => 30,
     23            )
     24        );
     25        $required = array('base_url');
    2626
    27     $config = Collection::fromConfig($config, $default, $required);
     27        $config = Collection::fromConfig($config, $default, $required);
    2828
    29     $client = new self($config->get('base_url'), $config);
     29        $client = new self($config->get('base_url'), $config);
    3030
    31     // Attach a service description to the client
    32     $description = ServiceDescription::factory(__DIR__ . '/ServiceDescription.json');
    33     $client->setDescription($description);
     31        // Attach a service description to the client
     32        $description = ServiceDescription::factory(__DIR__ .'/ServiceDescription.json');
     33        $client->setDescription($description);
    3434
    35     return $client;
    36   }
     35        return $client;
     36    }
    3737}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Flickr/RemoteMedia.php

    r997433 r998050  
    33
    44use WPRemoteMediaExt\RemoteMediaExt\Accounts\AbstractRemoteMedia;
     5
    56/*
    67* Flickr Media Class
     
    101102    {
    102103        $attachment = array_merge(
    103             $this->getBasicAttachment(), 
     104            $this->getBasicAttachment(),
    104105            array(
    105106                'id'          => basename($this->metadata['guid']),
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/MetaBoxSaveAccount.php

    r997433 r998050  
    55use WPRemoteMediaExt\WPCore\admin\WPmetabox;
    66use WPRemoteMediaExt\WPCore\admin\WPSaveMetabox;
    7 
    87
    98class MetaBoxSaveAccount extends WPSaveMetabox
     
    1615        $verify = parent::action($post_id, $post);
    1716        if (!$verify) {
    18           return;
     17            return;
    1918        }
    2019
     
    4847        }
    4948    }
    50 
    5149}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/MetaBoxService.php

    r997433 r998050  
    2020    public function __construct(
    2121        View $view,
    22         $id,
     22        $mbId,
    2323        $title,
    2424        $post_type,
    25         $context  = 'advanced',
     25        $context = 'advanced',
    2626        $priority = 'default',
    2727        $callback_args = null
     
    2929
    3030        parent::__construct(
    31             $id,
     31            $mbId,
    3232            $title,
    3333            $post_type,
     
    4949    public function action()
    5050    {
    51         $postType = func_get_arg(0);
    52         $post     = func_get_arg(1);
    53         $account = RemoteAccountFactory::create($post->ID);
     51        // $postType = func_get_arg(0);
     52        // $post     = func_get_arg(1);
     53        // $account = RemoteAccountFactory::create($post->ID);
    5454
    5555        parent::action();
     
    7070        $this->view->show();
    7171    }
    72 
    7372}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/MetaBoxServiceLoader.php

    r992903 r998050  
    99class MetaBoxServiceLoader extends WPmetaboxLoader
    1010{
    11   protected $metabox;
     11    protected $metabox;
    1212
    13   public function __construct(WPmetabox $metabox)
    14   {
    15     parent::__construct($metabox, new MetaBoxSaveAccount());
    16   }
     13    public function __construct(WPmetabox $metabox)
     14    {
     15        parent::__construct($metabox, new MetaBoxSaveAccount());
     16    }
    1717}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/RemoteAccount.php

    r992903 r998050  
    44class RemoteAccount extends AbstractRemoteAccount
    55{
    6   public function __construct($id = null, $type = null)
    7   {
    8     parent::__construct($id,$type);
    9   }
    10 
     6    public function __construct($raId = null, $type = null)
     7    {
     8        parent::__construct($raId, $type);
     9    }
    1110}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/RemoteServiceFactory.php

    r997433 r998050  
    44class RemoteServiceFactory
    55{
    6     static $classes = array();
     6    public static $classes = array();
    77
    88    public static function create($class)
     
    2525    }
    2626
    27     public static function className($class) 
     27    public static function className($class)
    2828    {
    2929        switch ($class) {
     
    4545    public static function getDbClassName($classname)
    4646    {
    47         return str_replace('\\','_',$classname);
     47        return str_replace('\\', '_', $classname);
    4848    }
    4949
    5050    public static function retrieveClassName($dbclassname)
    5151    {
    52         $retrievedClass = str_replace('_','\\',$dbclassname);
     52        $retrievedClass = str_replace('_', '\\', $dbclassname);
    5353        $retrievedClass = self::className($retrievedClass);
    5454        return $retrievedClass;
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Vimeo/Client.php

    r997433 r998050  
    88class Client extends AbstractRemoteClient
    99{
    10   /**
    11    * Factory method to create a new VimeoClient
    12    *
    13    */
    14   public static function factory($config = array())
    15   {
     10    /**
     11     * Factory method to create a new VimeoClient
     12     *
     13     */
     14    public static function factory($config = array())
     15    {
    1616
    17     $default  = array(
    18       'base_url' => '{scheme}://vimeo.com/api/{version}/',
    19       'scheme'   => 'http',
    20       'version'  => 'v2',
    21       'curl.options' => array(
    22             CURLOPT_TIMEOUT   => 30,
    23             CURLOPT_CONNECTTIMEOUT   => 30,
    24       )
    25     );
    26     $required = array('base_url');
     17        $default  = array(
     18            'base_url' => '{scheme}://vimeo.com/api/{version}/',
     19            'scheme'   => 'http',
     20            'version'  => 'v2',
     21            'curl.options' => array(
     22                CURLOPT_TIMEOUT   => 30,
     23                CURLOPT_CONNECTTIMEOUT   => 30,
     24            )
     25        );
     26        $required = array('base_url');
    2727
    28     $config = Collection::fromConfig($config, $default, $required);
     28        $config = Collection::fromConfig($config, $default, $required);
    2929
    30     $client = new self($config->get('base_url'), $config);
     30        $client = new self($config->get('base_url'), $config);
    3131
    32     // Attach a service description to the client
    33     $description = ServiceDescription::factory(__DIR__ . '/ServiceDescription.json');
    34     $client->setDescription($description);
     32        // Attach a service description to the client
     33        $description = ServiceDescription::factory(__DIR__ . '/ServiceDescription.json');
     34        $client->setDescription($description);
    3535
    36     return $client;
    37   }
     36        return $client;
     37    }
    3838}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Vimeo/RemoteMedia.php

    r997433 r998050  
    1919    {
    2020        $attachment = array_merge(
    21             $this->getBasicAttachment(), 
     21            $this->getBasicAttachment(),
    2222            array(
    2323                'id'          => $this->metadata['id'],
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Vimeo/Service.php

    r997433 r998050  
    77use WPRemoteMediaExt\WPCore\View;
    88use WPRemoteMediaExt\WPForms\FieldSet;
    9 
    10 
    119
    1210class Service extends AbstractRemoteService
     
    4947    {
    5048
    51       $params = array(
    52           'user_id' => $this->account->get('remote_user_id'),
    53           'request' => 'info'
    54       );
    55       $command = $this->client->getCommand('UserRequest', $params);
    56       $response = $this->client->execute($command);
     49        $params = array(
     50            'user_id' => $this->account->get('remote_user_id'),
     51            'request' => 'info'
     52        );
     53        $command = $this->client->getCommand('UserRequest', $params);
     54        $response = $this->client->execute($command);
    5755
    58       return $command->getResponse()->isSuccessful();
     56        return $command->getResponse()->isSuccessful();
    5957    }
    6058
     
    9189        $attachments = array();
    9290
    93         foreach($medias as $i => $media) {
     91        foreach ($medias as $i => $media) {
    9492            $remoteMedia = new RemoteMedia($media);
    9593            $remoteMedia->setAccount($this->getAccount());
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Youtube/Client.php

    r997433 r998050  
    88class Client extends AbstractRemoteClient
    99{
    10   /**
    11    * Factory method to create a new Client
    12    */
    13   public static function factory($config = array())
    14   {
     10    /**
     11     * Factory method to create a new Client
     12     */
     13    public static function factory($config = array())
     14    {
    1515
    16     $default  = array(
    17       'base_url' => '{scheme}://gdata.youtube.com/feeds/api/',
    18       'scheme'   => 'https',
    19       'curl.options' => array(
    20             CURLOPT_TIMEOUT   => 30,
    21             CURLOPT_CONNECTTIMEOUT   => 30,
    22       )
    23     );
    24     $required = array('base_url');
     16        $default  = array(
     17            'base_url' => '{scheme}://gdata.youtube.com/feeds/api/',
     18            'scheme'   => 'https',
     19            'curl.options' => array(
     20                CURLOPT_TIMEOUT   => 30,
     21                CURLOPT_CONNECTTIMEOUT   => 30,
     22            )
     23        );
     24        $required = array('base_url');
    2525
    26     $config = Collection::fromConfig($config, $default, $required);
     26        $config = Collection::fromConfig($config, $default, $required);
    2727
    28     $client = new self($config->get('base_url'), $config);
     28        $client = new self($config->get('base_url'), $config);
    2929
    30     // Attach a service description to the client
    31     $description = ServiceDescription::factory(__DIR__ . '/ServiceDescription.json');
    32     $client->setDescription($description);
     30        // Attach a service description to the client
     31        $description = ServiceDescription::factory(__DIR__ . '/ServiceDescription.json');
     32        $client->setDescription($description);
    3333
    34     return $client;
    35   }
     34        return $client;
     35    }
    3636}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Youtube/RemoteMedia.php

    r997433 r998050  
    2828
    2929        $attachment = array_merge(
    30             $this->getBasicAttachment(), 
     30            $this->getBasicAttachment(),
    3131            array(
    3232                'id'          => $this->metadata['youtubeid'],
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Youtube/Service.php

    r997433 r998050  
    5959    }
    6060
    61     // public function
    6261    public function setAccount(AbstractRemoteAccount $account)
    6362    {
  • remote-medias-lite/trunk/src/RemoteMediaExt/Ajax/AjaxQueryAttachments.php

    r997433 r998050  
    1010class AjaxQueryAttachments extends WPajaxCall
    1111{
    12 
    1312    public function __construct()
    1413    {
     
    2120        $accountID = 0;
    2221        if (isset($_REQUEST['query']['account_id'])) {
    23           $accountID = esc_attr($_REQUEST['query']['account_id']);
     22            $accountID = esc_attr($_REQUEST['query']['account_id']);
    2423        }
    2524
     
    2827
    2928        $return = array();
    30         $response = array();
    3129        $return['data'] = array();
    3230        try {
    3331            $return['data'] = $service->getUserAttachments();
    3432
    35         } catch(ClientErrorResponseException $e) {
     33        } catch (ClientErrorResponseException $e) {
    3634            $return['success'] = true;
    3735            $return['statuscode'] = $e->getResponse()->getStatusCode();
    3836            $return['msg']        = $e->getResponse()->getError();
    3937            wp_send_json($return);
    40         } catch(CurlException $e) {
     38        } catch (CurlException $e) {
    4139            $return['success'] = false;
    4240            $return['statuscode'] = $e->getErrorNo();
    4341            $return['msg']        = $e->getError();
    4442            wp_send_json($return);
    45         } catch(\Exception $e) {
     43        } catch (\Exception $e) {
    4644            $return['success'] = false;
    4745            $return['statuscode'] = $e->getResponse()->getStatusCode();
     
    5048        }
    5149
    52         wp_send_json_success( $return['data'] );
     50        wp_send_json_success($return['data']);
    5351    }
    5452}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Ajax/AjaxSendRemoteToEditor.php

    r997433 r998050  
    1919        $html = "";
    2020
    21         if (empty($jsattachment['subtype']) || empty($jsattachment['remotedata'])){
     21        if (empty($jsattachment['subtype']) ||
     22            empty($jsattachment['remotedata'])
     23        ) {
    2224            wp_send_json_error();
    2325        }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Ajax/AjaxUserInfo.php

    r997433 r998050  
    2727            $response = $service->GetUserInfo(esc_attr($_POST['user_id']));
    2828            $return['data'] = $response->getAll();
    29         } catch(ClientErrorResponseException $e) {
     29        } catch (ClientErrorResponseException $e) {
    3030            $return['error'] = true;
    3131            $return['statuscode'] = $e->getResponse()->getStatusCode();
    3232            $return['msg']        = $e->getResponse()->getReasonPhrase();
    33         } catch(\Exception $e) {
     33        } catch (\Exception $e) {
    3434            $return['error'] = true;
    3535            $return['statuscode'] = $e->getCode();
  • remote-medias-lite/trunk/src/RemoteMediaExt/FRemoteMediaExt.php

    r997748 r998050  
    124124        $this->hook(new MediaTemplate(new View($this->getViewsPath().'admin/media-remote-attachment.php')));
    125125        $this->addScript(new WPscriptAdmin(array('post.php' => array(), 'post-new.php' => array()), 'media-remote-ext', $this->getJsUrl().'media-remote-ext.min.js', $this->getJsUrl().'media-remote-ext.js', array('media-editor','media-views'), $this->version));
    126         $this->addStyle(new WPstyleAdmin(array(), 'media-remote-admin-css', $this->getCssUrl().'media-remote-admin.min.css', $this->getCssUrl().'media-remote-admin.css', $deps = array(), $this->version));
     126        $this->addStyle(new WPstyleAdmin(array(), 'media-remote-admin-css', $this->getCssUrl().'media-remote-admin.min.css', $this->getCssUrl().'media-remote-admin.css', array(), $this->version));
    127127    }
    128128   
     
    166166    public function initMetaboxes()
    167167    {
    168         $this->addScript(new WPscriptAdmin(array('post.php' => array('post_type' => $this->accountPostType->getSlug()), 'post-new.php' => array('post_type' => $this->accountPostType->getSlug())), 'rmedias-query-test',$this->getJsUrl().'media-remote-query-test.min.js', $this->getJsUrl().'media-remote-query-test.js', array(), $this->version));
     168        $this->addScript(new WPscriptAdmin(array('post.php' => array('post_type' => $this->accountPostType->getSlug()), 'post-new.php' => array('post_type' => $this->accountPostType->getSlug())), 'rmedias-query-test', $this->getJsUrl().'media-remote-query-test.min.js', $this->getJsUrl().'media-remote-query-test.js', array(), $this->version));
    169169        $this->addScript(new WPscriptAdmin(array('post.php' => array('post_type' => $this->accountPostType->getSlug()), 'post-new.php' => array('post_type' => $this->accountPostType->getSlug())), 'media-remote-account', $this->getJsUrl().'rml-account.min.js', $this->getJsUrl().'rml-account.js', array(), $this->version));
    170170       
     
    202202            __('Status & Actions', 'remote-medias-lite'),
    203203            $this->accountPostType->getSlug(),
    204             'side',//'normal', 'advanced', or 'side'
    205             'high'//'high', 'core', 'default' or 'low'
     204            'side', //'normal', 'advanced', or 'side'
     205            'high' //'high', 'core', 'default' or 'low'
    206206        );
    207207        $this->hook(new MetaBoxServiceLoader($metabox));
     
    213213
    214214        $services = array();
    215         foreach($this->getRemoteServices() as $service) {
     215        foreach ($this->getRemoteServices() as $service) {
    216216            $services[$service->getSlug()] = $service->getName();
    217217        }
     
    236236        $uid = get_current_user_id();
    237237
    238         if (is_null($this->fPointerAccounts) || 
    239             is_null($this->fPointerMediaManager) 
     238        if (is_null($this->fPointerAccounts) ||
     239            is_null($this->fPointerMediaManager)
    240240        ) {
    241241            $this->initPointers();
  • remote-medias-lite/trunk/src/RemoteMediaExt/Library/MediaArraySettings.php

    r992903 r998050  
    66class MediaArraySettings extends WPfilter
    77{
     8    protected $slug;
     9    protected $setting = array();
    810
    9   protected $slug;
    10   protected $setting = array();
     11    public function __construct($slug)
     12    {
     13        parent::__construct('media_view_settings', 10, 2);
    1114
    12   public function __construct($slug)
    13   {
    14     parent::__construct('media_view_settings', 10, 2);
     15        $this->slug = $slug;
     16    }
    1517
    16     $this->slug = $slug;
    17   }
     18    public function getSlug()
     19    {
     20        return $this->slug;
     21    }
    1822
    19   public function getSlug()
    20   {
    21     return $this->slug;
    22   }
     23    public function addSetting($index, $value)
     24    {
     25        $this->setting[$index] = $value;
     26    }
    2327
    24   public function addSetting($index,$value)
    25   {
    26     $this->setting[$index] = $value;
    27   }
     28    public function removeSetting($index)
     29    {
     30        unset($this->setting[$index]);
     31    }
     32    public function getSetting()
     33    {
     34        return $this->setting;
     35    }
    2836
    29   public function removeSetting($index)
    30   {
    31     unset($this->setting[$index]);
    32   }
    33   public function getSetting()
    34   {
    35     return $this->setting;
    36   }
     37    public function action()
     38    {
     39        $settings = func_get_arg(0);
     40        // $post    = func_get_arg(1);
    3741
    38   function action()
    39   {
    40     $settings = func_get_arg(0);
    41     $post    = func_get_arg(1);
     42        $settings[$this->slug] = $this->setting;
    4243
    43     $settings[$this->slug] = $this->setting;
    44 
    45     return $settings;
    46   }
    47 
     44        return $settings;
     45    }
    4846}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Library/MediaLibrarySection.php

    r992903 r998050  
    66class MediaLibrarySection implements WPhook
    77{
    8   protected $strings = array();
     8    protected $strings = array();
    99
    10   protected $title;
    11   protected $content;
     10    protected $title;
     11    protected $content;
    1212
    13   public function __construct($view, $slug, $title)
    14   {
    15     $this->title    = new MediaStrings($slug,$title);
    16     $this->content  = new MediaTemplate($view);
    17   }
     13    public function __construct($view, $slug, $title)
     14    {
     15        $this->title    = new MediaStrings($slug, $title);
     16        $this->content  = new MediaTemplate($view);
     17    }
    1818
    19   public function register()
    20   {
    21     $this->title->register();
    22     $this->content->register();
    23   }
     19    public function register()
     20    {
     21        $this->title->register();
     22        $this->content->register();
     23    }
    2424
    25   public function remove()
    26   {
    27     $this->title->remove();
    28     $this->content->remove();
    29   }
    30 
     25    public function remove()
     26    {
     27        $this->title->remove();
     28        $this->content->remove();
     29    }
    3130}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Library/MediaSettings.php

    r997433 r998050  
    2828    }
    2929
    30     function action()
     30    public function action()
    3131    {
    3232        $settings = func_get_arg(0);
    33         $post    = func_get_arg(1);
     33        // $post    = func_get_arg(1);
    3434
    3535        $args = array(
     
    5858        return $settings;
    5959    }
    60 
    6160}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Library/MediaStrings.php

    r992903 r998050  
    77{
    88
    9   protected $slug;
    10   protected $name;
     9    protected $slug;
     10    protected $name;
    1111
    12   public function __construct($slug, $name)
    13   {
    14     parent::__construct('media_view_strings', 10, 2);
     12    public function __construct($slug, $name)
     13    {
     14        parent::__construct('media_view_strings', 10, 2);
    1515
    16     $this->slug = $slug;
    17     $this->name = $name;
    18   }
     16        $this->slug = $slug;
     17        $this->name = $name;
     18    }
    1919
    20   public function getSlug()
    21   {
    22     return $this->slug;
    23   }
     20    public function getSlug()
     21    {
     22        return $this->slug;
     23    }
    2424
    25   public function getName()
    26   {
    27     return $this->name;
    28   }
     25    public function getName()
     26    {
     27        return $this->name;
     28    }
    2929
    30   function action()
    31   {
    32     $strings = func_get_arg(0);
    33     $post    = func_get_arg(1);
     30    public function action()
     31    {
     32        $strings = func_get_arg(0);
     33        // $post    = func_get_arg(1);
    3434
    35     $strings[$this->slug] = $this->name;
     35        $strings[$this->slug] = $this->name;
    3636
    37     return $strings;
    38   }
    39 
     37        return $strings;
     38    }
    4039}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Library/MediaTemplate.php

    r992903 r998050  
    77class MediaTemplate extends WPaction
    88{
     9    protected $view;
    910
    10   protected $view;
     11    public function __construct(View $view)
     12    {
     13        $this->view = $view;
    1114
    12   public function __construct(View $view)
    13   {
    14     $this->view = $view;
     15        parent::__construct('print_media_templates');
     16    }
    1517
    16     parent::__construct('print_media_templates');
    17   }
    18 
    19   public function action()
    20   {
    21     $this->view->show();
    22   }
    23 
     18    public function action()
     19    {
     20        $this->view->show();
     21    }
    2422}
Note: See TracChangeset for help on using the changeset viewer.