<commit_before><?php
/**
 *
 * Copyright 2009 <NAME> - http://www.lildude.co.uk/projects/smugmug-media-silo-plugin
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * todo@ Test for read-only mode, and if SmugMug is in RO mode, switch access method
 */

/**
 * SmugMug Silo
 */

class SmugMugSilo extends Plugin implements MediaSilo
{
    const SILO_NAME = 'SmugMug';

    const APIKEY = '<KEY>';
    const OAUTHSECRET = '<KEY>';
    const CACHE_EXPIRY = 86400;	// seconds.  This is 24 hours.
    private $status;

    /**
    * Provide plugin info to the system
    */
    public function info()
    {
      return array(
        'name'			=> 'SmugMug Media Silo',
        'version'		=> '1.0',
        'url'			=> 'http://www.lildude.co.uk/projects/smugmug-media-silo-plugin',
        'author'		=> '<NAME>',
        'authorurl'		=> 'http://www.colinseymour.co.uk/',
        'license'		=> 'Apache License 2.0',
        'description'	=> _t('Provides a silo to access your SmugMug photos making it easy to include images into posts and pages.'),
        'copyright'		=> date('Y'),
        'guid'			=> '4A881D3E-E643-11DD-8D7A-AA9D55D89593'
      );
    }

    /**
    * Initialize some internal values when plugin initializes
    */
    public function action_init()
    {
      if ( !class_exists( 'phpSmug' ) ) {
        require_once( dirname( __FILE__ ).'/lib/phpSmug/phpSmug.php' );
      }
      $this->smug = new phpSmug( "APIKey=".self::APIKEY,
                     "AppName={$this->info->name}/{$this->info->version}",
                     "OAuthSecret=".self::OAUTHSECRET );

      // Enable caching.  This will be for 24 hours, but will be cleared whenever
      // a file is uploaded via this plugin or manually via the silo.
      $this->smug->enableCache( "type=fs",
                    "cache_dir=". HABARI_PATH . '/user/cache/',
                    "cache_expire=".self::CACHE_EXPIRY );
    }

    /**
    * Respond to the user selecting an action on the plugin page<commit_msg>Added help() function. Still needs populating tho<commit_after><?php
/**
 *
 * Copyright 2009 <NAME> - http://www.lildude.co.uk/projects/smugmug-media-silo-plugin
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * todo@ Test for read-only mode, and if SmugMug is in RO mode, switch access method
 */

/**
 * SmugMug Silo
 */

class SmugMugSilo extends Plugin implements MediaSilo
{
    const SILO_NAME = 'SmugMug';

    const APIKEY = '<KEY>';
    const OAUTHSECRET = '<KEY>';
    const CACHE_EXPIRY = 86400;	// seconds.  This is 24 hours.
    private $status;

    /**
    * Provide plugin info to the system
    */
    public function info()
    {
      return array(
        'name'			=> 'SmugMug Media Silo',
        'version'		=> '1.0',
        'url'			=> 'http://www.lildude.co.uk/projects/smugmug-media-silo-plugin',
        'author'		=> '<NAME>',
        'authorurl'		=> 'http://www.colinseymour.co.uk/',
        'license'		=> 'Apache License 2.0',
        'description'	=> _t('Provides a silo to access your SmugMug photos making it easy to include images into posts and pages.'),
        'copyright'		=> date('Y'),
        'guid'			=> '4A881D3E-E643-11DD-8D7A-AA9D55D89593'
      );
    }

    /**
     * The help message - it provides a larger explanation of what this plugin
     * does
     *
     * @return string
     */
    public function help()
    {
            return _t('There is no helping you now.');
    }

    /**
    * Initialize some internal values when plugin initializes
    */
    public function action_init()
    {
      if ( !class_exists( 'phpSmug' ) ) {
        require_once( dirname( __FILE__ ).'/lib/phpSmug/phpSmug.php' );
      }
      $this->smug = new phpSmug( "APIKey=".self::APIKEY,
                     "AppName={$this->info->name}/{$this->info->version}",
                     "OAuthSecret=".self::OAUTHSECRET );

      // Enable caching.  This will be for 24 hours, but will be cleared whenever
      // a file is uploaded via this plugin or manually via the silo.
      $this->smug->enableCache( "type=fs",
                    "cache_dir=". HABARI_PATH . '/user/cache/',
                    "cache_expire=".self::CACHE_EXPIRY );
    }

    /**
    * Respond to the user selecting an action on the plugin page
{'fraction_non_alphanumeric': 0.1241222243309926, 'fraction_numerical': 0.015562725374833934, 'mean_word_length': 2.435462842242503, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '774793', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1632, 'n_words': 510}