当前位置: 首页>>代码示例>>PHP>>正文


PHP JApplicationCli类代码示例

本文整理汇总了PHP中JApplicationCli的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationCli类的具体用法?PHP JApplicationCli怎么用?PHP JApplicationCli使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JApplicationCli类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     JLog::add(new JLogEntry(__METHOD__, JLOG::DEBUG, 'lib_j2xml'));
     // Merge the default translation with the current translation
     $jlang = JFactory::getLanguage();
     $jlang->load('lib_j2xml', JPATH_SITE, 'en-GB', true);
     $jlang->load('lib_j2xml', JPATH_SITE, $jlang->getDefault(), true);
     $jlang->load('lib_j2xml', JPATH_SITE, null, true);
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $this->_nullDate = $db->getNullDate();
     $this->_user_id = $user->get('id');
     $this->_now = class_exists('JPlatform') && version_compare(JPlatform::RELEASE, '12', 'ge') ? JFactory::getDate()->format("%Y-%m-%d-%H-%M-%S") : JFactory::getDate()->toFormat("%Y-%m-%d-%H-%M-%S");
     $this->_option = PHP_SAPI != 'cli' ? JRequest::getCmd('option') : 'cli_' . strtolower(get_class(JApplicationCli::getInstance()));
     $execute = class_exists('JPlatform') && version_compare(JPlatform::RELEASE, '12', 'ge') ? 'execute' : 'query';
     $db->setQuery("\r\n\t\t\tCREATE TABLE IF NOT EXISTS `#__j2xml_usergroups` (\r\n\t\t\t\t`id` int(10) unsigned NOT NULL,\r\n\t\t\t\t`parent_id` int(10) unsigned NOT NULL DEFAULT '0',\r\n\t\t\t\t`title` varchar(100) NOT NULL DEFAULT ''\r\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\r\n\t\t\t")->{$execute}();
     $db->setQuery("\r\n\t\t\tTRUNCATE TABLE\r\n\t\t\t\t`#__j2xml_usergroups`;\r\n\t\t\t")->{$execute}();
     $db->setQuery("\r\n\t\t\tINSERT INTO\r\n\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\tSELECT\r\n\t\t\t\t`id`,`parent_id`,CONCAT('[\"',REPLACE(`title`,'\"','\\\"'),'\"]')\r\n\t\t\tFROM\r\n\t\t\t\t`#__usergroups`;\r\n\t\t\t")->{$execute}();
     do {
         $db->setQuery("\r\n\t\t\t\tUPDATE\r\n\t\t\t\t\t`#__j2xml_usergroups` j\r\n\t\t\t\tINNER JOIN\r\n\t\t\t\t\t`#__usergroups` g\r\n\t\t\t\tON\r\n\t\t\t\t\tj.parent_id = g.id\r\n\t\t\t\tSET\r\n\t\t\t\t\tj.parent_id = g.parent_id,\r\n\t\t\t\t\tj.title = CONCAT('[\"',REPLACE(`g`.`title`,'\"','\\\"'), '\",', SUBSTR(`j`.`title`,2));\r\n\t\t\t\t")->{$execute}();
         $n = $db->setQuery("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tCOUNT(*)\r\n\t\t\t\tFROM\r\n\t\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t`parent_id` > 0;\r\n\t\t\t\t")->loadResult();
     } while ($n > 0);
     $db->setQuery("\r\n\t\t\tINSERT INTO\r\n\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\tSELECT\r\n\t\t\t\t`id`,`parent_id`,`title`\r\n\t\t\tFROM\r\n\t\t\t\t`#__usergroups`;\r\n\t\t\t")->{$execute}();
     $this->_usergroups = $db->setQuery("SELECT `title`,`id` FROM `#__j2xml_usergroups`")->loadAssocList('title', 'id');
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:25,代码来源:importer.php

