コード例 #1
0
 /**
  * 
  * @param unknown $user
  * @return ZfJoacubUsersOnline\Entity\Register
  */
 protected function getOrRegister($user)
 {
     if (isset($this->userRegister[$user->getId()])) {
         return $this->userRegister[$user->getId()];
     }
     $em = $this->sl->get('zf_joacub_users_online_doctrine_em');
     $em instanceof EntityManager;
     $repo = $em->getRepository('ZfJoacubUsersOnline\\Entity\\Register');
     $registerEntity = $repo->findOneBy(array('user' => $user));
     if (!$registerEntity) {
         $registerEntity = new Register();
         $registerEntity->setUser($user);
         $auth = $this->sl->get('zfcuser_auth_service');
         if ($auth->hasIdentity()) {
             if ($auth->getIdentity()->getId() == $user->getId()) {
                 $registerEntity->setLastConnect(new \DateTime('now'));
             } else {
                 $registerEntity->setLastConnect($user->getCreated());
             }
         }
         $registerEntity->setLastConnect($user->getCreated());
         $em->persist($registerEntity);
         $em->flush($registerEntity);
     }
     $this->userRegister[$user->getId()] = $registerEntity;
     return $registerEntity;
 }
コード例 #2
0
/**
 * Smarty debug_console function plugin
 *
 * Type:     core<br>
 * Name:     display_debug_console<br>
 * Purpose:  display the javascript debug console window
 *
 * @param array   Format: null
 * @param Smarty
 * @param unknown $params
 * @param unknown $smarty (reference)
 * @return unknown
 */
function smarty_core_display_debug_console($params, &$smarty)
{
    // we must force compile the debug template in case the environment
    // changed between separate applications.
    if (empty($smarty->debug_tpl)) {
        // set path to debug template from SMARTY_DIR
        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
        if ($smarty->security && is_file($smarty->debug_tpl)) {
            $smarty->secure_dir[] = dirname(realpath($smarty->debug_tpl));
        }
    }
    $_ldelim_orig = $smarty->left_delimiter;
    $_rdelim_orig = $smarty->right_delimiter;
    $smarty->left_delimiter = '{';
    $smarty->right_delimiter = '}';
    $_compile_id_orig = $smarty->_compile_id;
    $smarty->_compile_id = null;
    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) {
        ob_start();
        $smarty->_include($_compile_path);
        $_results = ob_get_contents();
        ob_end_clean();
    } else {
        $_results = '';
    }
    $smarty->_compile_id = $_compile_id_orig;
    $smarty->left_delimiter = $_ldelim_orig;
    $smarty->right_delimiter = $_rdelim_orig;
    return $_results;
}
コード例 #3
0
 /**
  * 获取消息接收数量信息
  * @param unknown $receivedVO
  * 备注:发送采用https需要修改php.ini打开extension=php_openssl.dll
  * 
  */
 public function getReceivedData($receivedVO, $revResult)
 {
     //echo "1111";
     //加密字符串
     $secretEncode = new SecretEncode();
     $authStr = $secretEncode->getBase64Encode($receivedVO->getAuthStr());
     $receivedVO->setAuth($authStr);
     //url
     $url = $this->RECEIVE_API_URL . "?" . $receivedVO->getParams();
     $header = 'Authorization: Basic ' . $receivedVO->getAuth();
     //请求头信息
     $context = array('http' => array('method' => 'GET', 'header' => $header));
     $stream_context = stream_context_create($context);
     //echo $stream_context;
     $httpPostClient = new HttpPostClient();
     $code = 200;
     try {
         $rs = $httpPostClient->request_tools($url, $stream_context);
         //echo $rs;
     } catch (Exception $e) {
         echo $e;
         $code = 404;
     }
     //echo $rs["body"];
     $revResult->setResultStr($rs, $code);
     //echo $revResult->getResultStr();
     return $revResult;
 }
