예제 #1
0
파일: Admin.php 프로젝트: kmvan/poiauthor
 private function addMenu()
 {
     if (User::isUserLoggedIn() && User::currentUserCan('edit_themes')) {
         \add_action('admin_menu', [$this, 'addPage'], 2);
         \add_filter('plugin_action_links', [$this, 'filterActionLink'], 10, 2);
     }
 }
예제 #2
0
파일: Api.php 프로젝트: kmvan/poiauthor
 public static function createPage(array $pages)
 {
     if (!User::currentUserCan('manage_options')) {
         return false;
     }
     foreach ($pages as $pagePath => $v) {
         static::getPageByPath($pagePath) || \wp_insert_post(array_merge(['post_content' => '', 'post_name' => null, 'post_title' => null, 'post_status' => 'publish', 'post_type' => 'page', 'comment_status' => 'closed'], $v));
     }
 }
예제 #3
0
파일: Update.php 프로젝트: kmvan/poiauthor
 public function initUpdate()
 {
     if (!User::currentUserCan('manage_options')) {
         return;
     }
     $this->setRelativeFile();
     \add_filter('site_transient_update_plugins', [$this, 'checkForUpdate'], 1);
     \add_filter('plugins_api', [$this, 'filterPluginsApi'], 10, 3);
     \add_filter('upgrader_source_selection', [$this, 'filterUpgraderSourceSelection'], 10, 3);
     \add_filter('upgrader_pre_install', [$this, 'filterUpgraderPreInstall'], 10, 2);
     //\add_filter('upgrader_post_install', [$this, 'filterFlushOpcache']);
     \add_filter('upgrader_post_install', [$this, 'filterUpgraderPostInstall'], 10, 3);
 }
예제 #4
0
파일: Api.php 프로젝트: kmvan/poiauthor
 public static function isOptsPage()
 {
     $page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING);
     return $page === Functions::buildActionName(Options::URL_ID) && User::currentUserCan('manage_options') && static::isAdmin();
 }