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


PHP _wp函数代码示例

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


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

示例1: execute

 public function execute()
 {
     if (wa()->getUser()->getRights('wacab', 'backend') >= 2) {
         $apps_model = new wacabAppsModel();
         $app = waRequest::get('apps');
         if ($app['parent'] === 'null') {
             $app['parent'] = null;
         }
         if (isset($app['id']) && $app['id'] > 0) {
             $old = $apps_model->getById($app['id']);
             if ($old['app_id'] != $app['app_id'] && $app['type'] == 'app') {
                 $apps_model->exec('UPDATE wacab_apps SET app_id = s:app_id WHERE app_id = s:old_app_id', array('app_id' => $app['app_id'], 'old_app_id' => $old['app_id']));
             }
             $apps_model->updateById($app['id'], $app);
         } else {
             unset($app['id']);
             $app['name'] = json_encode(array($app['name']));
             $apps_model->insert($app);
         }
         $view = self::getView();
         $apps = $apps_model->getAll();
         $types = $apps_model->getTypes();
         $parents = $apps_model->getParents();
         $view->assign('parents', $parents);
         $view->assign('types', $types);
         $view->assign('apps', $apps);
         $view->assign('edit', 0);
         $view->assign('app', array());
         $this->response = array('apps' => $view->fetch(wacabHelper::getAppPath() . '/templates/actions/apps/apps_table.html'), 'form' => $view->fetch(wacabHelper::getAppPath() . '/templates/actions/apps/apps_form.html'));
     } else {
         $this->setError(_wp('No permission to add the app'));
     }
 }
开发者ID:itfrogs,项目名称:wa-wacab,代码行数:33,代码来源:wacabAppsSave.controller.php