コード例 #4
0
ファイル: Pdf.php プロジェクト: speedwork/helpers
 /**
  * @param $output (string) Destination where to send the document.
  *It can take one of the following values:
  *I: send the file inline to the browser .
  *D: file download with the name given by name.
  *F: save to a local server file with the name given by name.
  *S: return the document as a string (name is ignored)
  */
 public function send($data, $name = 'document.pdf', $output = 'D')
 {
     $this->getContent($data);
     $this->pdf->writeHTML($this->content);
     $this->pdf->output($name, $output);
     $this->content = null;
 }
コード例 #5
0
ファイル: user_model.php プロジェクト: morota-k/utwitter
    /**
     * ユーザ情報を登録する
     * @param unknown $db
     */
    public function userCreate($db)
    {
        try {
            // 現在日時を取得
            $user_date = date('Y-m-d H:i:s');
            // SQL文を作成
            $sql = 'INSERT INTO user_table (user_id, user_name, user_email, user_password,
			user_age, user_gender, user_profile, user_profile_photo, user_profile_background, user_date)
			VALUES (:user_id, :user_name, :user_email, :user_password, :user_age,
			:user_gender, :user_profile, :user_profile_photo, :user_profile_background, :user_date);';
            $prepare = $db->prepare($sql);
            // SQL文のプレースホルダーに値をバインドする
            $prepare->bindValue(':user_id', $_SESSION['user_id'], PDO::PARAM_STR);
            $prepare->bindValue(':user_name', $_SESSION['user_name'], PDO::PARAM_STR);
            $prepare->bindValue(':user_email', $_SESSION['user_email'], PDO::PARAM_STR);
            // パスワードをハッシュ化
            $prepare->bindValue(':user_password', crypt($_SESSION['user_password']), PDO::PARAM_STR);
            $prepare->bindValue(':user_age', $_SESSION['user_age'], PDO::PARAM_STR);
            $prepare->bindValue(':user_gender', $_SESSION['user_gender'], PDO::PARAM_STR);
            $prepare->bindValue(':user_profile', $_SESSION['user_profile'], PDO::PARAM_STR);
            $prepare->bindValue(':user_profile_photo', $_SESSION['user_profile_photo'], PDO::PARAM_STR);
            $prepare->bindValue(':user_profile_background', $_SESSION['user_profile_background'], PDO::PARAM_STR);
            $prepare->bindValue(':user_date', $user_date, PDO::PARAM_STR);
            $prepare->execute();
        } catch (PDOException $e) {
            echo 'エラー' . entity_str($e->getMessage());
        }
    }
コード例 #6
0
 /**
  * Gets/Saves information about views and stores truncated viewParams.
  *
  * @param unknown $event
  * @param unknown $view
  * @param unknown $file
  */
 public function beforeRenderView($event, $view, $file)
 {
     $params = array();
     $toView = $view->getParamsToView();
     $toView = !$toView ? array() : $toView;
     foreach ($toView as $k => $v) {
         if (is_object($v)) {
             $params[$k] = get_class($v);
         } elseif (is_array($v)) {
             $array = array();
             foreach ($v as $key => $value) {
                 if (is_object($value)) {
                     $array[$key] = get_class($value);
                 } elseif (is_array($value)) {
                     $array[$key] = 'Array[...]';
                 } else {
                     $array[$key] = $value;
                 }
             }
             $params[$k] = $array;
         } else {
             $params[$k] = (string) $v;
         }
     }
     $this->_viewsRendered[] = array('path' => $view->getActiveRenderPath(), 'params' => $params, 'controller' => $view->getControllerName(), 'action' => $view->getActionName());
 }