示例2: __construct

 /**
  * Class constructor.
  *
  * This constructor invokes the parent JApplicationCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  */
 public function __construct()
 {
     // Call the parent __construct method so it bootstraps the application class.
     parent::__construct();
     jimport('joomla.database.database');
     // Note, this will throw an exception if there is an error
     // creating the database connection.
     $this->dbo = JDatabase::getInstance(array('driver' => $this->get('dbDriver'), 'host' => $this->get('dbHost'), 'user' => $this->get('dbUser'), 'password' => $this->get('dbPass'), 'database' => $this->get('dbName'), 'prefix' => $this->get('dbPrefix')));
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:17,代码来源:ecr_comname.php

示例3: __construct

 /**
  * Class constructor.
  *
  * This constructor invokes the parent JApplicationCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  * @since   11.3
  * @throws  JDatabaseException
  */
 public function __construct()
 {
     // Call the parent __construct method so it bootstraps the application class.
     parent::__construct();
     jimport('joomla.database.database');
     $this->dbo = JFactory::getDbo();
     $this->app = JFactory::getApplication('site');
     $this->config = JFactory::getConfig();
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:19,代码来源:find_hfrefs.php

示例4: __construct

 /**
  * CONSTRUCTOR
  * @param object $subject The object to observe
  * @param object $params  The object that holds the plugin parameters
  * @since 1.5
  */
 function __construct()
 {
     JLog::add(new JLogEntry(__METHOD__, JLOG::DEBUG, 'lib_j2xml'));
     $execute = class_exists('JPlatform') && version_compare(JPlatform::RELEASE, '12', 'ge') ? 'execute' : 'query';
     $db = JFactory::getDBO();
     $db->setQuery("\r\n\t\t\t\t\tCREATE TABLE IF NOT EXISTS `#__j2xml_usergroups` (\r\n\t\t\t\t\t\t`id` int(10) unsigned NOT NULL,\r\n\t\t\t\t\t\t`parent_id` int(10) unsigned NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t`title` varchar(100) NOT NULL DEFAULT ''\r\n\t\t\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\r\n\t\t\t\t\t")->{$execute}();
     $db->setQuery("\r\n\t\t\t\t\tTRUNCATE TABLE\r\n\t\t\t\t\t\t`#__j2xml_usergroups`;\r\n\t\t\t\t\t")->{$execute}();
     $db->setQuery("\r\n\t\t\t\t\tINSERT INTO\r\n\t\t\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t`id`,`parent_id`,CONCAT('[\"',REPLACE(`title`,'\"','\\\"'),'\"]')\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`#__usergroups`;\r\n\t\t\t\t\t")->{$execute}();
     do {
         $db->setQuery("\r\n\t\t\t\t\tUPDATE\r\n\t\t\t\t\t\t`#__j2xml_usergroups` j\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\t`#__usergroups` g\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\tj.parent_id = g.id\r\n\t\t\t\t\tSET\r\n\t\t\t\t\t\tj.parent_id = g.parent_id,\r\n\t\t\t\t\t\tj.title = CONCAT('[\"',REPLACE(`g`.`title`,'\"','\\\"'), '\",', SUBSTR(`j`.`title`,2));\r\n\t\t\t\t\t")->{$execute}();
         $n = $db->setQuery("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`#__j2xml_usergroups`\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t`parent_id` > 0;\r\n\t\t\t\t\t")->loadResult();
     } while ($n > 0);
     $this->option = PHP_SAPI != 'cli' ? JRequest::getCmd('option') : 'cli_' . strtolower(get_class(JApplicationCli::getInstance()));
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:20,代码来源:exporter.php

示例5: invoke

 function invoke($numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, $fnSuffix)
 {
     // ensure that we are running in a joomla context
     // we've not yet figured out how to bootstrap joomla, so we should
     // not execute hooks if joomla is not loaded
     if (defined('_JEXEC')) {
         //Invoke the Joomla plugin system to observe to civicrm events.
         jimport('joomla.plugin.helper');
         jimport('cms.plugin.helper');
         // Joomla 3.2
         JPluginHelper::importPlugin('civicrm');
         // get app based on cli or web
         if (PHP_SAPI != 'cli') {
             $app = JFactory::getApplication('administrator');
         } else {
             // condition on Joomla version
             if (version_compare(JVERSION, '3.0', 'lt')) {
                 $app = JCli::getInstance();
             } else {
                 $app = JApplicationCli::getInstance();
             }
         }
         $result = $app->triggerEvent($fnSuffix, array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6));
         $moduleResult = $this->commonInvoke($numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $fnSuffix, 'joomla');
         if (!empty($moduleResult) && is_array($moduleResult)) {
             if (empty($result)) {
                 $result = $moduleResult;
             } else {
                 if (is_array($moduleResult)) {
                     $result = array_merge($result, $moduleResult);
                 }
             }
         }
         if (!empty($result)) {
             // collapse result returned from hooks
             // CRM-9XXX
             $finalResult = array();
             foreach ($result as $res) {
                 if (!is_array($res)) {
                     $res = array($res);
                 }
                 $finalResult = array_merge($finalResult, $res);
             }
             $result = $finalResult;
         }
         return $result;
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:48,代码来源:Joomla.php

示例6: __construct

 /**
  * Class constructor.
  *
  * This constructor invokes the parent JApplicationCli class constructor,
  * and then creates a connector to the database so that it is
  * always available to the application when needed.
  *
  * @since   11.3
  * @throws  JDatabaseException
  */
 public function __construct()
 {
     // Call the parent __construct method so it bootstraps the application class.
     parent::__construct();
     //
     // Prepare the logger.
     //
     // Include the JLog class.
     jimport('joomla.log.log');
     // Get the date so that we can roll the logs over a time interval.
     $date = JFactory::getDate()->format('Y-m-d');
     // Add the logger.
     JLog::addLogger(array('text_file' => 'cron.' . $date . '.php', 'text_file_path' => __DIR__ . '/logs'));
     //
     // Prepare the database connection.
     //
     jimport('joomla.database.database');
     // Note, this will throw an exception if there is an error
     // creating the database connection.
     $this->dbo = JDatabase::getInstance(array('driver' => $this->get('dbDriver'), 'host' => $this->get('dbHost'), 'user' => $this->get('dbUser'), 'password' => $this->get('dbPass'), 'database' => $this->get('dbName'), 'prefix' => $this->get('dbPrefix')));
 }
开发者ID:dmaritim,项目名称:joomla-platform-examples,代码行数:31,代码来源:run.php

示例7: json_decode

        if (file_exists($jsonFile) == false) {
            return false;
        }
        $data = json_decode(file_get_contents($jsonFile), true);
        if (empty($data)) {
            return false;
        }
        $username = $data['credentials']['username'];
        $password = $data['credentials']['password'];
        $password = JUserHelper::hashPassword($password);
        $db = JFactory::getDBO();
        $query = $db->getQuery(true);
        $query->update($db->quoteName('#__users'))->set($db->quoteName('password') . ' = ' . $db->quote($password))->set($db->quoteName('username') . ' = ' . $db->quote($username))->where(array($db->quoteName('username') . '= "admin"'));
        $db->setQuery($query);
        $db->execute();
        return true;
    }
    public function togglePlugin($name, $folder, $state = 0)
    {
        $db = JFactory::getDBO();
        $query = $db->getQuery(true);
        $query->update($db->quoteName('#__extensions'))->set($db->quoteName('enabled') . ' = ' . (int) $state)->where(array($db->quoteName('type') . '=' . $db->quote('plugin'), $db->quoteName('element') . '=' . $db->quote($name), $db->quoteName('folder') . '=' . $db->quote($folder)));
        $db->setQuery($query);
        $db->execute();
        return true;
    }
}
// Instantiate the application object, passing the class name to JCli::getInstance
// and use chaining to execute the application.
JApplicationCli::getInstance('PbfCli')->execute();
开发者ID:roland-d,项目名称:joomla_install,代码行数:30,代码来源:pbf.php

示例8: memUsage

        if ($result instanceof Exception || $result === false) {
            $this->out(" FAILED");
            return false;
        } else {
            $this->out(" SENT");
            return true;
        }
    }
    function memUsage()
    {
        if (function_exists('memory_get_usage')) {
            $size = memory_get_usage();
            $unit = array('b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
            return @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
        } else {
            return "(unknown)";
        }
    }
    function peakMemUsage()
    {
        if (function_exists('memory_get_peak_usage')) {
            $size = memory_get_peak_usage();
            $unit = array('b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
            return @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
        } else {
            return "(unknown)";
        }
    }
}
JApplicationCli::getInstance('AkeebaSubscriptionsExpirationNotifyApp')->execute();
开发者ID:ZoiaoDePeixe,项目名称:akeebasubs,代码行数:30,代码来源:akeebasubs-expiration-notify.php

示例9: doExecute

 * A command line cron job to attempt to remove files that should have been deleted at update.
 *
 * @package  Joomla.Cli
 * @since    3.0
 */
class DeletefilesCli extends JApplicationCli
{
    /**
     * Entry point for CLI script
     *
     * @return  void
     *
     * @since   3.0
     */
    public function doExecute()
    {
        // Import the dependencies
        jimport('joomla.filesystem.file');
        jimport('joomla.filesystem.folder');
        // We need the update script
        JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php');
        // Instantiate the class
        $class = new JoomlaInstallerScript();
        // Run the delete method
        $class->deleteUnexistingFiles();
    }
}
// Instantiate the application object, passing the class name to JCli::getInstance
// and use chaining to execute the application.
JApplicationCli::getInstance('DeletefilesCli')->execute();
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:30,代码来源:deletefiles.php

示例10: InvalidArgumentException

            case 'plugin':
                $path = JPATH_PLUGINS . '/' . $group . '/' . $name . '/' . $name;
                break;
            case 'library':
                $path = JPATH_MANIFESTS . '/libraries/' . $name;
                break;
            default:
                throw new InvalidArgumentException(sprintf('Extension type "%s" does not support.', $type));
        }
        return Jpath::clean($reference ? str_replace(JPATH_ROOT, '', $path) : $path);
    }
    protected function getTempPath()
    {
        $path = JPath::clean($this->get('tmp_path'));
        if (!is_dir($path)) {
            throw new Exception(sprintf('Dir "%s" does not exists.', $path));
        }
        if (!is_writable($path)) {
            throw new Exception(sprintf('Dir "%s" does not writable.', $path));
        }
        return $path;
    }
    protected static function error($text)
    {
        return sprintf("[%sm%s[0m", implode(';', self::$error), $text);
    }
}
// Instantiate the application object, passing the class name to JCli::getInstance
// and use chaining to execute the application.
JApplicationCli::getInstance('CreateExtensionCli')->execute();
开发者ID:fields-and-filters,项目名称:fields-and-filters,代码行数:30,代码来源:create_extension.php

