Example #1
0
 protected function getConf()
 {
     $conf = ['ID' => Core::ID, 'ajaxURL' => Url::getAjax(), 'lang' => ['loading' => L10n::__('Loading, please wait...'), 'error' => L10n::__('Sorry, server is busy now, can not respond your request, please try again later.'), 'close' => L10n::__('Close'), 'ok' => L10n::__('OK')]];
     if (Condition::isAdmin()) {
         $conf['_nonce'] = Security::createNonce();
     }
     return \apply_filters(Functions::buildActionName('dynamicConf'), $conf);
 }
Example #2
0
 protected function setDynamicRequest($method = 'dynamicRequest')
 {
     if (!Condition::isAjax()) {
         \add_filter(Functions::buildActionName('dynamicRequest'), [$this, $method]);
     }
 }
Example #3
0
 public static function getTheTitle($postID, $leavename = false)
 {
     static $cache = [];
     if (isset($cache[$postID])) {
         return $cache[$postID];
     }
     global $post;
     if (!isset($post->ID) || $post->ID != $postID) {
         $p = static::getPost($postID);
     } else {
         $p = $post;
     }
     $title = isset($p->post_title) ? $p->post_title : '';
     if (!Condition::isAdmin()) {
         if (!empty($p->post_password)) {
             $title = sprintf(\apply_filters('protected_title_format', __('Protected: %s'), $p), $title);
         } elseif (isset($p->post_status) && 'private' == $p->post_status) {
             $title = sprintf(\apply_filters('private_title_format', __('Private: %s'), $p), $title);
         }
     }
     unset($p);
     $cache[$postID] = htmlspecialchars($title);
     return $cache[$postID];
 }