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


PHP content::get_tweets_count方法代码示例

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


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

示例1: admin


//.........这里部分代码省略.........
                            $campaign = content::get_campaign($params[2]);
                            $campaign_html = '';
                            foreach ($campaign as $q) {
                                $campaign_html .= $q['html'];
                            }
                            // build up the extra elements specifically for the campaign details - not the queries
                            $campaign_details = \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/label_wrap.php', array('label' => 'Campaign Name', 'element' => \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/input_text.php', array('value' => "value=\"{$campaign[0]['name']}\"", 'placeholder' => "placeholder=\"campaign name\"", 'name' => 'name'))));
                            $campaign_details .= \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/label_wrap.php', array('label' => 'URL', 'element' => \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/input_text.php', array('value' => "value=\"{$campaign[0]['url']}\"", 'placeholder' => "placeholder=\"campaign url\"", 'name' => 'url'))));
                            $campaign_details .= \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/label_wrap.php', array('label' => 'Start', 'element' => \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/input_date.php', array('value' => "value=\"{$campaign[0]['start']}\"", 'placeholder' => "placeholder=\"start date\"", 'name' => 'start'))));
                            $campaign_details .= \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/label_wrap.php', array('label' => 'End', 'element' => \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/input_date.php', array('value' => "value=\"{$campaign[0]['end']}\"", 'placeholder' => "placeholder=\"end date\"", 'name' => 'end'))));
                            $deactivated = array();
                            foreach (array('yes', 'no') as $d) {
                                $deactivated[] = \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/input_option.php', array('selected' => $d == $campaign[0]['force_deactivated'] ? 'selected="selected"' : '', 'value' => $d, 'display_value' => $d));
                            }
                            $campaign_details .= \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/label_wrap.php', array('label' => 'Force Deactivated?', 'element' => \helpers\html\html::load_snippet(MAVERICK_BASEDIR . 'vendor/helpers/html/snippets/input_select.php', array('values' => implode('', $deactivated), 'name' => 'force_deactivated'))));
                            $view_params = array('campaign_fields' => $campaign_html, 'campaign_buttons' => $campaign_buttons, 'campaign_details' => $campaign_details, 'scripts' => array('/js/campaigns.js' => 10, 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js' => 5));
                            if ($errors) {
                                $view_params['errors'] = $errors;
                            }
                            $this->load_view('campaign_edit', $view_params);
                        } else {
                            return false;
                        }
                        // just bomb out if people are fucking with the URL
                        break;
                    case 'new_campaign':
                        $campaign_id = content::create_new_campaign();
                        view::redirect('/' . $this->app->get_config('tweed.admin_path') . "/campaign/edit/{$campaign_id}");
                        break;
                    case 'deactivate':
                    case 'reactivate':
                        // just bomb out if people are fucking with the URL
                        if (empty($params[2]) || !intval($params[2])) {
                            return false;
                        }
                        content::set_campaign_status($params[2], $params[1]);
                        view::redirect('/' . $this->app->get_config('tweed.admin_path'));
                        break;
                }
                break;
            case 'tweets':
                $errors = false;
                // todo: generate fetch parameters based on the passed in filter options
                $pagination_filter = array();
                foreach (array('campaign', 'lang', 'user', 'after') as $filter) {
                    if (!empty($_REQUEST[$filter])) {
                        ${$filter} = $_REQUEST[$filter];
                        $pagination_filter[] = "{$filter}=" . filter_var($_REQUEST[$filter], FILTER_SANITIZE_SPECIAL_CHARS);
                    } else {
                        ${$filter} = null;
                    }
                }
                $current_page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
                // get the tweets (with any specified filter parameters if available)
                $tweets = content::get_tweets(null, $this->app->get_config('twitter.total'), $current_page, $lang, $user, null, null, null, null, null);
                $tweets_count = content::get_tweets_count(null, $lang, $user, null, null, null, null, null);
                // get the pagination string
                $pagination_links = $this->get_pagination('/' . $this->app->get_config('tweed.admin_path') . '/tweets', $current_page, $tweets_count, $pagination_filter);
                // create the table
                $headers = '["ID #","Campaign","Lang","User","Sent At","Retweet?","Reply?","Approved?","Content","Actions"]';
                $data = array();
                if (is_array($tweets)) {
                    foreach ($tweets as $tweet) {
                        $tweet_actions = array($tweet['approved'] == 'no' ? 'approve' : 'unapprove');
                        $data[] = array($tweet['id'], $tweet['campaign_name'], $tweet['iso_lang'], $tweet['user_screen_name'], date("l, jS M, Y", strtotime($tweet['created_at'])), intval($tweet['retweet_count']) ? 'yes' : 'no', intval($tweet['in_reply_to_id']) ? 'yes' : 'no', $tweet['approved'], $tweet['content'], content::generate_actions('tweets', $tweet['id'], $tweet_actions));
                    }
                } else {
                    $errors = "<span class=\"error\">{$tweets}</span>";
                }
                $tweets_table = new \helpers\html\tables('forms', 'layout', $data, $headers);
                $tweets_table->class = 'item_table tweets';
                // create the filter form
                // campaign list
                $campaign_list = content::get_all_campaigns();
                foreach ($campaign_list as &$c) {
                    $c = "\"{$c['name']}\"";
                }
                // language list
                $languages = content::get_languages();
                foreach ($languages as &$l) {
                    $l = "\"{$l['iso_lang']}\"";
                }
                $filter_form_elements = '{
					"campaign":{"type":"select","label":"Campaign","values":["",' . implode(',', $campaign_list) . ']},
					"lang":{"type":"select","label":"Language","values":["",' . implode(',', $languages) . ']},
					"user":{"type":"text","label":"User"},
					"after":{"type":"date","placeholder":"' . date("Y-m-d H:i:s") . '","label":"Sent after"},
					"submit":{"type":"submit","value":"Filter","class":"action filter full"}
				}';
                $filter_form = new \helpers\html\form('filter_form', $filter_form_elements);
                // set up the view
                $view_params = array('tweets_table' => $tweets_table->render(), 'filter_form' => $filter_form->render(), 'pagination' => $pagination_links, 'scripts' => array('/js/tweets.js' => 10));
                // add in any errors that might have been generated which should be shown to the user
                if ($errors) {
                    $view_params['errors'] = $errors;
                }
                $this->load_view('tweets', $view_params);
                break;
        }
    }
开发者ID:AshleyJSheridan,项目名称:tweed,代码行数:101,代码来源:admin_controller.php


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