示例11: getPaymentsForChecking

                    $paymentNew->retry_counter -= 1;
                    RApiPaymentHelper::updatePaymentCounter($paymentNew->id, $paymentNew->retry_counter);
                    $this->out('Retry checks left: ' . $paymentNew->retry_counter);
                }
                $this->out('============================');
            }
        }
        $this->out('============================');
        $this->out('Done !');
    }
    /**
     * Get payments pending for checking
     *
     * @return mixed
     */
    public function getPaymentsForChecking()
    {
        $db = JFactory::getDbo();
        $finalStatuses = array();
        $retryTime = RBootstrap::getConfig('payment_time_between_payment_check_requests', 24);
        foreach ($this->finalStatuses as $status) {
            $finalStatuses[] = $db->q($status);
        }
        $query = $db->getQuery(true)->select('p.*')->from($db->qn('#__redcore_payments', 'p'))->where('p.status NOT IN (' . implode(',', $finalStatuses) . ')')->where('p.retry_counter > 0')->where('TIMESTAMPDIFF(HOUR, p.modified_date, NOW()) > ' . (int) $retryTime);
        $db->setQuery($query);
        $items = $db->loadObjectList();
        return $items;
    }
}
JApplicationCli::getInstance('CheckpaymentsApplicationCli')->execute();
开发者ID:thangredweb,项目名称:redCORE,代码行数:30,代码来源:checkpayments.php

