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


PHP osc_file_get_contents函数代码示例

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


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

示例1: __construct

 function __construct()
 {
     parent::__construct();
     osc_run_hook('init_admin');
     // check if exist a new version each day
     if (time() - osc_last_version_check() > 24 * 3600) {
         $data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?');
         $data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data);
         $json = json_decode($data);
         if ($json->version > osc_version()) {
             osc_set_preference('update_core_json', $data);
         } else {
             osc_set_preference('update_core_json', '');
         }
         osc_set_preference('last_version_check', time());
         osc_reset_preferences();
     }
     $config_version = str_replace('.', '', OSCLASS_VERSION);
     $config_version = preg_replace('|-.*|', '', $config_version);
     if ($config_version > Preference::newInstance()->get('version')) {
         if (get_class($this) == 'CAdminTools') {
         } else {
             if (get_class($this) != 'CAdminUpgrade') {
                 $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
             }
         }
     }
 }
开发者ID:randomecho,项目名称:OSClass,代码行数:28,代码来源:AdminSecBaseModel.php

示例2: osc_latestTweets

function osc_latestTweets($num = 5)
{
    require_once osc_lib_path() . 'osclass/classes/Cache.php';
    $cache = new Cache('admin-twitter', 900);
    if ($cache->check()) {
        return $cache->retrieve();
    }
    $list = array();
    $content = osc_file_get_contents('https://twitter.com/statuses/user_timeline/osclass.rss');
    if ($content) {
        $xml = simplexml_load_string($content);
        if (isset($xml->error)) {
            return $list;
        }
        $count = 0;
        foreach ($xml->channel->item as $item) {
            $list[] = array('link' => strval($item->link), 'title' => strval($item->title), 'pubDate' => strval($item->pubDate));
            $count++;
            if ($count == $num) {
                break;
            }
        }
    }
    $cache->store($list);
    return $list;
}
开发者ID:semul,项目名称:Osclass,代码行数:26,代码来源:feeds.php

示例3: __construct

 function __construct()
 {
     parent::__construct();
     // check if is moderator and can enter to this page
     if ($this->isModerator()) {
         if (!in_array($this->page, array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats', ''))) {
             osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin');
             $this->redirectTo(osc_admin_base_url());
         }
     }
     osc_run_hook('init_admin');
     // check if exist a new version each day
     if (time() - osc_last_version_check() > 24 * 3600) {
         $data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?');
         $data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data);
         $json = json_decode($data);
         if ($json->version > osc_version()) {
             osc_set_preference('update_core_json', $data);
         } else {
             osc_set_preference('update_core_json', '');
         }
         osc_set_preference('last_version_check', time());
         osc_reset_preferences();
     }
     $config_version = str_replace('.', '', OSCLASS_VERSION);
     $config_version = preg_replace('|-.*|', '', $config_version);
     if ($config_version > Preference::newInstance()->get('version')) {
         if (get_class($this) == 'CAdminTools') {
         } else {
             if (get_class($this) != 'CAdminUpgrade') {
                 $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
             }
         }
     }
     // show messages subscribed
     $status_subscribe = Params::getParam('subscribe_osclass');
     if ($status_subscribe != '') {
         switch ($status_subscribe) {
             case -1:
                 osc_add_flash_error_message(_m('Entered an invalid email'), 'admin');
                 break;
             case 0:
                 osc_add_flash_warning_message(_m("You're already subscribed"), 'admin');
                 break;
             case 1:
                 osc_add_flash_ok_message(_m('Subscribed correctly'), 'admin');
                 break;
             default:
                 osc_add_flash_warning_message(_m("Error subscribing"), 'admin');
                 break;
         }
     }
     // show donation successful
     if (Params::getParam('donation') == 'successful') {
         osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin');
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:57,代码来源:AdminSecBaseModel.php

示例4: button

    /**
     * Create and print a "Pay with Paypal" button
     *
     * @param float $amount
     * @param string $description
     * @param string $itemnumber (publish fee, premium, pack and which category)
     * @param string $extra custom variables
     */
    public static function button($amount = '0.00', $description = '', $itemnumber = '101', $extra_array = null)
    {
        if (osc_get_preference('currency', 'payment') != 'BTC') {
            $amount = osc_file_get_contents("https://blockchain.info/tobtc?currency=" . osc_get_preference('currency', 'payment') . "&value=" . $amount);
        }
        $extra = payment_prepare_custom($extra_array);
        $extra .= 'concept,' . $description . '|';
        $extra .= 'product,' . $itemnumber . '|';
        $r = rand(0, 1000);
        $extra .= 'random,' . $r;
        $CALLBACK_URL = osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'callback.php?extra=' . $extra;
        ?>
            <li class="payment bitcoin-btn">
            <div class="blockchain-btn"
            data-address="<?php 
        echo osc_get_preference('blockchain_btc_address', 'payment');
        ?>
"
            data-anonymous="false"
            data-callback="<?php 
        echo $CALLBACK_URL;
        ?>
">
                <div class="blockchain stage-begin">
                    <img src="<?php 
        echo osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__);
        ?>
pay_now_64.png">
                </div>
                <div class="blockchain stage-loading" style="text-align:center">
                    <img src="<?php 
        echo osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__);
        ?>
loading-large.gif">
                </div>
                <div class="blockchain stage-ready">
                    <p align="center"><?php 
        printf(__('Please send %f BTC to <br /> <b>[[address]]</b></p>', 'payment'), $amount);
        ?>
                    <p align="center" class="qr-code"></p>
                </div>
                <div class="blockchain stage-paid">
                    <?php 
        _e('Payment Received <b>[[value]] BTC</b>. Thank You.', 'payment');
        ?>
                </div>
                <div class="blockchain stage-error">
                    <span color="red">[[error]]</span>
                </div>
            </div>
            </li>
        <?php 
    }