コード例 #7
0
ファイル: Template.php プロジェクト: Rgss/imp
 /**
  * 初始化smarty
  * 
  */
 private function initSmarty()
 {
     $this->smarty = new Smarty();
     $config = Imp::app()->instance('config')->get();
     // debug关卡
     if ($config['debug']) {
         $this->smarty->debugging = true;
     }
     $this->smarty->debugging = false;
     // 缓存关卡
     $this->smarty->setCaching($config['smarty_config']['cache']);
     // 设置缓存时间
     $this->smarty->cache_lifetime = isset($config['smarty_config']['cache_lifetime']) ? $config['smarty_config']['cache_lifetime'] : 120;
     // 分界符
     $this->smarty->left_delimiter = $config['smarty_config']['left_delimiter'];
     $this->smarty->right_delimiter = $config['smarty_config']['right_delimiter'];
     // 设置配置目录路径,不设默认"configs"
     // $this->smarty->setConfigDir($config['smarty_config']['config_dir']);
     // 设置模板目录路径,不设默认"templates"
     $this->smarty->setTemplateDir(Imp::app()->basePath() . $config['smarty_config']['template_dir']);
     // 设置编译目录路径,不设默认"templates_c"
     $this->smarty->setCompileDir(Imp::app()->basePath() . $config['smarty_config']['compile_dir']);
     // 设置插件目录路径,不设默认"plugins"
     // $this->smarty->setPluginsDir($config['smarty_config']['plugins_dir']);
 }
コード例 #8
0
ファイル: DebugPanel.php プロジェクト: rub3nlh/webird
 /**
  * Gets/Saves information about views and stores truncated viewParams.
  *
  * @param unknown $event
  * @param unknown $view
  * @param unknown $file
  */
 public function beforeRenderView($event, $view, $file)
 {
     $router = $this->getDI()->getRouter();
     $phalconDir = $this->getDI()->getConfig()->path->phalconDir;
     $params = [];
     $toView = $view->getParamsToView();
     $toView = !$toView ? [] : $toView;
     foreach ($toView as $k => $v) {
         if (is_object($v)) {
             $params[$k] = get_class($v);
         } elseif (is_array($v)) {
             $array = [];
             foreach ($v as $key => $value) {
                 if (is_object($value)) {
                     $array[$key] = get_class($value);
                 } elseif (is_array($value)) {
                     $array[$key] = 'Array[...]';
                 } else {
                     $array[$key] = $value;
                 }
             }
             $params[$k] = $array;
         } else {
             $params[$k] = (string) $v;
         }
     }
     $path = str_replace($phalconDir, '', $view->getActiveRenderPath());
     $path = preg_replace('/^modules\\/[a-z]+\\/views\\/..\\/..\\/..\\//', '', $path);
     $this->viewsRendered[] = ['path' => $path, 'params' => $params, 'module' => $router->getModuleName(), 'controller' => $view->getControllerName(), 'action' => $view->getActionName()];
 }
コード例 #9
0
 /**
  * 
  * @param unknown $entries
  * @param unknown $template
  * @param unknown $media
  */
 public function __invoke($entries, $template, $media)
 {
     $templateKey = static::VIEW_TEMPLATE;
     if (isset($entries['modulFormat'])) {
         $templateKey = $entries['modulFormat'];
     }
     $this->setTemplate($template->plugins->{$templateKey});
     $active = false;
     if (strlen($this->view->paramter['article']) > 1) {
         $active = $this->view->paramter['article'];
     }
     $html = '';
     $elements = $this->elements->toArray();
     foreach ($entries['modulContent'] as $entry) {
         $elements = $this->elements->toArray();
         $elements["grid"]["attr"]['href'] = '/' . $entry['url'] . '/tag/' . $entry['tag_scope'];
         $elements["grid"]["attr"]['title'] = $this->linktitle . ' ' . $entry['tag_name'];
         if ($active === $entry['tag_scope']) {
             $elements["grid"]["attr"]['class'] .= ' disabled';
         }
         $html .= $this->deployRow($elements, $entry['tag_name']);
         $elements = null;
     }
     if (strlen($html) > 1) {
         $wrapper = $this->wrapper->toArray();
         if (isset($wrapper['row'])) {
             $wrapper['row']['content:before'] = '<h3>' . $this->headline . '</h3>';
         }
         $html = $this->deployRow($wrapper, $html);
     }
     return $html;
 }
コード例 #10
0
ファイル: User.php プロジェクト: atudz/gorabelframework
 /**
  * Named scope for customer users
  * @param unknown $query
  */
 public function scopeCustomer($query)
 {
     $query->leftJoin('user_to_role', 'user.id', '=', 'user_to_role.user_id');
     $query->leftJoin('role', 'role.id', '=', 'user_to_role.role_id');
     $query->groupBy('user.id');
     return $query->where('role.value', '=', 'role_customer');
 }
