<commit_before><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

// Remove E_STRICT and E_DEPRECATED from error_reporting
error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));

/**
 * opPlugin allows you to touch OpenPNE plugin.
 *
 * @package    OpenPNE
 * @subpackage plugin
 * @author     <NAME> <<EMAIL>>
 */
class opPlugin
{
  private static $instances = array();

  protected
    $name,
    $isActive = true,
    $version,
    $summary;

  private function __construct($pluginName, sfEventDispatcher $dispatcher)
  {
    $this->name = $pluginName;

    $config = opPluginManager::getPluginActivationList();
    if (isset($config[$pluginName]))
    {
      $this->isActive = $config[$pluginName];
    }

    $info = $this->getPackageInfo();
    if ($info)
    {
      $this->version = (string)$info->version->release;
      $this->summary = (string)$info->summary;
    }
    else
    {
      try
      {
        $manager = new opPluginManager($dispatcher);
        $package = $manager->getEnvironment()->getRegistry()->getPackage($pluginName, opPluginManager::getDefaultPluginChannelServerName());
        if ($package)<commit_msg>retrieve only cached package info for opPlugin::__construct() (fixes #4039, BP from #3352)<commit_after><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

// Remove E_STRICT and E_DEPRECATED from error_reporting
error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));

/**
 * opPlugin allows you to touch OpenPNE plugin.
 *
 * @package    OpenPNE
 * @subpackage plugin
 * @author     <NAME> <<EMAIL>>
 */
class opPlugin
{
  private static $instances = array();

  protected
    $name,
    $isActive = true,
    $version,
    $summary;

  private function __construct($pluginName, sfEventDispatcher $dispatcher)
  {
    $this->name = $pluginName;

    $config = opPluginManager::getPluginActivationList();
    if (isset($config[$pluginName]))
    {
      $this->isActive = $config[$pluginName];
    }

    $info = $this->getPackageInfo();
    if ($info)
    {
      $this->version = (string)$info->version->release;
      $this->summary = (string)$info->summary;
    }
    else
    {
      try
      {
        $environment = opPluginManager::createPearEnvironment($dispatcher);
        $channel = opPluginManager::getDefaultPluginChannelServerName();

        $package = $environment->getRegistry()->getPackage($pluginName, $channel);
        if ($package)
{'fraction_non_alphanumeric': 0.13180212014134277, 'fraction_numerical': 0.0028268551236749115, 'mean_word_length': 3.4234375, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6412198', 'n_tokens_mistral': 861, 'n_tokens_neox': 837, 'n_words': 215}