开发者ID:virsoni,项目名称:plugin-payment,代码行数:61,代码来源:Blockchain.php

示例5: insert_geo_location

function insert_geo_location($aItem)
{
    $sAddress = isset($aItem['s_address']) ? $aItem['s_address'] : '';
    $sRegion = isset($aItem['s_region']) ? $aItem['s_region'] : '';
    $sCity = isset($aItem['s_city']) ? $aItem['s_city'] : '';
    $address = sprintf('%s, %s %s', $sAddress, $sRegion, $sCity);
    $response = osc_file_get_contents(sprintf('http://maps.google.com/maps/geo?q=%s&output=json&sensor=false', urlencode($address)));
    $jsonResponse = json_decode($response);
    if (isset($jsonResponse->Placemark) && count($jsonResponse->Placemark[0]) > 0) {
        $coord = $jsonResponse->Placemark[0]->Point->coordinates;
        ItemLocation::newInstance()->update(array('d_coord_lat' => $coord[1], 'd_coord_long' => $coord[0]), array('fk_i_item_id' => $aItem['pk_i_id']));
    }
}
开发者ID:bomvendador,项目名称:soroka_r,代码行数:13,代码来源:index.php

示例6: __construct

        function __construct()
        {
            parent::__construct();

            // check if is moderator and can enter to this page
            if( $this->isModerator() ) {
                if( !in_array($this->page, osc_apply_filter('moderator_access', array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats',''))) ) {
                    osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin');
                    $this->redirectTo(osc_admin_base_url());
                }
            }

            osc_run_hook( 'init_admin' );

            // check if exist a new version each day
            if( (time() - osc_last_version_check()) > (24 * 3600) ) {
                $data = osc_file_get_contents('http://osclass.org/latest_version_v1.php?callback=?');
                $data = preg_replace('|^\?\((.*?)\);$|', '$01', $data);
                $json = json_decode($data);
                if( $json->version > osc_version() ) {
                    osc_set_preference( 'update_core_json', $data );
                } else {
                    osc_set_preference( 'update_core_json', '' );
                }
                osc_set_preference( 'last_version_check', time() );
                osc_reset_preferences();
            }

            $config_version = str_replace('.', '', OSCLASS_VERSION);
            $config_version = preg_replace('|-.*|', '', $config_version);

            if( $config_version > osc_get_preference('version') ) {
                if(get_class($this) == 'CAdminTools') {
                } else {
                    if(get_class($this) != 'CAdminUpgrade' )
                        $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
                }
            }

            // show donation successful
            if( Params::getParam('donation') == 'successful' ) {
                osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin');
            }

            // enqueue scripts
            osc_enqueue_script('jquery');
            osc_enqueue_script('jquery-ui');
            osc_enqueue_script('admin-osc');
            osc_enqueue_script('admin-ui-osc');
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:50,代码来源:AdminSecBaseModel.php

示例7: insert_geo_location

function insert_geo_location($item)
{
    $itemId = $item['pk_i_id'];
    $aItem = Item::newInstance()->findByPrimaryKey($itemId);
    $sAddress = isset($aItem['s_address']) ? $aItem['s_address'] : '';
    $sCity = isset($aItem['s_city']) ? $aItem['s_city'] : '';
    $sRegion = isset($aItem['s_region']) ? $aItem['s_region'] : '';
    $sCountry = isset($aItem['s_country']) ? $aItem['s_country'] : '';
    $address = sprintf('%s, %s, %s, %s', $sAddress, $sCity, $sRegion, $sCountry);
    $response = osc_file_get_contents(sprintf('https://maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false', urlencode($address)));
    $jsonResponse = json_decode($response);
    if (isset($jsonResponse->results[0]->geometry->location) && count($jsonResponse->results[0]->geometry->location) > 0) {
        $location = $jsonResponse->results[0]->geometry->location;
        $lat = $location->lat;
        $lng = $location->lng;
        ItemLocation::newInstance()->update(array('d_coord_lat' => $lat, 'd_coord_long' => $lng), array('fk_i_item_id' => $itemId));
    }
}
开发者ID:keramist,项目名称:Osclass,代码行数:18,代码来源:index.php

示例8: osc_listNews

/**
 * This functions retrieves a news list from http://osclass.org. It uses the Cache services to speed up the process.
 */
function osc_listNews()
{
    require_once LIB_PATH . 'osclass/classes/Cache.php';
    $cache = new Cache('admin-blog_news', 900);
    if ($cache->check()) {
        return $cache->retrieve();
    } else {
        $list = array();
        $content = osc_file_get_contents('http://osclass.org/feed/');
        if ($content) {
            $xml = simplexml_load_string($content);
            foreach ($xml->channel->item as $item) {
                $list[] = array('link' => strval($item->link), 'title' => strval($item->title), 'pubDate' => strval($item->pubDate));
            }
        }
        $cache->store($list);
    }
    return $list;
}
开发者ID:acharei,项目名称:OSClass,代码行数:22,代码来源:feeds.php

示例9: listcloud_CloudDump

function listcloud_CloudDump()
{
    require_once LIB_PATH . 'osclass/classes/Cache.php';
    $cache = new Cache('listcloud_feeds', 900);
    if ($cache->check()) {
        return $cache->retrieve();
    } else {
        $list = array();
        $content = osc_file_get_contents(osc_base_url() . 'index.php?page=search&sFeed=rss');
        if ($content) {
            $xml = simplexml_load_string($content);
            foreach ($xml->channel->item as $item) {
                $list[] = array('title' => strval($item->title));
            }
        }
        $cache->store($list);
    }
    return $list;
}
开发者ID:fear-otaku,项目名称:oc-listcloud,代码行数:19,代码来源:index.php

示例10: button

    public static function button($products, $extra = null)
    {
        $items = array();
        $amount = 0;
        foreach ($products as $p) {
            $amount += $p['amount'] * $p['quantity'];
        }
        if (osc_get_preference('currency', 'payment_pro') != 'BTC') {
            $amount = osc_file_get_contents("https://blockchain.info/tobtc?currency=" . osc_get_preference('currency', 'payment_pro') . "&value=" . $amount);
            $xrate = osc_file_get_contents("https://blockchain.info/tobtc?currency=" . osc_get_preference('currency', 'payment_pro') . "&value=1");
            if (is_numeric($xrate)) {
                $extra['xrate'] = $xrate;
                osc_set_preference('blockchain_xrate', $xrate, 'payment_pro');
            } else {
                osc_get_preference('blockchain_xrate', 'payment_pro');
            }
        } else {
            $extra['xrate'] = 1;
        }
        $tx_id = ModelPaymentPro::newInstance()->pendingInvoice($products);
        $r = rand(0, 1000);
        $extra['random'] = $r;
        $extra['tx'] = $tx_id;
        $extra = payment_pro_set_custom($extra);
        ?>
            <li class="payment bitcoin-btn">
            <div class="blockchain-btn"
            data-address="<?php 
        echo osc_get_preference('blockchain_btc_address', 'payment_pro');
        ?>
"
            data-anonymous="false"
            data-callback="<?php 
        echo osc_route_url('blockchain-notify', array('extra' => str_replace("+", "@", $extra)));
        ?>
">
                <div  style="cursor:pointer;cursor:hand" class="blockchain stage-begin">
                    <img src="<?php 
        echo PAYMENT_PRO_URL;
        ?>
payments/blockchain/pay_now_64.png">
                </div>
                <div class="blockchain stage-loading" style="text-align:center">
                    <img src="<?php 
        echo PAYMENT_PRO_URL;
        ?>
payments/blockchain/loading-large.gif">
                </div>
                <div class="blockchain stage-ready">
                    <p align="center"><?php 
        printf(__('Please send %f BTC to <br /> <b>[[address]]</b></p>', 'payment_pro'), $amount);
        ?>
                    <p align="center" class="qr-code"></p>
                </div>
                <div class="blockchain stage-paid">
                    <p><?php 
        _e('Payment Received <b>[[value]] BTC</b>. Thank You.', 'payment_pro');
        ?>
</p>
                    <a href="<?php 
        echo osc_route_url('payment-pro-done', array('tx' => $tx_id));
        ?>
"><?php 
        _e('Click here to continue', 'payment_pro');
        ?>
</a>
                </div>
                <div class="blockchain stage-error">
                    <span color="red">[[error]]</span>
                </div>
            </div>
            </li>
        <?php 
    }
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:74,代码来源:BlockchainPayment.php

示例11: doModel

 function doModel()
 {
     parent::doModel();
     if (time() - (int) osc_market_data_update() > 86400) {
         //84600 = 24*60*60
         $json = osc_file_get_contents(osc_market_url() . 'categories/', array('api_key' => osc_market_api_connect()));
         $data = @json_decode($json, true);
         if (is_array($data)) {
             osc_set_preference('marketCategories', $json);
             osc_set_preference('marketDataUpdate', time());
             osc_reset_preferences();
         }
     }
     switch ($this->action) {
         case 'buy':
             osc_csrf_check();
             $json = osc_file_get_contents(osc_market_url() . 'token/', array('api_key' => osc_market_api_connect()));
             $data = json_decode($json, true);
             osc_redirect_to(Params::getParam('url') . '?token=' . @$data['token']);
             break;
         case 'purchases':
         case 'plugins':
         case 'themes':
         case 'languages':
             $section = $this->action;
             $title = array('plugins' => __('Recommended plugins for You'), 'themes' => __('Recommended themes for You'), 'languages' => __('Languages for this version'), 'purchases' => __('My purchases'));
             // page number
             $marketPage = Params::getParam("mPage");
             $url_actual = osc_admin_base_url(true) . '?page=market&action=' . $section . '&mPage=' . $marketPage;
             if ($marketPage >= 1) {
                 $marketPage--;
             }
             // api
             $url = osc_market_url($section) . (Params::getParam('sCategory') != '' ? 'category/' . Params::getParam('sCategory') . '/' : '') . "page/" . $marketPage . '/length/9/';
             // default sort
             $sort_actual = '';
             $sort_download = $url_actual . '&sort=downloads&order=desc';
             $sort_updated = $url_actual . '&sort=updated&order=desc';
             // sorting options (default)
             $_order = 'desc';
             $order_download = $_order;
             $order_updated = $_order;
             $sort = Params::getParam("sort");
             $order = Params::getParam("order");
             if ($sort == '') {
                 $sort = 'updated';
             }
             if ($order == '') {
                 $order = $_order;
             }
             $aux = $order == 'desc' ? 'asc' : 'desc';
             switch ($sort) {
                 case 'downloads':
                     $sort_actual = '&sort=downloads&order=';
                     $sort_download = $url_actual . $sort_actual . $aux;
                     $sort_actual .= $order;
                     $order_download = $order;
                     // market api call
                     $url .= 'order/downloads/' . $order;
                     break;
                 case 'updated':
                     $sort_actual = '&sort=updated&order=';
                     $sort_updated = $url_actual . $sort_actual . $aux;
                     $sort_actual .= $order;
                     $order_updated = $order;
                     // market api call
                     $url .= 'order/updated/' . $order;
                     break;
                 default:
                     break;
             }
             // pageSize or length attribute is hardcoded
             $out = osc_file_get_contents($url, array('api_key' => osc_market_api_connect()));
             $array = json_decode($out, true);
             $output_pagination = '';
             if (is_numeric($array['total']) && $array['total'] > 0) {
                 $totalPages = ceil($array['total'] / $array['sizePage']);
                 $pageActual = $array['page'];
                 $params = array('total' => $totalPages, 'selected' => $pageActual, 'url' => osc_admin_base_url(true) . '?page=market' . '&amp;action=' . $section . '&amp;mPage={PAGE}' . $sort_actual, 'sides' => 5);
                 // set pagination
                 $pagination = new Pagination($params);
                 $output_pagination = $pagination->doPagination();
             } else {
                 $array['total'] = 0;
             }
             // export variable to view
             $this->_exportVariableToView("sort", $sort);
             $this->_exportVariableToView("title", $title);
             $this->_exportVariableToView("section", $section);
             $this->_exportVariableToView("array", $array);
             $this->_exportVariableToView("sort_download", $sort_download);
             $this->_exportVariableToView("sort_updated", $sort_updated);
             $this->_exportVariableToView("order_download", $order_download);
             $this->_exportVariableToView("order_updated", $order_updated);
             $this->_exportVariableToView("market_categories", json_decode(osc_market_categories(), true));
             $this->_exportVariableToView('pagination', $output_pagination);
             $this->doView("market/section.php");
             break;
         default:
             $aPlugins = array();
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:market.php

示例12: install_location_by_region

 function install_location_by_region()
 {
     $countryParent = Params::getParam('country_c_parent');
     $region = Params::getParam('region');
     if ($countryParent == '') {
         return false;
     }
     if ($region == '') {
         return false;
     }
     $manager_country = new Country();
     $country = $manager_country->findByCode($countryParent);
     $aCountry = array();
     $aRegion = array();
     $aCountry[] = $country['s_name'];
     $aRegion[] = $region;
     $manager_region = new Region();
     $regions_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=region&country=' . urlencode(implode(',', $aCountry)) . '&term=' . urlencode(implode(',', $aRegion)));
     $regions = json_decode($regions_json);
     if (isset($regions->error)) {
         osc_add_flash_error_message(sprintf(_m("%s can't be added"), $region), 'admin');
         return false;
     }
     foreach ($regions as $r) {
         $exists = $manager_region->findByName($r->name, $r->country_code);
         if (isset($exists['s_name'])) {
             osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $exists['s_name']), 'admin');
             return false;
         }
         $manager_region->insert(array("fk_c_country_code" => $r->country_code, "s_name" => $r->name));
     }
     unset($regions);
     unset($regions_json);
     $manager_city = new City();
     foreach ($country as $c) {
         $regions = $manager_region->findByName($region, $country['pk_c_code']);
         $cities_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=city&country=' . urlencode($c) . '&region=' . urlencode($regions['s_name']) . '&term=all');
         $cities = json_decode($cities_json);
         if (!isset($cities->error)) {
             foreach ($cities as $ci) {
                 $manager_city->insert(array("fk_i_region_id" => $regions['pk_i_id'], "s_name" => $ci->name, "fk_c_country_code" => $ci->country_code));
             }
         }
         unset($cities);
         unset($cities_json);
     }
     osc_add_flash_ok_message(sprintf(_m('%s has been added as a region of %s'), $region, $country['s_name']), 'admin');
 }
开发者ID:semul,项目名称:Osclass,代码行数:48,代码来源:settings.php

示例13: display_target

function display_target()
{
    $country_list = osc_file_get_contents('http://geo.osclass.org/newgeo.services.php?action=countries');
    $country_list = json_decode(substr($country_list, 1, strlen($country_list) - 2), true);
    $region_list = array();
    $country_ip = '';
    if (preg_match('|([a-z]{2})-([A-Z]{2})|', Params::getServerParam('HTTP_ACCEPT_LANGUAGE'), $match)) {
        $country_ip = $match[2];
        $region_list = osc_file_get_contents('http://geo.osclass.org/newgeo.services.php?action=regions&country=' . $match[2]);
        $region_list = json_decode(substr($region_list, 1, strlen($region_list) - 2), true);
    }
    if (!isset($country_list[0]) || !isset($country_list[0]['s_name'])) {
        $internet_error = true;
    }
    ?>
    <form id="target_form" name="target_form" action="#" method="post" onsubmit="return false;">
        <h2 class="target"><?php 
    _e('Information needed');
    ?>
</h2>
        <div class="form-table">
            <h2 class="title"><?php 
    _e('Admin user');
    ?>
</h2>
            <table class="admin-user">
                <tbody>
                <tr>
                    <th><label for="admin_user"><?php 
    _e('Username');
    ?>
</label></th>
                    <td>
                        <input size="25" id="admin_user" name="s_name" type="text" value="admin" />
                    </td>
                    <td>
                        <span id="admin-user-error" class="error" aria-hidden="true" style="display:none;"><?php 
    _e('Admin user is required');
    ?>
</span>
                    </td>
                </tr>
                <tr>
                    <th><label for="s_passwd"><?php 
    _e('Password');
    ?>
</label></th>
                    <td>
                        <input size="25" class="password_test" name="s_passwd" id="s_passwd" type="password" value="" autocomplete="off" />
                    </td>
                    <td></td>
                </tr>
                </tbody>
            </table>
            <div class="admin-user">
                <?php 
    _e('A password will be automatically generated for you if you leave this blank.');
    ?>
                <img src="<?php 
    echo get_absolute_url();
    ?>
oc-includes/images/question.png" class="question-skip vtip" title="<?php 
    echo osc_esc_html(__('You can modify username and password if you like, just change the input value.'));
    ?>
" alt="" />
            </div>
            <h2 class="title"><?php 
    _e('Contact information');
    ?>
</h2>
            <table class="contact-info">
                <tbody>
                <tr>
                    <th><label for="webtitle"><?php 
    _e('Web title');
    ?>
</label></th>
                    <td><input type="text" id="webtitle" name="webtitle" size="25" /></td>
                    <td></td>
                </tr>
                <tr>
                    <th><label for="email"><?php 
    _e('Contact e-mail');
    ?>
</label></th>
                    <td><input type="text" id="email" name="email" size="25" /></td>
                    <td><span id="email-error" class="error" style="display:none;"><?php 
    _e('Put your e-mail here');
    ?>
</span></td>
                </tr>
                </tbody>
            </table>
            <h2 class="title"><?php 
    _e('Location');
    ?>
</h2>
            <p class="space-left-25 left no-bottom"><?php 
    _e('Choose countries/cities where your target users are located');
    ?>
//.........这里部分代码省略.........
开发者ID:mylastof,项目名称:os-class,代码行数:101,代码来源:install-functions.php

示例14: insert_longitude_latitude

/**
*   Add Items longitude and latitude, while adding or updating items for Google Maps
*/
function insert_longitude_latitude($aItemRef)
{
    $iItemId = $aItemRef['pk_i_id'];
    $aItem = Item::newInstance()->findByPrimaryKey($iItemId);
    $sAddress = isset($aItem['s_address']) ? $aItem['s_address'] : '';
    $sCity = isset($aItem['s_city']) ? $aItem['s_city'] : '';
    $sRegion = isset($aItem['s_region']) ? $aItem['s_region'] : '';
    $sCountry = isset($aItem['s_country']) ? $aItem['s_country'] : '';
    $sAddress = sprintf('%s, %s, %s, %s', $sAddress, $sCity, $sRegion, $sCountry);
    $aResponse = osc_file_get_contents(sprintf('https://maps.googleapis.com/maps/api/geocode/json?address=%s', urlencode($sAddress)));
    $jsonResponse = json_decode($aResponse, true);
    $aLocation = $jsonResponse['results'][0]['geometry']['location'];
    if ($jsonResponse['status'] == "OK") {
        ItemLocation::newInstance()->update(array('d_coord_lat' => $aLocation['lat'], 'd_coord_long' => $aLocation['lng']), array('fk_i_item_id' => $iItemId));
    }
}
开发者ID:Ashishr2,项目名称:Kathmandu,代码行数:19,代码来源:functions.php

示例15: doModel

        function doModel()
        {
            parent::doModel();
            //specific things for this class
            switch ($this->action) {
                case('plugins'):
                case('themes'):
                case('languages'):
                    $section = $this->action;
                    $title = array(
                        'plugins'    => __('Recommended plugins for You'),
                        'themes'     => __('Recommended themes for You'),
                        'languages'  => __('Languages for this version')
                        );

                    // page number
                    $marketPage     = Params::getParam("mPage");
                    $url_actual     = osc_admin_base_url(true) . '?page=market&action='.$section.'&mPage='.$marketPage;
                    if($marketPage>=1) $marketPage--;

                    // api
                    $url            = osc_market_url($section)."page/".$marketPage.'/length/9/';
                    // default sort
                    $sort_actual    = '';
                    $sort_download  = $url_actual.'&sort=downloads&order=desc';
                    $sort_updated   = $url_actual.'&sort=updated&order=desc';

                    // sorting options (default)
                    $_order         = 'desc';
                    $order_download = $_order;
                    $order_updated  = $_order;

                    $sort           = Params::getParam("sort");
                    $order          = Params::getParam("order");

                    if($sort=='') {
                        $sort = 'updated';
                    }
                    if($order=='') {
                        $order = $_order;
                    }

                    $aux = ($order=='desc')?'asc':'desc';

                    switch ($sort) {
                        case 'downloads':
                            $sort_actual    = '&sort=downloads&order=';
                            $sort_download  = $url_actual.$sort_actual.$aux;
                            $sort_actual   .= $order;
                            $order_download = $order;
                            // market api call
                            $url .= 'order/downloads/'.$order;
                        break;
                        case 'updated':
                            $sort_actual    = '&sort=updated&order=';
                            $sort_updated   = $url_actual.$sort_actual.$aux;
                            $sort_actual   .= $order;
                            $order_updated  = $order;
                            // market api call
                            $url .= 'order/updated/'.$order;
                        break;
                        default:
                        break;
                    }

                    // pageSize or length attribute is hardcoded
                    $out    = osc_file_get_contents($url);
                    $array  = json_decode($out, true);

                    $output_pagination = '';
                    if( is_numeric($array['total']) && $array['total']>0 ) {
                        $totalPages = ceil( $array['total'] / $array['sizePage'] );
                        $pageActual = $array['page'];
                        $params     = array(
                            'total'    => $totalPages,
                            'selected' => $pageActual,
                            'url'      => osc_admin_base_url(true).'?page=market'.'&amp;action='.$section.'&amp;mPage={PAGE}'.$sort_actual,
                            'sides'    => 5
                        );
                        // set pagination
                        $pagination = new Pagination($params);
                        $output_pagination = $pagination->doPagination();
                    } else {
                        $array['total'] = 0;
                    }

                    // export variable to view
                    $this->_exportVariableToView("sort"      , $sort);
                    $this->_exportVariableToView("title"     , $title);
                    $this->_exportVariableToView("section"   , $section);
                    $this->_exportVariableToView("array"     , $array);

                    $this->_exportVariableToView("sort_download"     , $sort_download);
                    $this->_exportVariableToView("sort_updated"      , $sort_updated);

                    $this->_exportVariableToView("order_download"     , $order_download);
                    $this->_exportVariableToView("order_updated"      , $order_updated);


                    $this->_exportVariableToView('pagination', $output_pagination);
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:market.php


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