示例12: substr

                $header = substr($response, 0, $pos);
                $body = substr($response, $pos + 2 * strlen($crlf));
                // parse headers
                $headers = array();
                $lines = explode($crlf, $header);
                foreach ($lines as $line) {
                    if (($pos = strpos($line, ':')) !== false) {
                        $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos + 1));
                    }
                }
                //redirection?
                if (isset($headers['location'])) {
                    return $this->fetchURL($headers['location'], $method);
                } else {
                    return $body;
                }
                break;
            case 'fopen':
                $opts = array('http' => array('method' => "GET", 'header' => "Accept-language: en\r\n"));
                $context = stream_context_create($opts);
                $result = @file_get_contents($url, false, $context);
                break;
        }
        return $result;
    }
}
// Load the version file
require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/version.php';
// Instanciate and run the application
JApplicationCli::getInstance('AkeebaBackupCLI')->execute();
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:30,代码来源:akeeba-altbackup.php

示例13: getTemplate

        // Let's cleanup the downloaded archive and the temp folder
        if (JFolder::exists($package['extractdir'])) {
            JFolder::delete($package['extractdir']);
        }
        if (JFile::exists($package['packagefile'])) {
            JFile::delete($package['packagefile']);
        }
        if ($installed) {
            $this->out("Extension successfully installed");
            $this->close(0);
        } else {
            $this->out("Extension installation failed");
            $this->close(250);
        }
    }
    public function getTemplate($params = false)
    {
        return '';
    }
    public function setHeader($name, $value, $replace = false)
    {
        return $this;
    }
    public function getCfg($name, $default = null)
    {
        return $this->get($name, $default);
    }
}
$app = JApplicationCli::getInstance('JoomlaExtensionInstallerCli');
JFactory::$application = $app;
$app->execute();
开发者ID:pagchen,项目名称:vagrant,代码行数:31,代码来源:install-joomla-extension.php

