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

PHP PluginRegistrarInsights类代码示例

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

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



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

示例1: crawl

 public function crawl()
 {
     $logger = Logger::getInstance();
     // Include all the insights files so they register themselves
     foreach (glob(THINKUP_WEBAPP_PATH . "plugins/insightsgenerator/insights/*.php") as $filename) {
         require_once $filename;
     }
     //Get instances by owner
     $instance_dao = DAOFactory::getDAO('InstanceDAO');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $current_owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $instances = $instance_dao->getByOwner($current_owner, false, true);
     // Get posts for last 7 days
     $number_days = 7;
     $post_dao = DAOFactory::getDAO('PostDAO');
     $insights_plugin_registrar = PluginRegistrarInsights::getInstance();
     foreach ($instances as $instance) {
         $last_week_of_posts = $post_dao->getAllPostsByUsernameOrderedBy($instance->network_username, $network = $instance->network, $count = 0, $order_by = "pub_date", $in_last_x_days = $number_days, $iterator = false, $is_public = false);
         $insights_plugin_registrar->runRegisteredPluginsInsightGeneration($instance, $last_week_of_posts, $number_days);
         $logger->logUserSuccess("Completed insight generation for " . $instance->network_username . " on " . $instance->network, __METHOD__ . ',' . __LINE__);
     }
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:22,代码来源:class.InsightsGeneratorPlugin.php


示例2:

                }
            }
            if ($video_dao->doesUserHaveVideosWithLikesSinceDate($instance->network_username, $instance->network, 90, $since_date)) {
                //Save average likes over past 90 days
                $average_like_count_90_days = null;
                $average_like_count_90_days = $video_dao->getAverageLikeCount($instance->network_username, $instance->network, 90, $since_date);
                if ($average_like_count_90_days != null) {
                    $insight_baseline_dao->insertInsightBaseline('avg_like_count_last_90_days', $instance->id, $average_like_count_90_days, $since_date);
                    $this->logger->logSuccess("Averaged {$average_like_count_90_days} likes in the 90 days before " . $since_date, __METHOD__ . ',' . __LINE__);
                }
                //Save like high for last 90 days
                $high_like_count_90_days = $video_dao->getHighestLikes($instance->network_username, $instance->network, 90, $since_date);
                if ($high_like_count_90_days != null) {
                    $insight_baseline_dao->insertInsightBaseline('high_like_count_last_90_days', $instance->id, $high_like_count_90_days, $since_date);
                    $this->logger->logSuccess("High of {$high_like_count_90_days} likes in the 90 days before " . $since_date, __METHOD__ . ',' . __LINE__);
                }
            }
            if ($video_dao->doesUserHaveVideosWithLikesSinceDate($instance->network_username, $instance->network, 365, $since_date)) {
                //Save like high for last 365 days
                $high_like_count_365_days = $video_dao->getHighestLikes($instance->network_username, $instance->network, 365, $since_date);
                if ($high_like_count_365_days != null) {
                    $insight_baseline_dao->insertInsightBaseline('high_like_count_last_365_days', $instance->id, $high_like_count_365_days, $since_date);
                    $this->logger->logSuccess("High of {$high_like_count_365_days} likes in the 365 days before " . $since_date, __METHOD__ . ',' . __LINE__);
                }
            }
            $days_ago++;
        }
    }
}
$insights_plugin_registrar = PluginRegistrarInsights::getInstance();
$insights_plugin_registrar->registerInsightPlugin('LikeSpikeInsight');
开发者ID:dgw,项目名称:ThinkUp,代码行数:31,代码来源:likespike.php


示例3: crawl

 public function crawl()
 {
     $logger = Logger::getInstance();
     // Include all the insights files so they register themselves
     foreach (glob(THINKUP_WEBAPP_PATH . "plugins/insightsgenerator/insights/*.php") as $filename) {
         require_once $filename;
     }
     //Get instances by owner
     $instance_dao = DAOFactory::getDAO('InstanceDAO');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $current_owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $instances = $instance_dao->getByOwner($current_owner, false, true);
     // Get posts for last 7 days
     $number_days = 7;
     $post_dao = DAOFactory::getDAO('PostDAO');
     $insights_plugin_registrar = PluginRegistrarInsights::getInstance();
     foreach ($instances as $instance) {
         $last_week_of_posts = $post_dao->getAllPostsByUsernameOrderedBy($instance->network_username, $network = $instance->network, $count = 0, $order_by = "pub_date", $in_last_x_days = $number_days, $iterator = false, $is_public = false);
         $insights_plugin_registrar->runRegisteredPluginsInsightGeneration($instance, $last_week_of_posts, $number_days);
         $logger->logUserSuccess("Completed insight generation for " . $instance->network_username . " on " . $instance->network, __METHOD__ . ',' . __LINE__);
     }
     // Don't do email for regular users
     if (!$current_owner->is_admin) {
         return;
     }
     // Send email digest the first run after 4am
     if ((int) date('G', $this->current_timestamp) >= 4) {
         //Get plugin options
         $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
         $options = $plugin_option_dao->getOptionsHash($this->folder_name, true);
         //Get plugin ID
         $plugin_dao = DAOFactory::getDAO('PluginDAO');
         $plugin_id = $plugin_dao->getPluginId($this->folder_name);
         //Get today's date
         $today = date('Y-m-d', $this->current_timestamp);
         $do_daily = false;
         $do_weekly = false;
         $last_daily = isset($options['last_daily_email']) ? $options['last_daily_email']->option_value : null;
         if ($last_daily != $today) {
             if ($last_daily === null) {
                 $plugin_option_dao->insertOption($plugin_id, 'last_daily_email', $today);
             } else {
                 $plugin_option_dao->updateOption($options['last_daily_email']->id, 'last_daily_email', $today);
             }
             $do_daily = true;
         }
         $last_weekly = isset($options['last_weekly_email']) ? $options['last_weekly_email']->option_value : null;
         if ($last_weekly != $today && date('w', $this->current_timestamp) == self::WEEKLY_DIGEST_DAY_OF_WEEK) {
             if ($last_weekly === null) {
                 $plugin_option_dao->insertOption($plugin_id, 'last_weekly_email', $today);
             } else {
                 $plugin_option_dao->updateOption($options['last_weekly_email']->id, 'last_weekly_email', $today);
             }
             $do_weekly = true;
         }
         if ($do_daily || $do_weekly) {
             $owners = $owner_dao->getAllOwners();
         }
         if ($do_daily) {
             foreach ($owners as $owner) {
                 if ($this->sendDailyDigest($owner, $options)) {
                     $logger->logUserSuccess("Mailed daily digest to " . $owner->email . ".", __METHOD__ . ',' . __LINE__);
                 }
             }
         }
         if ($do_weekly) {
             foreach ($owners as $owner) {
                 if ($this->sendWeeklyDigest($owner, $options)) {
                     $logger->logUserSuccess("Mailed weekly digest to " . $owner->email . ".", __METHOD__ . ',' . __LINE__);
                 }
             }
         }
     }
 }
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:74,代码来源:class.InsightsGeneratorPlugin.php


示例4: destroyInstance

 /**
  * Provided only for tests that want to kill object in tearDown()
  * @return void
  */
 public static function destroyInstance()
 {
     if (isset(self::$instance)) {
         self::$instance = null;
     }
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:10,代码来源:class.PluginRegistrarInsights.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP PluginRegistrarWebapp类代码示例发布时间:2022-05-23
下一篇:
PHP PluginMonitoringProfile类代码示例发布时间: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