示例2: postSearch

 public function postSearch($options)
 {
     $result = null;
     if (!empty($options['plugin'])) {
         if (!empty($options['plugin'][$this->id])) {
             $result = array();
             $result['join'] = array();
             $category_model = new blogCategoryModel();
             if ($category = $category_model->getByField('url', $options['plugin'][$this->id], 'id')) {
                 $result['join'] = array();
                 $result['join']['blog_post_category'] = array('condition' => 'blog_post_category.post_id = blog_post.id');
                 $result['where'] = array('blog_post_category.category_id IN (' . implode(', ', array_keys($category)) . ')');
             } else {
                 $category = array();
                 $result['where'] = 'FALSE';
             }
             $title = array();
             if ($category) {
                 foreach ($category as $item) {
                     $title[] = $item['name'];
                 }
             } else {
                 $title[] = _wp('not found');
             }
             wa()->getResponse()->setTitle(implode(', ', $title));
         }
     }
     return $result;
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:29,代码来源:blogCategory.plugin.php

示例3: formatValue

 public static function formatValue($c, $curr = null)
 {
     static $currencies = null;
     if ($currencies === null) {
         if ($curr) {
             $currencies = $curr;
         } else {
             $curm = new shopCurrencyModel();
             $currencies = $curm->getAll('code');
         }
     }
     if ($c['type'] == '$FS') {
         return _wp('Free shipping');
     } else {
         if ($c['type'] === '%') {
             return waCurrency::format('%0', $c['value'], 'USD') . '%';
         } else {
             if (!empty($currencies[$c['type']])) {
                 return waCurrency::format('%0{s}', $c['value'], $c['type']);
             } else {
                 // Coupon of unknown type. Possibly from a plugin?..
                 return '';
             }
         }
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:26,代码来源:shopCouponPlugin.class.php

示例4: smarty_gettext_translate

function smarty_gettext_translate($matches)
{
    if ($str = waLocale::getString($matches[1])) {
        return $str;
    }
    return _wp(str_replace('\\"', '"', $matches[1]));
}
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:prefilter.translate.php

示例5: execute

 public function execute()
 {
     if (!$this->getUser()->getRights('photos', 'edit')) {
         throw new waException(_w("Access denied"));
     }
     $moderation = waRequest::post('moderation', '', waRequest::TYPE_STRING_TRIM);
     $id = waRequest::post('id', '', waRequest::TYPE_INT);
     $photo_model = new photosPhotoModel();
     $photo = $photo_model->getById($id);
     if (!$photo) {
         $this->errors[] = _wp('Unknown photo');
     }
     if ($moderation == 'approve') {
         $photo_model->updateById($id, array('moderation' => 1));
         $photo_model->updateAccess($id, 1, array(0));
     }
     if ($moderation == 'decline') {
         $photo_model->updateById($id, array('moderation' => -1));
         $photo_model->updateAccess($id, 0, array(0));
     }
     $this->response['photo'] = $photo_model->getById($id);
     // update for making inline-editable widget
     $this->response['frontend_link_template'] = photosFrontendPhoto::getLink(array('url' => '%url%'));
     $this->response['counters'] = array('declined' => $photo_model->countByField('moderation', -1), 'awaiting' => $photo_model->countByField('moderation', 0));
     // l18n string
     $count = (int) waRequest::post('count');
     $total_count = (int) waRequest::post('total_count');
     $this->response['string'] = array('loaded' => _w('%d photo', '%d photos', $count), 'of' => sprintf(_w('of %d'), $total_count), 'chunk' => $count < $total_count ? _w('%d photo', '%d photos', min($this->getConfig()->getOption('photos_per_page'), $count - $total_count)) : false);
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:29,代码来源:photosPublicgalleryPluginBackendModeration.controller.php

示例6: frontend_head

    public function frontend_head()
    {
        if (!$this->getSettings('enabled')) {
            return false;
        }
        if (waRequest::cookie('agecheck') == 1) {
            return false;
        } else {
            $enter = !empty($this->getSettings('enter')) ? $this->getSettings('enter') : _wp('Enter');
            $leave = !empty($this->getSettings('leave')) ? $this->getSettings('leave') : _wp('Leave');
            $header = !empty($this->getSettings('header')) ? $this->getSettings('header') : _wp('Adults only');
            $style = !empty($this->getSettings('css')) ? $this->getSettings('css') : '';
            $logo = !empty($this->getSettings('logo_url')) ? $this->getSettings('logo_url') : $this->getPluginStaticUrl(true) . 'img/' . $this->getSettings('logo') . '.png';
            $html = '<div id="agecheck" class="agecheck-fade">';
            $html .= '<script type="text/javascript">
			$(document).on("click","#s-agecheck-enter",function(){var e=new Date;e.setTime(e.getTime()+31536e7),document.cookie="agecheck=1;path=/;expires="+e.toUTCString(),$("#agecheck").hide()}),$(document).on("click","#s-agecheck-leave",function(){""==document.referrer?window.close():window.location.href=document.referrer});
</script>';
            $html .= '<style>.agecheck-fade{height:100%;width:100%;background-color:rgba(0,0,0,.9);position:fixed;overflow:hidden;left:0;top:0;display:block;z-index:10000}.agecheck-cont{padding:20px;margin:10% auto 0;width:350px;background-color:#FFF!important;-moz-box-shadow:0 0 100px 1px #444;-webkit-box-shadow:0 0 100px 1px #444;font-size:20px}.agecheck-button{font-family:inherit;font-size:100%;padding:.5em 1em;color:#444;border:1px solid #999;background-color:#E6E6E6;text-decoration:none;border-radius:2px}</style>';
            if (!empty($style)) {
                $html .= '<style>' . $style . '</style>';
            }
            $html .= '
		<div class="agecheck-cont" align="center">
			<img align="middle" class="agecheck-logo" style="clear:both" src="' . $logo . '"></img><br><br>
			<h3>' . $header . '</h3>
			<button class="agecheck-button" id="s-agecheck-enter">' . $enter . '</button>&nbsp;&nbsp;<button class="agecheck-button" id="s-agecheck-leave">' . $leave . '</button>
		</div></div>';
            return $html;
        }
    }
开发者ID:xylsss,项目名称:waplugins,代码行数:30,代码来源:shopAgecheckPlugin.class.php

示例7: getPosts

 public function getPosts()
 {
     $this->log(__METHOD__, self::LOG_DEBUG);
     $ids = array();
     if (version_compare($this->version, '3.4', '>=')) {
         $filter = array('number' => 9999);
         $posts = $this->xmlrpc("wp.getPosts", 1, $this->option('login'), $this->option('password'), $filter, array('post_id', 'ID'));
         foreach ($posts as $post) {
             if (isset($post['post_id'])) {
                 $ids[] = $post['post_id'];
             } elseif (isset($post['ID'])) {
                 $ids[] = $post['ID'];
             }
         }
     } elseif (version_compare($this->version, '1.5.0', '>=')) {
         $posts = $this->xmlrpc('mt.getRecentPostTitles', 1, $this->option('login'), $this->option('password'), 9999);
         foreach ($posts as $post) {
             $ids[] = $post['postid'];
         }
     } else {
         throw new waException(_wp("WordPress version should be at least 1.5.0"));
     }
     $this->log(var_export($ids, true), self::LOG_DEBUG);
     return $ids;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:25,代码来源:blogImportPluginWordpressTransport.class.php

示例8: initOptions

 public function initOptions()
 {
     $this->options['host'] = array('title' => _wp('MySQL Host'), 'value' => 'localhost', 'settings_html_function' => waHtmlControl::INPUT);
     $this->options['user'] = array('title' => _wp('MySQL User'), 'value' => '', 'settings_html_function' => waHtmlControl::INPUT);
     $this->options['password'] = array('title' => _wp('MySQL Password'), 'value' => '', 'settings_html_function' => waHtmlControl::PASSWORD);
     $this->options['database'] = array('title' => _wp('MySQL Database'), 'value' => 'webasyst', 'settings_html_function' => waHtmlControl::INPUT);
     $this->options['path'] = array('title' => _wp('Path to folder'), 'value' => wa()->getConfig()->getRootPath(), 'description' => _wp('Path to folder <strong>data/[DBNAME]/attachments/pd</strong> of the WebAsyst Photos (old version) installation'), 'settings_html_function' => waHtmlControl::INPUT);
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:8,代码来源:photosImportWebasystTransport.class.php

示例9: getSettingsConfig

 protected function getSettingsConfig()
 {
     $blogs = array();
     $blog_model = new blogBlogModel();
     $blogs[''] = _wp('All blogs');
     foreach ($blog_model->getAvailable(wa()->getUser()) as $b) {
         $blogs[$b['id']] = $b['name'];
     }
     $result = parent::getSettingsConfig();
     $result['blog_id']['options'] = $blogs;
     return $result;
 }
开发者ID:niva79,项目名称:webasyst-framework,代码行数:12,代码来源:blogPosts.widget.php

示例10: execute

 public function execute()
 {
     echo "AppsAddController";
     if (wa()->getUser()->getRights('wacab', 'backend') >= 2) {
         $model = new wacabAppsModel();
         $tmp_name = array();
         $tmp_name[] = waRequest::post('name');
         $new_app = array('app_id' => waRequest::post('app_id'), 'plugin_id' => waRequest::post('plugin_id'), 'regexp' => json_encode($tmp_name));
         $model->insert($new_app);
     } else {
         $this->setError(_wp('No permission to add the server'));
     }
 }
开发者ID:itfrogs,项目名称:wa-wacab,代码行数:13,代码来源:wacabAppsAdd.controller.php

示例11: verifyRegexp

 private static function verifyRegexp(&$pattern, $delimiter = '/')
 {
     $errors = array(-1 => true, PREG_NO_ERROR => _wp('Invalid regex'), PREG_INTERNAL_ERROR => _wp('There was an internal PCRE error'), PREG_BACKTRACK_LIMIT_ERROR => _wp('Backtrack limit was exhausted'), PREG_RECURSION_LIMIT_ERROR => _wp('Recursion limit was exhausted'), PREG_BAD_UTF8_ERROR => _wp('The offset didn\'t correspond to the begin of a valid UTF-8 code point'));
     if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
         $errors[PREG_BAD_UTF8_OFFSET_ERROR] = _wp('Malformed UTF-8 data');
     }
     $res = @preg_match($pattern, null);
     if ($res === false) {
         $code = preg_last_error();
     } else {
         $code = -1;
     }
     return $errors[$code];
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:14,代码来源:blogImport.plugin.php

示例12: execute

 public function execute()
 {
     $transport = ucfirst($this->getRequest()->post('transport', '', waRequest::TYPE_STRING_TRIM));
     $class = "blogImportPlugin{$transport}Transport";
     if ($transport && class_exists($class)) {
         $plugin = wa()->getPlugin('import');
         $settings = $plugin->getSettings();
         $instance = new $class($settings);
         $namespace = $this->getApp() . '_import_' . strtolower($transport);
         $this->response = $instance->getControls($namespace);
     } else {
         $this->errors['transport'] = sprintf(_wp("Transport type %s not found"), $transport);
     }
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:14,代码来源:blogImportPluginBackendSetup.controller.php

示例13: run

 public function run($params = NULL)
 {
     $app_settings_model = new waAppSettingsModel();
     $app_settings_model->set(array('blog', 'emailsubscription'), 'last_emailsubscription_cron_time', time());
     $model = new blogEmailsubscriptionLogModel();
     $row = $model->getByField('status', 0);
     if ($row) {
         $post_id = $row['post_id'];
         $post_model = new blogPostModel();
         $post = $post_model->getById($post_id);
         $blog_model = new blogBlogModel();
         $blog = $blog_model->getById($post['blog_id']);
         $subject = $blog['name'] . ': ' . $post['title'];
         $post_title = htmlspecialchars($post['title']);
         if ($blog['status'] == blogBlogModel::STATUS_PUBLIC) {
             $post_url = blogPost::getUrl($post);
         } else {
             $app_settings_model = new waAppSettingsModel();
             $post_url = $app_settings_model->get(array('blog', 'emailsubscription'), 'backend_url', wa()->getRootUrl(true) . wa()->getConfig()->getBackendUrl());
             $post_url .= "/blog/?module=post&id=" . $post_id;
         }
         $blog_name = htmlspecialchars($blog['name']);
         $body = '<html><body>' . sprintf(_wp("New post in the blog “%s”"), $blog_name) . ': <strong><a href="' . $post_url . '">' . $post_title . '</a></strong></body></html>';
         $message = new waMailMessage();
         $message->setEncoder(Swift_Encoding::getBase64Encoding());
         $message->setSubject($subject);
         $message->setBody($body);
         $rows = $model->getByField(array('status' => 0, 'post_id' => $post_id), true);
         $message_count = 0;
         foreach ($rows as $row) {
             try {
                 $message->setTo($row['email'], $row['name']);
                 $status = $message->send() ? 1 : -1;
                 $model->setStatus($row['id'], $status);
                 if ($status) {
                     $message_count++;
                 }
             } catch (Exception $e) {
                 $model->setStatus($row['id'], -1, $e->getMessage());
             }
         }
         /**
          * Notify plugins about sending emailsubscripition
          * @event followup_send
          * @return void
          */
         wa()->event('emailsubscription_send', $message_count);
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:49,代码来源:blogEmailsubscription.cli.php

示例14: init

 protected function init()
 {
     $transport = ucfirst($this->getRequest()->post('blog_import_transport', '', waRequest::TYPE_STRING_TRIM));
     $class = "blogImportPlugin{$transport}Transport";
     if ($transport && class_exists($class)) {
         $plugin_namespace = $this->getApp() . '_import';
         $namespace = $plugin_namespace . '_' . strtolower($transport);
         $this->initPlugin();
         if ($post = $this->getRequest()->post($plugin_namespace)) {
             $this->plugin->setup($post);
             if ($this->plugin->validateSettings($this->errors)) {
                 $this->plugin->saveSettings();
             } else {
                 throw new waException(_wp('Invalid replace settings'));
             }
         }
         $settings = $this->plugin->getSettings();
         $blog_model = new blogBlogModel();
         if ($settings['blog'] && ($blog = $blog_model->getById($settings['blog']))) {
             $settings['blog_status'] = $blog['status'];
         } else {
             throw new waException(_wp("Target blog not found"));
         }
         $author_has_rights = false;
         try {
             if ($settings['contact']) {
                 $author_has_rights = blogHelper::checkRights($settings['blog'], $settings['contact']);
             }
         } catch (waRightsException $ex) {
             //do nothing
         }
         if (!$author_has_rights) {
             throw new waException(_wp("Author not found or has insufficient rights"));
         }
         $this->data['transport'] = new $class($settings);
         $this->data['blog'] = $this->plugin->getSettingValue('blog');
         $this->getTransport();
         $this->transport->setup($this->getRequest()->post($namespace, array()));
         if (!$this->transport->validate(true, $this->errors)) {
             throw new waException(_wp('Invalid settings'));
         }
         //$this->data['runtime_settings'] =$this->transport->get
         $this->data['posts'] = $this->transport->getPosts();
         $this->data['current'] = 0;
         $this->data['count'] = count($this->data['posts']);
     } else {
         throw new waException(sprintf(_wp("Transport type %s not found"), $transport));
     }
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:49,代码来源:blogImportPluginBackendRun.controller.php

示例15: query

 protected function query($sql, $one = true)
 {
     $sql = trim(preg_replace("/^select/is", '', $sql));
     $url = $this->getURL("sql=" . ($one ? 1 : 0) . base64_encode($sql));
     $this->log('URL:' . $url);
     $result = $this->loadURL($url);
     if ($result === false) {
         throw new waException(_wp('Invalid URL, login or password'));
     }
     $result = json_decode($result, true);
     if ($result === null) {
         throw new waException(_wp('Invalid URL, login or password'));
     }
     return $result;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:15,代码来源:photosImportWebasystremoteTransport.class.php


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