示例14: limit

        $this->out("\t silent - yes/no. In case set to 'yes' only error messages are going to be displayed. Default set to 'yes'");
        $this->out("\t section - section id of the section you want to crawl. If not given all valid sections are going to be crawled");
        $this->out("\t timeLimit - time limit (in seconds - default 3600). If the limit has been reached while crawling the crawler will stop any actions");
        $this->out("\t cleanCache - yes/no If set to 'yes' the cache will be invalidated first. Default set to 'yes'");
        $this->out("\t loopTimeLimit - time limit (in seconds - default 15) for a loop. When reached a new loop is going to be started");
        $this->out('');
        $this->out("All settings are defined like name=value (timeLimit=100). The order doesn't matter");
        $this->out('');
        $this->out('');
    }
    protected function SpOut($txt)
    {
        if (!$this->silent) {
            $this->out($txt);
        }
    }
    /**
     * @param SPRemote $connection
     * @param string $url
     * @return array
     */
    protected function SpConnect($connection, $url)
    {
        $connection->setOptions(array('url' => $url, 'connecttimeout' => 10, 'returntransfer' => true, 'useragent' => self::USER_AGENT, 'header' => true, 'verbose' => false));
        $content = $connection->exec();
        $response = $connection->info();
        return array($content, $response);
    }
}
JApplicationCli::getInstance('SobiProCrawler')->execute($argv);
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:30,代码来源:cron.php

示例15: microtime

        $c = $c === 0 ? 1 : $c;
        try {
            // Process the batches.
            for ($i = 0; $i < $c; $i++) {
                // Set the batch start time.
                $this->_qtime = microtime(true);
                // Reset the batch offset.
                $state->batchOffset = 0;
                // Trigger the onBuildIndex event.
                JEventDispatcher::getInstance()->trigger('onBuildIndex');
                // Batch reporting.
                $this->out(JText::sprintf('FINDER_CLI_BATCH_COMPLETE', $i + 1, round(microtime(true) - $this->_qtime, 3)), true);
            }
        } catch (Exception $e) {
            // Display the error
            $this->out($e->getMessage(), true);
            // Reset the indexer state.
            FinderIndexer::resetState();
            // Close the app
            $this->close($e->getCode());
        }
        // Total reporting.
        $this->out(JText::sprintf('FINDER_CLI_PROCESS_COMPLETE', round(microtime(true) - $this->_time, 3)), true);
        // Reset the indexer state.
        FinderIndexer::resetState();
    }
}
// Instantiate the application object, passing the class name to JCli::getInstance
// and use chaining to execute the application.
JApplicationCli::getInstance('FinderCli')->execute();
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:30,代码来源:finder_indexer.php


注:本文中的JApplicationCli类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。