コード例 #11
0
ファイル: admin.rss.php プロジェクト: escherlat/loquacity
/**
 *
 *
 * @param unknown $bBlog (reference)
 */
function admin_plugin_rss_run(&$bBlog)
{
    $pole = "";
    for ($i = 1; $i < 10; $i++) {
        if (isset($_POST['sending']) && $_POST['sending'] == "true") {
            $id = $_POST[id . $i];
            $ch = $_POST[ch . $i];
            $update_query = "UPDATE " . T_RSS . " SET `url` = '" . $id . "',`input_charset` = '" . $ch . "' WHERE `id` = '" . $i . "' LIMIT 1 ;";
            $bBlog->query($update_query);
        }
        $query = "select * from " . T_RSS . " where id=" . $i . ";";
        $row = $bBlog->get_row($query);
        $rssurl = $row->url;
        $w1250 = "";
        if ($row->input_charset == "W1250") {
            $w1250 = " selected";
        }
        $utf8 = "";
        if ($row->input_charset == "UTF8") {
            $utf8 = " selected";
        }
        if ($i / 2 == floor($i / 2)) {
            $class = 'high';
        } else {
            $class = 'low';
        }
        $pole .= '<tr class="' . $class . '"><td>' . $i . '</td><td><input type="text" name="id' . $i . '" size="20" value="' . $rssurl . '" class="text" /></td><td><select name="ch' . $i . '">';
        $pole .= '<option>I88592</option>';
        $pole .= '<option' . $w1250 . '>W1250</option>';
        $pole .= '<option' . $utf8 . '>UTF8</option>';
        $pole .= '</select></td></tr>';
    }
    $bBlog->assign('pole', $pole);
}
コード例 #12
0
 /**
  * Compares the specified object with this collection for equality.
  * @param unknown $object
  * @return boolean
  */
 public function equals($object)
 {
     if (!$object instanceof CollectionInterface) {
         return false;
     }
     return $this->hashCode() === $object->hashCode();
 }
コード例 #13
0
ファイル: functions.php プロジェクト: rikutimonen/ringbanan
/**
 * 
 * @param unknown $user
 * @param unknown $pwd
 * @param unknown $DBH
 * @return found boolean false jos annettua käyttäjää ja salasanaa löydy
 */
function login($user, $pwd, $DBH)
{
    // !! on suola, jotta kantaan taltioitu eri hashkoodi vaikka salasana olisi tiedossa
    //kokeile !! ja ilman http://www.danstools.com/md5-hash-generator/
    //Tukevampia salauksia hash('sha256', $pwd ) tai hash('sha512', $pwd )
    //MD5 on 128 bittinen
    $hashpwd = hash('md5', $pwd . '!!');
    //An array of values with as many elements as there are bound parameters in the
    //SQL statement being executed. All values are treated as PDO::PARAM_STR
    $data = array('kayttaja' => $user, 'passu' => $hashpwd);
    //print_r($data);
    try {
        //print_r($data);
        //echo "Login 1<br />";
        $STH = $DBH->prepare("SELECT * FROM 0mrb_users WHERE email=:kayttaja AND\n\t\tpwd = :passu");
        $STH->execute($data);
        $STH->setFetchMode(PDO::FETCH_OBJ);
        $row = $STH->fetch();
        //print_r($row);
        if ($STH->rowCount() > 0) {
            //echo "Login 4<br />";
            return $row;
        } else {
            //echo "Login 5<br />";
            return false;
        }
    } catch (PDOException $e) {
        echo "Login DB error.";
        file_put_contents('log/DBErrors.txt', 'Login: ' . $e->getMessage() . "\n", FILE_APPEND);
    }
}
コード例 #14
0
 /**
  * todo: this shouldn't be a concern of this class and should be moved
  * either to the dispatcher or a somewhere more practical
  *
  * @param unknown $request
  */
 private function getDomainByRoute($request)
 {
     $route = $this->dispatcher->dispatch($request->getMethod(), $request->getUri()->getPath());
     $fullDomainName = $route[1]->getDomain();
     $domain = end(explode('\\', $fullDomainName));
     return $domain;
 }
コード例 #15
0
/**
 * Smarty {debug} function plugin
 *
 * Type:     function<br>
 * Name:     debug<br>
 * Date:     July 1, 2002<br>
 * Purpose:  popup debug window
 *
 * @link http://smarty.php.net/manual/en/language.function.debug.php {debug}
 *       (Smarty online manual)
 * @author   Monte Ohrt <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @param unknown $params
 * @param unknown $smarty (reference)
 * @return string output from {@link Smarty::_generate_debug_output()}
 */
function smarty_function_debug($params, &$smarty)
{
    if ($params['output']) {
        $smarty->assign('_smarty_debug_output', $params['output']);
    }
    require_once SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.display_debug_console.php';
    return smarty_core_display_debug_console(null, $smarty);
}
コード例 #16
0
ファイル: Formatter.php プロジェクト: m1lt0n/dialog
 /**
  * Format the log message. Prepends a DateTime formatted string and the
  * log level to the message.
  *
  * Example:
  *
  * $formatter = new BaseFormatter();
  * $formatter->format(LogLevel::WARNING, 'This is a warning');
  *
  * The above returns:
  *
  * 2015-08-19 14:31 +0300 WARNING This is a warning
  *
  * @param string $level the log level
  * @param string $message the log message
  * @return string the formatted message
  *
  * @see \Dialog\Formatter\FormatterInterface::format()
  */
 public function format($level, $message)
 {
     $date = $this->dateBuilder->buildFromTime();
     $level = strtoupper($level);
     $this->templateEngine->setTemplate('{date} {level} {message}');
     $this->templateEngine->setDelimiters('{', '}');
     return $this->templateEngine->render(compact('date', 'level', 'message'));
 }
コード例 #17
0
ファイル: global_helper.php プロジェクト: alfonkdp/soad
/**
 * Count Row
 *
 * @param unknown $query        	
 * @return boolean
 */
function countRow($query)
{
    if ($query->num_rows() > 0) {
        return $query->num_rows();
    } else {
        return false;
    }
}
コード例 #18
0
 /**
  * on bootstrap
  * @param unknown $e event
  * @return void
  */
 public function onBootstrap($e)
 {
     // You may not need to do this if you're doing it elsewhere in your
     // application
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
 }
コード例 #19
0
 /**
  *
  * @param unknown $objPHPExcel        	
  * @param unknown $cols        	
  */
 private static function printHeaders($objPHPExcel, $cols)
 {
     $count = 1;
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 2, "Data");
     foreach ($cols as $col) {
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count++, 2, sprintf("%7s", $col));
     }
 }
コード例 #20
0
 /**
  * Add the fields to the form for the query mode
  *
  * @param unknown $form
  */
 protected function addQueryFields($form)
 {
     $options = $this->options;
     $form->add('targetPattern');
     $form->add('query');
     $form->add('maxResults');
     $form->add('fields', 'widget_fields', array('label' => 'widget.form.entity.fields.label', 'namespace' => $options['namespace'], 'widget' => $options['widget']));
 }
コード例 #21
0
 /**
  * 处理赋值语句右边的三元表达式
  * @param unknown $part
  * @param unknown $dataFlow
  */
 public static function ternaryHandler($type, $part, $dataFlow)
 {
     $ter_symbol = new MutipleSymbol();
     $ter_symbol->setItemByNode($part);
     if ($type == 'right') {
         $dataFlow->setValue($ter_symbol);
     }
 }
コード例 #22
0
/**
 * Smarty {cycle} function plugin
 *
 * Type:     function<br>
 * Name:     cycle<br>
 * Date:     May 3, 2002<br>
 * Purpose:  cycle through given values<br>
 * Input:
 *         - name = name of cycle (optional)
 *         - values = comma separated list of values to cycle,
 *                    or an array of values to cycle
 *                    (this can be left out for subsequent calls)
 *         - reset = boolean - resets given var to true
 *         - print = boolean - print var or not. default is true
 *         - advance = boolean - whether or not to advance the cycle
 *         - delimiter = the value delimiter, default is ","
 *         - assign = boolean, assigns to template var instead of
 *                    printed.
 *
 * Examples:<br>
 * <pre>
 * {cycle values="#eeeeee,#d0d0d0d"}
 * {cycle name=row values="one,two,three" reset=true}
 * {cycle name=row}
 * </pre>
 *
 * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle}
 *       (Smarty online manual)
 * @author Monte Ohrt <*****@*****.**>
 * @author credit to Mark Priatel <*****@*****.**>
 * @author credit to Gerard <*****@*****.**>
 * @author credit to Jason Sweat <*****@*****.**>
 * @version  1.3
 * @param array
 * @param Smarty
 * @param unknown $params
 * @param unknown $smarty (reference)
 * @return string|null
 */
function smarty_function_cycle($params, &$smarty)
{
    static $cycle_vars;
    extract($params);
    if (empty($name)) {
        $name = 'default';
    }
    if (!isset($print)) {
        $print = true;
    }
    if (!isset($advance)) {
        $advance = true;
    }
    if (!isset($reset)) {
        $reset = false;
    }
    if (!in_array('values', array_keys($params))) {
        if (!isset($cycle_vars[$name]['values'])) {
            $smarty->trigger_error("cycle: missing 'values' parameter");
            return;
        }
    } else {
        if (isset($cycle_vars[$name]['values']) && $cycle_vars[$name]['values'] != $values) {
            $cycle_vars[$name]['index'] = 0;
        }
        $cycle_vars[$name]['values'] = $values;
    }
    if (isset($delimiter)) {
        $cycle_vars[$name]['delimiter'] = $delimiter;
    } elseif (!isset($cycle_vars[$name]['delimiter'])) {
        $cycle_vars[$name]['delimiter'] = ',';
    }
    if (!is_array($cycle_vars[$name]['values'])) {
        $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']);
    } else {
        $cycle_array = $cycle_vars[$name]['values'];
    }
    if (!isset($cycle_vars[$name]['index']) || $reset) {
        $cycle_vars[$name]['index'] = 0;
    }
    if (isset($assign)) {
        $print = false;
        $smarty->assign($assign, $cycle_array[$cycle_vars[$name]['index']]);
    }
    if ($print) {
        $retval = $cycle_array[$cycle_vars[$name]['index']];
    } else {
        $retval = null;
    }
    if ($advance) {
        if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) {
            $cycle_vars[$name]['index'] = 0;
        } else {
            $cycle_vars[$name]['index']++;
        }
    }
    return $retval;
}
コード例 #23
0
ファイル: Routing.php プロジェクト: nadar/ifw
 /**
  * @todo wrong integration when using cli application!
  *
  * @param unknown $request
  *
  * @return unknown
  */
 public function getRoute($request)
 {
     if ($this->rewriteEnabled) {
         $route = $request->getRequestPathSuffix();
     } else {
         $route = $request->get('route', false);
     }
     return $route;
 }
コード例 #24
0
/**
 *
 *
 * @param unknown $params
 * @param unknown $bBlog  (reference)
 * @return unknown
 */
function smarty_function_getrecentposts($params, &$bBlog)
{
    $ar = array();
    $opt = array();
    // If "assign" is not set... we'll establish a default.
    if ($params['assign'] == '') {
        $params['assign'] = 'posts';
    }
    // If "archive" is set, order them ASCENDING by posttime.
    if ($params['archive'] == 'TRUE') {
        $opt['order'] = " ORDER BY posttime ";
    }
    // If num is set, we'll only get that many results in return
    if (is_numeric($params['num'])) {
        $opt['num'] = $params['num'];
    }
    // If skip is set, we'll skip that many results
    if (is_numeric($params['skip'])) {
        $opt['num'] = $params['skip'];
    }
    if ($params['section'] != '') {
        $opt['sectionid'] = $bBlog->sect_by_name[$params['section']];
    }
    if ($bBlog->show_section) {
        $opt['sectionid'] = $bBlog->show_section;
    }
    $opt['home'] = $params['home'];
    $q = $bBlog->make_post_query($opt);
    $ar['posts'] = $bBlog->get_posts($q);
    // No posts.
    if (!is_array($ar['posts'])) {
        return '';
    }
    $lastmonth = 0;
    $lastdate = 0;
    foreach ($ar['posts'] as $key => $value) {
        // It seems silly to do this. Especially since,
        // this kind of check can be done in Smarty template.
        // Additionally, since {newday} and {newmonth} require
        // the data to be in a variable named "post" it may not
        // function at all.
        //
        // We'll leave it here for now.
        /* check if new day  - used by block.newday.php */
        if (date('Ymd', $ar['posts'][$key]['posttime']) != $lastdate) {
            $ar['posts'][$key]['newday'] = TRUE;
        }
        $lastdate = date('Ymd', $ar['posts'][$key]['posttime']);
        /* check if new month - use by block.newmonth.php */
        if (date('Fy', $ar['posts'][$key]['posttime']) != $lastmonth) {
            $ar['posts'][$key]['newmonth'] = TRUE;
        }
        $lastmonth = date('Fy', $ar['posts'][$key]['posttime']);
    }
    $bBlog->assign($params['assign'], $ar['posts']);
    return '';
}
コード例 #25
0
 /**
  *
  * @param unknown $pageOptions
  */
 protected function iniServices($pageOptions)
 {
     $services = array();
     if (false !== ($getServices = $pageOptions->getApp('services'))) {
         foreach ($getServices as $key => $service) {
             $services[$key] = $this->getServiceLocator()->get($service);
         }
     }
     return $services;
 }
コード例 #26
0
ファイル: PaginatorCore.php プロジェクト: atudz/snapneat
 /**
  * Display paginate links with limiter as option
  * @param string $limiter
  * @return string
  */
 public function paginate($limiter = true)
 {
     /*
      * Render custom paginator
      */
     if (is_null($this->paginatorBuilder)) {
         $this->paginatorBuilder = new PaginatorBuilder($this);
     }
     return $this->paginatorBuilder->render($limiter);
 }
コード例 #27
0
ファイル: AbstractFactory.php プロジェクト: samizdam/Geometry
 /**
  *
  * (non-PHPdoc)
  *
  * @see \samizdam\Geometry\Plane\DependecyInjectorInterface::injectDependecies()
  *
  * @param unknown $object
  * @return Ambigous <\samizdam\Geometry\Plane\FactoriesCollectionAwareInterface, \samizdam\Geometry\Plane\CompositeCalculatorAwareInterface>
  */
 public function injectDependecies($object)
 {
     if ($object instanceof FactoriesCollectionAwareInterface) {
         $object->setFactoriesCollection($this->getFactoriesCollection());
     }
     if ($object instanceof CompositeCalculatorAwareInterface) {
         $object->setCompositeCalculator($this->getCompositeCalculator());
     }
     return $object;
 }
コード例 #28
0
ファイル: class-vendors.php プロジェクト: shahadat014/geleyi
 /**
  *
  *
  * @param unknown $order
  * @param unknown $group (optional)
  *
  * @return unknown
  */
 public function get_vendor_dues_from_order($order, $group = true)
 {
     global $woocommerce;
     $give_tax = Product_Vendor::$pv_options->get_option('give_tax');
     $receiver = array();
     $shipping_given = 0;
     $tax_given = 0;
     foreach ($order->get_items() as $key => $product) {
         $product_id = !empty($product['variation_id']) ? $product['variation_id'] : $product['product_id'];
         $author = PV_Vendors::get_vendor_from_product($product_id);
         $is_vendor = PV_Vendors::is_vendor($author);
         $commission = $is_vendor ? PV_Commission::calculate_commission($product['line_subtotal'], $product_id, $order) : 0;
         $tax = !empty($product['line_tax']) ? (double) $product['line_tax'] : 0;
         $shipping = PV_Shipping::get_shipping_due($order->id, $product, $author);
         if ($is_vendor) {
             $shipping_given += $shipping;
             $tax_given += $give_tax ? $tax : 0;
             $give = 0;
             $give += !empty($receiver[$author]['total']) ? $receiver[$author]['total'] : 0;
             $give += $shipping;
             $give += $commission;
             $give += $give_tax ? $tax : 0;
             if ($group) {
                 $receiver[$author] = array('vendor_id' => (int) $author, 'commission' => !empty($receiver[$author]['commission']) ? $receiver[$author]['commission'] + $commission : $commission, 'shipping' => !empty($receiver[$author]['shipping']) ? $receiver[$author]['shipping'] + $shipping : $shipping, 'tax' => $give_tax ? !empty($receiver[$author]['tax']) ? $receiver[$author]['tax'] + $tax : $tax : 0, 'qty' => !empty($receiver[$author]['qty']) ? $receiver[$author]['qty'] + $product['qty'] : $product['qty'], 'total' => $give);
             } else {
                 $receiver[$author][$product_id] = array('vendor_id' => (int) $author, 'product_id' => $product_id, 'commission' => $commission, 'shipping' => $shipping, 'tax' => $give_tax ? $tax : 0, 'qty' => $product['qty'], 'total' => $shipping + $commission + ($give_tax ? $tax : 0));
             }
         }
         $admin_comm = $product['line_subtotal'] - $commission;
         if ($group) {
             $receiver[1] = array('vendor_id' => 1, 'qty' => !empty($receiver[1]['qty']) ? $receiver[1]['qty'] + $product['qty'] : $product['qty'], 'commission' => !empty($receiver[1]['commission']) ? $receiver[1]['commission'] + $admin_comm : $admin_comm, 'total' => !empty($receiver[1]) ? $receiver[1]['total'] + $admin_comm : $admin_comm);
         } else {
             $receiver[1][$product_id] = array('vendor_id' => 1, 'product_id' => $product_id, 'commission' => $admin_comm, 'shipping' => 0, 'tax' => 0, 'qty' => $product['qty'], 'total' => $admin_comm);
         }
     }
     // Add remainders on end to admin
     $discount = $order->get_total_discount();
     $shipping = $order->order_shipping - $shipping_given;
     $tax = $order->order_tax + $order->order_shipping_tax - $tax_given;
     $total = $tax + $shipping - $discount;
     if ($group) {
         $receiver[1]['commission'] = $receiver[1]['commission'] - $discount;
         $receiver[1]['shipping'] = $shipping;
         $receiver[1]['tax'] = $tax;
         $receiver[1]['total'] += $total;
     } else {
         $receiver[1][$product_id]['commission'] = $receiver[1][$product_id]['commission'] - $discount;
         $receiver[1][$product_id]['shipping'] = $order->order_shipping - $shipping_given;
         $receiver[1][$product_id]['tax'] = $tax;
         $receiver[1][$product_id]['total'] += $total;
     }
     // Reset the array keys
     // $receivers = array_values( $receiver );
     return $receiver;
 }
コード例 #29
0
ファイル: swoole_tcp_server.php プロジェクト: rbdoer/tools
 /**
  * receive data
  * @param unknown $serv
  * @param unknown $fd
  * @param unknown $from_id
  * @param unknown $data
  */
 function onReceive($serv, $fd, $from_id, $data)
 {
     echo "onReceive\n";
     $response = "";
     try {
         $response = $this->bus->requestHandle($data);
     } catch (Exception $e) {
     }
     $serv->send($fd, $response);
     $this->serv->close($fd);
 }
コード例 #30
0
 /**
  * Constructor
  * @param Application $app            
  * @throws \Exception
  */
 public function __construct(Console $console, Application $app, array $params = array())
 {
     $this->app = $app;
     $this->console = $console;
     $this->resolver = new OptionsResolver();
     $this->configureOptions($this->resolver);
     $this->options = $this->resolver->resolve($params);
     $this->setRegisterableCommands();
     if ($this->options['autoRegister']) {
         $this->registerCommands();
     }
 }