• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP opToolkit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

 public function run()
 {
     $path = $this->options['dir'] . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . $this->options['name'] . '.sql';
     if (!file_exists($path)) {
         throw new RuntimeException('The specified sql doesn\'t exist.');
     }
     $db = $this->getDatabaseManager()->getDatabase('doctrine');
     $this->conn = $db->getDoctrineConnection();
     $this->conn->beginTransaction();
     $this->conn->execute('SET FOREIGN_KEY_CHECKS = 0');
     // for mysql
     $sql = opToolkit::unifyEOLCharacter($this->parseSql($path));
     $queries = explode("\n", $sql);
     try {
         $this->executeQueries($queries);
         $this->conn->commit();
     } catch (Exception $e) {
         $this->conn->rollback();
         $this->conn->execute('SET FOREIGN_KEY_CHECKS = 0');
         // for mysql
         throw $e;
     }
     $this->conn->execute('SET FOREIGN_KEY_CHECKS = 0');
     // for mysql
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:25,代码来源:opUpgradeSQLImportStrategy.class.php


示例2: sendMail

 public function sendMail()
 {
     $token = md5(opToolkit::generatePasswordString());
     $this->member->setConfig('password_recovery_token', $token);
     $params = array('token' => $token, 'id' => $this->member->id, 'subject' => '【' . opConfig::get('sns_name') . '】パスワード再設定用URL発行のお知らせ');
     sfOpenPNEMailSend::sendTemplateMail('passwordRecovery', $this->member->getEMailAddress(), opConfig::get('admin_mail_address'), $params);
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:7,代码来源:opAuthMailAddressPasswordRecoveryForm.class.php


示例3: save

 public function save()
 {
     parent::save();
     $emailAddress = $this->member->getEmailAddress();
     $params = array('mailAddress' => $emailAddress, 'newPassword' => $this->plainPassword, 'isMobile' => opToolkit::isMobileEmailAddress($emailAddress));
     $this->sendConfirmMail($emailAddress, $params);
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:7,代码来源:ReissuePasswordForm.class.php


示例4: sendDailyNews

 private function sendDailyNews($app)
 {
     $isAppMobile = 'mobile_frontend' === $app;
     $dailyNewsName = $isAppMobile ? 'mobileDailyNews' : 'dailyNews';
     $context = sfContext::createInstance($this->createConfiguration($app, 'prod'), $app);
     $gadgets = Doctrine::getTable('Gadget')->retrieveGadgetsByTypesName($dailyNewsName);
     $gadgets = $gadgets[$dailyNewsName . 'Contents'];
     $targetMembers = Doctrine::getTable('Member')->findAll();
     foreach ($targetMembers as $member) {
         $address = $member->getEmailAddress();
         if ($isAppMobile !== opToolkit::isMobileEmailAddress($address)) {
             continue;
         }
         $dailyNewsConfig = $member->getConfig('daily_news');
         if (null !== $dailyNewsConfig && 0 === (int) $dailyNewsConfig) {
             continue;
         }
         if (1 === (int) $dailyNewsConfig && !$this->isDailyNewsDay()) {
             continue;
         }
         $filteredGadgets = array();
         if ($gadgets) {
             foreach ($gadgets as $gadget) {
                 if ($gadget->isEnabled($member)) {
                     $filteredGadgets[] = array('component' => array('module' => $gadget->getComponentModule(), 'action' => $gadget->getComponentAction()), 'gadget' => $gadget, 'member' => $member);
                 }
             }
         }
         $params = array('member' => $member, 'gadgets' => $filteredGadgets, 'subject' => $context->getI18N()->__('デイリーニュース'), 'today' => time());
         opMailSend::sendTemplateMail('dailyNews', $address, opConfig::get('admin_mail_address'), $params, $context);
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:32,代码来源:openpneSendDailyNewsTask.class.php


示例5: execute

 protected function execute($arguments = array(), $options = array())
 {
     parent::execute($arguments, $options);
     sfContext::createInstance($this->createConfiguration('pc_frontend', 'prod'), 'pc_frontend');
     $pcGadgets = Doctrine::getTable('Gadget')->retrieveGadgetsByTypesName('dailyNews');
     $mobileGadgets = Doctrine::getTable('Gadget')->retrieveGadgetsByTypesName('mobileDailyNews');
     $targetMembers = Doctrine::getTable('Member')->findAll();
     foreach ($targetMembers as $member) {
         if (!$member->getConfig('daily_news')) {
             continue;
         }
         if (1 == $member->getConfig('daily_news') && !$this->isDailyNewsDay()) {
             continue;
         }
         $address = $member->getEmailAddress();
         $gadgets = $pcGadgets['dailyNewsContents'];
         if (opToolkit::isMobileEmailAddress($address)) {
             $gadgets = $mobileGadgets['mobileDailyNewsContents'];
         }
         $filteredGadgets = array();
         if ($gadgets) {
             foreach ($gadgets as $gadget) {
                 if ($gadget->isEnabled()) {
                     $filteredGadgets[] = array('component' => array('module' => $gadget->getComponentModule(), 'action' => $gadget->getComponentAction()), 'gadget' => $gadget, 'member' => $member);
                 }
             }
         }
         $context = $this->getContextByEmailAddress($address);
         $params = array('member' => $member, 'gadgets' => $filteredGadgets, 'subject' => $context->getI18N()->__('デイリーニュース'), 'today' => time());
         opMailSend::sendTemplateMail('dailyNews', $address, opConfig::get('admin_mail_address'), $params, $context);
     }
 }
开发者ID:TadahiroKudo,项目名称:OpenPNE3,代码行数:32,代码来源:openpneSendDailyNewsTask.class.php


示例6: execute

 protected function execute($arguments = array(), $options = array())
 {
     if (!isset($options['origin'])) {
         $options['origin'] = '2.12';
     }
     if (!in_array($options['origin'], array('2.12', '2.14', '3.4'))) {
         throw new RuntimeException('You must specify "2.12", "2.14" or "3.4" to the --origin option. (--origin オプションには 2.12、 2.14 または 3.4 を指定してください。)');
     }
     sfConfig::set('op_upgrade2_version', $options['origin']);
     $op2config = sfConfig::get('sf_config_dir') . DIRECTORY_SEPARATOR . 'config.OpenPNE2.php';
     if (!is_readable($op2config)) {
         throw new RuntimeException('You must copy the config.php in your OpenPNE2 as config/config.OpenPNE2.php. (お使いの OpenPNE2 の config.php を config/config.OpenPNE2.php としてコピーしてください。)');
     }
     if (!defined('OPENPNE_DIR')) {
         define('OPENPNE_DIR', sfConfig::get('sf_root_dir'));
     }
     require_once $op2config;
     $this->runTask('configure:database', array(opToolkit::createStringDsnFromArray($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']), $GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['username'], empty($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['password']) ? null : $GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['password']));
     $path = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'upgrade' . DIRECTORY_SEPARATOR . '2';
     $upgrader = new opUpgrader($this->dispatcher, $this->formatter, $path, $this->configuration);
     if ($options['rules']) {
         $upgrader->setOption('targets', $options['rules']);
     }
     if ('3.4' === $options['origin']) {
         $upgrader->setDefinitionName('definition-34to36.yml');
     }
     $this->logSection('upgrade', 'Begin upgrading from 2.x');
     $upgrader->execute();
     $task = new sfPluginPublishAssetsTask($this->dispatcher, $this->formatter);
     $task->run(array(), array());
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:31,代码来源:openpneUpgradeFrom2Task.class.php


示例7: configure

 /**
  * @see sfValidatorRegex
  */
 protected function configure($options = array(), $messages = array())
 {
     parent::configure($options, $messages);
     $filter = create_function('$value', 'return preg_quote($value, \'/\');');
     $str = join('|', array_filter(opToolkit::getMobileMailAddressDomains(), $filter));
     $this->setOption('pattern', '/^([^@\\s]+)@(' . $str . ')$/i');
 }
开发者ID:balibali,项目名称:OpenPNE3,代码行数:10,代码来源:sfValidatorMobileEmail.class.php


示例8: save

 public function save()
 {
     foreach ($this->getValues() as $k => $v) {
         opSkinClassicConfig::set($k, $v);
     }
     opToolkit::clearCache();
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:7,代码来源:opSkinClassicColorForm.class.php


示例9: sendTemplateMail

 public static function sendTemplateMail($template, $to, $from, $params = array(), $context = null)
 {
     if (!$to) {
         return false;
     }
     if (empty($params['target'])) {
         $target = opToolkit::isMobileEmailAddress($to) ? 'mobile' : 'pc';
     } else {
         $target = $params['target'];
     }
     if (in_array($target . '_' . $template, Doctrine::getTable('NotificationMail')->getDisabledNotificationNames())) {
         return false;
     }
     if (null === $context) {
         $context = sfContext::getInstance();
     }
     $body = self::getMailTemplate($template, $target, $params, false, $context);
     $signature = self::getMailTemplate('signature', $target, array(), true, $context);
     if ($signature) {
         $signature = "\n" . $signature;
     }
     $subject = $params['subject'];
     $notificationMail = Doctrine::getTable('NotificationMail')->fetchTemplate($target . '_' . $template);
     if ($notificationMail instanceof NotificationMail && $notificationMail->getTitle()) {
         $subject = $notificationMail->getTitle();
         $templateStorage = new sfTemplateStorageString($subject);
         $renderer = new opTemplateRendererTwig();
         $params['sf_type'] = null;
         $parameterHolder = new sfViewParameterHolder($context->getEventDispatcher(), $params);
         $subject = $renderer->evaluate($templateStorage, $parameterHolder->toArray());
         $notificationMail->free(true);
     }
     return self::execute($subject, $to, $from, $body . $signature);
 }
开发者ID:shotaatago,项目名称:OpenPNE3,代码行数:34,代码来源:opMailSend.class.php


示例10: doClean

 /**
  * @see sfValidatorString
  */
 protected function doClean($value)
 {
     $clean = parent::doClean($value);
     if (opToolkit::isMobileEmailAddress($clean)) {
         throw new sfValidatorError($this, 'invalid', array('value' => $value));
     }
     return $clean;
 }
开发者ID:balibali,项目名称:OpenPNE3,代码行数:11,代码来源:opValidatorPCEmail.class.php


示例11: getPresetConfig

 public function getPresetConfig()
 {
     $list = opToolkit::getPresetProfileList();
     if (!empty($list[$this->getRawPresetName()])) {
         return $list[$this->getRawPresetName()];
     }
     return array();
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:8,代码来源:Profile.class.php


示例12: executeRequestRegisterURL

 public function executeRequestRegisterURL($request)
 {
     $adapter = new opAuthAdapterMailAddress('MailAddress');
     if ($adapter->getAuthConfig('invite_mode') < 2) {
         $this->forward404();
     }
     $this->forward404Unless(opToolkit::isEnabledRegistration());
     return sfView::INPUT;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:9,代码来源:actions.class.php


示例13: getRandom

 protected function getRandom($length)
 {
     if (is_callable(array('opToolkit', 'getRandom'))) {
         // for OpenPNE3.6 <=
         return opToolkit::getRandom($length);
     }
     mt_srand();
     return substr(md5(mt_rand()), 0, $length);
 }
开发者ID:kawahara,项目名称:opCsvPlugin,代码行数:9,代码来源:actions.class.php


示例14:

 public function &getAll($isStripNullbyte = true)
 {
     if ($isStripNullbyte) {
         $value = opToolkit::stripNullByteDeep(parent::getAll());
     } else {
         $value =& parent::getAll();
     }
     return $value;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:9,代码来源:opParameterHolder.class.php


示例15: getPackageInfo

 protected function getPackageInfo()
 {
     $xmlPath = sfConfig::get('sf_plugins_dir') . '/' . $this->getName() . '/package.xml';
     if (!is_readable($xmlPath)) {
         return false;
     }
     $content = file_get_contents($xmlPath);
     return opToolkit::loadXmlString($content, array('return' => 'SimpleXMLElement'));
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:9,代码来源:opPlugin.class.php


示例16: executeCache

 public function executeCache(sfWebRequest $request)
 {
     $this->form = new sfForm();
     if ($request->isMethod(sfWebRequest::POST)) {
         $request->checkCSRFProtection();
         opToolkit::clearCache();
         $this->getUser()->setFlash('notice', 'Caches are now cleared.');
         $this->redirect('sns/cache');
     }
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:10,代码来源:actions.class.php


示例17: generateMobileUidCookie

 public function generateMobileUidCookie()
 {
     $request = sfContext::getInstance()->getRequest();
     if (!$request->isMobile() || !$request->isCookie()) {
         return false;
     }
     $value = opToolkit::getRandom();
     $this->setCookie(opWebRequest::MOBILE_UID_COOKIE_NAME, $value, strtotime('+20years'));
     return $value;
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:10,代码来源:opWebResponse.class.php


示例18: getAPICaptions

 public function getAPICaptions()
 {
     $apiList = array();
     foreach (opToolkit::retrieveAPIList() as $key => $value) {
         if (in_array($key, $this->getUsingApis())) {
             $apiList[] = $value;
         }
     }
     return $apiList;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:10,代码来源:OAuthConsumerInformation.class.php


示例19: configure

 public function configure()
 {
     unset($this['created_at'], $this['updated_at'], $this['file_id'], $this['key_string'], $this['secret'], $this['member_id']);
     $this->setWidget('image', new sfWidgetFormInputFile());
     $this->setValidator('image', new opValidatorImageFile(array('required' => false)));
     $apis = opToolkit::retrieveAPIList();
     $this->setWidget('using_apis', new sfWidgetFormSelectMany(array('choices' => $apis), array('size' => 10)));
     $this->setValidator('using_apis', new sfValidatorChoice(array('multiple' => true, 'choices' => array_keys($apis))));
     $this->getWidgetSchema()->setHelp('using_apis', 'Select apis that your application needs.');
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('api');
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:11,代码来源:OAuthConsumerInformationForm.class.php


示例20: appendMobileInputMode

 protected function appendMobileInputMode()
 {
     parent::appendMobileInputMode();
     foreach ($this as $k => $v) {
         $widget = $this->widgetSchema[$k];
         $validator = $this->validatorSchema[$k];
         if ($widget instanceof opWidgetFormInputIncreased) {
             opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'numeric');
         }
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:11,代码来源:MemberConfigAccessBlock.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP openSRS_base类代码示例发布时间:2022-05-23
下一篇:
PHP opConfig类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap