************* admin ****************
559524
public function tab($event, $step) {
	global $prefs;

	$qid = quote_list($id = gps('id'));

	if($step == 'save' && bouncer($step, array('save'=>true))) switch(gps('save')) {
		case gTxt('save') : if ($id) safe_upsert('etc_cache',
			"reset='".doSlash(gps('reset'))."',
			url='".doSlash(gps('url'))."',
			filter='".doSlash(gps('filter'))."'",
			"id=$qid");
		break;
		case gTxt('delete') : safe_delete('etc_cache', $id ? "id=$qid" : '1');
		break;
		case gTxt('update') : safe_update('etc_cache', 'time=NULL', $id ? "id=$qid" : '1');
		if ($id && $url = safe_field('url', 'etc_cache', "id=$qid")) {
			$this->ping($url);
		}
		break;
	}

	$rs = safe_rows('id, time, url, reset, filter, IF(LENGTH(text)>512, CONCAT(LEFT(text, 504), " ..."), text) AS text', 'etc_cache', '1 ORDER BY time DESC');
	$now = date_create('now');

	pagetop("etc_cache");

    echo n.'<div class="txp-layout">'.
        n.tag(
            hed(gTxt('etc_cache_heading'), 1, array('class' => 'txp-heading')),
            'div', array('class' => 'txp-layout-1col')
        );

	echo n.tag_start('div', array(
            'class' => 'txp-layout-1col',
            'id'    => $event.'_container',
        ));

    if ($rs) {
        echo n.tag_start('div', array('class' => 'txp-listtables')).
            n.tag_start('table', array('class' => 'txp-list--no-options')).
            n.tag_start('thead').
            tr(
                n.'<th>'.dLink('etc_cache', 'save', 'save', 'Delete').n.'</th>'.
                n.'<th>ID</th>'.
                n.'<th>'.gTxt('etc_cache_cached_at').'</th>'.
                n.'<th>URL</th>'.
                n.'<th>'.gTxt('etc_cache_reset').'</th>'.
                n.'<th>'.gTxt('etc_cache_filter').'</th>'.
                n.'<th>'.gTxt('etc_cache_actions').'</th>'
            ).
            n.tag_end('thead').
            n.tag_start('tbody');

    	foreach($rs as $row) {
    		extract($row);
    		$class = 'date'.($reset == '%' && $time < $prefs['lastmod'] ? ' warning' : '');
    		$datetime = date_create($time);
    		$diff = $datetime->diff($now);
    		$days = $diff->format('%a');
    		$diff = (!$days ? '' : "$days day".($days == 1 ? '' : 's'). ' ').$diff->format('%H:%I hours old');

    		echo n.'<form method="post" action="?event=etc_cache">'.
                n.'<tr>'.
    		    n.'<td>'.
                n.tag(
                    span(gTxt('delete'), array('class' => 'ui-icon ui-icon-close')),
                    'button',
                    array(
                        'name'      => 'save',
                        'value'      => 'Delete',
                        'class'      => 'destroy',
                        'type'       => 'submit',
                        'title'      => gTxt('delete'),
                        'aria-label' => gTxt('delete'),
                    )
                ).'</td>'.
                n.'<td title="'.doSpecial($text).'">'.doSpecial($id).'</td>'.
                n.'<td class="'.$class.'">'.doSpecial($time).' <small>('.$diff.')</small></td>'.
                n.'<td>'.fInput('text', 'url', $url, '', '', '', INPUT_MEDIUM).n.'</td>'.
                n.'<td>'.fInput('text', 'reset', $reset, '', '', '', INPUT_MEDIUM).n.'</td>'.
                n.'<td>'.fInput('text', 'filter', $filter, '', '', '', INPUT_MEDIUM).n.'</td>'.
    		    n.'<td>'.fInput('submit', 'save', gTxt('update')).fInput('submit', 'save', gTxt('save')).n.'</td>'.
    		    sInput('save').
                hInput('id', $id).
                tInput().
    		    n.'</tr>'.n.'</form>';
    	}

        echo n.tag_end('tbody').
            n.tag_end('table').
            n.tag_end('div');
    } else {
        echo graf(
            span(null, array('class' => 'ui-icon ui-icon-info')).' '.
            gTxt('etc_cache_no_cached_items'),
            array('class' => 'alert-block information')
        );
    }

    echo n.tag_end('div'). // End of .txp-layout-1col.
        n.'</div>'; // End of .txp-layout.
}
566714
public function adminEnqueue()
    {
        wp_enqueue_script('mod-latest-taxonomy', MODULARITY_URL . '/dist/js/Posts/assets/mod-posts-taxonomy.js',
            array(), '1.0.0', true);

        add_action('admin_head', function () {
            global $post;
            global $archive;

            $id = isset($post->ID) ? $post->ID : "'" . $archive . "'";
            if (empty($id)) {
                return;
            }

            echo '<script>var modularity_current_post_id = ' . $id . ';</script>';
        });
    }
1104674
public function adminRender()
    {
        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = '';
        if (arg('update'))
        {
            $this->update();
        }
        elseif (arg('toggle'))
        {
            $this->toggle(arg('toggle', 'int'));
        }
        elseif (arg('delete'))
        {
            $this->delete(arg('delete', 'int'));
        }
        elseif (arg('id'))
        {
            $result = $this->edit();
        }
        elseif (arg('action'))
        {
            switch (arg('action'))
            {
                case 'create':
                    $result = $this->create();
                    break;
                case 'insert':
                    $this->insert();
                    break;
            }
        }
        else
        {
            $result = $page->renderTable($this->table);
        }
        return $result;
    }
219653
function admin_head()
	{	
		global $pagenow;
		
		
		// add user js + css
		do_action('acf/input/admin_head');
		
		
		?>
<script type="text/javascript">
(function($){

acf.data = {
	action 			:	'acf/everything_fields',
	metabox_ids		:	'<?php echo implode( ',', $this->data['metabox_ids'] ); ?>',
	page_type		:	'<?php echo $this->data['page_type']; ?>',
	page_action		:	'<?php echo $this->data['page_action']; ?>',
	option_name		:	'<?php echo $this->data['option_name']; ?>'
};

$(document).ready(function(){

	$.ajax({
		url: ajaxurl,
		data: acf.data,
		type: 'post',
		dataType: 'html',
		success: function(html){
			
<?php 
			if($this->data['page_type'] == "user")
			{
				if($this->data['page_action'] == "add")
				{
					echo "$('#createuser > table.form-table:last > tbody').append( html );";
				}
				else
				{
					echo "$('#your-profile .form-table:last').after( html );";
				}
			}
			elseif($this->data['page_type'] == "shopp_category")
			{
				echo "$('#post-body-content').append( html );";
			}
			elseif($this->data['page_type'] == "taxonomy")
			{
				if($this->data['page_action'] == "add")
				{
					echo "$('#addtag > p.submit').before( html );";
				}
				else
				{
					echo "$('#edittag > table.form-table:first > tbody').append( html );";
				}
			}
			elseif($this->data['page_type'] == "media")
			{
				if($this->data['page_action'] == "add")
				{
					echo "$('#addtag > p.submit').before( html );";
				}
				else
				{
					echo "$('#media-single-form table tbody tr.submit').before( html );";
				}
			}
?>

			setTimeout( function(){ 
				$(document).trigger('acf/setup_fields', $('#wpbody') ); 
			}, 200);
			
		}
	});
	
	
	/*
	*  Taxonomy Add
	*
	*  @description: 
	*  @since: 3.6
	*  @created: 24/02/13
	*/
	
	$(document).ajaxComplete(function(event, xhr, settings) {
		
		// vars
		data = acf.helpers.url_to_object(settings.data);
		
		
		// validate
		if( data.action != 'add-tag' )
		{
			return;
		}
		

		// vars
		var $el = $('#addtag');
		
		
		// clear WYSIWYG field
		$el.find('.acf_wysiwyg textarea').each(function(){

			
			// vars
			var textarea = $(this),
				id = textarea.attr('id'),
				editor = tinyMCE.get( id );
			
			if( editor )
			{
				editor.setContent('');
				editor.save();
			}
			
		});
		
		
		// clear image / file fields
		$el.find('.field .active').removeClass('active');
		
		
		// clear checkbox
		$el.find('input[type="checkbox"]').removeAttr('checked');

	});
	
});


})(jQuery);
</script>
		<?php
	}
1203907
public function adminOnMenuRender()
	{
		/** @var TAdminUI $page */
		$page = Eresus_Kernel::app()->getPage();
		$page->addMenuItem(admExtensions, array(
			'access'  => EDITOR,
			'link'  => $this->name,
			'caption'  => 'Формы ввода',
			'hint'  => $this->description
		));
	}
1209889
public function run(): void
    {
        // http://stackoverflow.com/q/1598411
        $list = [
            ['name' => 'Super Admin', 'slug' => HCRoleRepository::ROLE_SA], // Manage everything
            ['name' => 'Project Admin', 'slug' => HCRoleRepository::ROLE_PA], // Manage most aspects of the site
            ['name' => 'User', 'slug' => HCRoleRepository::ROLE_U], // Average Joe
        ];

        foreach ($list as $roleData) {
            $role = $this->repository->findOneBy(['slug' => $roleData['slug']]);

            if (!$role) {
                $this->repository->create($roleData);
            }
        }
    }
298028
public function isAdmin()
    {
        if (is_null($this->admin)) {
            $this->admin = (bool)is_admin();
        }

        return $this->admin;
    }
985401
function admin_menu() 
	{
	
		global $pagenow;

		
		// validate page
		if( ! $this->validate_page() ) return;
		
		
		// set page type
		$filter = array();
		
		if( $pagenow == "admin.php" && isset( $_GET['page'], $_GET['id'] ) && $_GET['page'] == "shopp-categories" )
		{
			// filter
			$_GET['id'] = filter_var($_GET['id'], FILTER_SANITIZE_STRING);
			
			
			$this->data['page_type'] = "shopp_category";
			$filter['ef_taxonomy'] = "shopp_category";
			
			$this->data['page_action'] = "add";
			$this->data['option_name'] = "";
			
			if( $_GET['id'] != "new" )
			{
				$this->data['page_action'] = "edit";
				$this->data['option_name'] = "shopp_category_" . $_GET['id'];
			}
			
		}
		if( $pagenow == "edit-tags.php" && isset($_GET['taxonomy']) )
		{
			// filter
			$_GET['taxonomy'] = filter_var($_GET['taxonomy'], FILTER_SANITIZE_STRING);
			
			
			$this->data['page_type'] = "taxonomy";
			$filter['ef_taxonomy'] = $_GET['taxonomy'];
			
			$this->data['page_action'] = "add";
			$this->data['option_name'] = "";
			
			if( isset($_GET['action']) && $_GET['action'] == "edit" )
			{
				// filter
				$_GET['tag_ID'] = filter_var($_GET['tag_ID'], FILTER_SANITIZE_NUMBER_INT);
			
				$this->data['page_action'] = "edit";
				$this->data['option_name'] = $_GET['taxonomy'] . "_" . $_GET['tag_ID'];
			}
			
		}
		elseif( $pagenow == "profile.php" )
		{
			
			$this->data['page_type'] = "user";
			$filter['ef_user'] = get_current_user_id();
			
			$this->data['page_action'] = "edit";
			$this->data['option_name'] = "user_" . get_current_user_id();
			
		}
		elseif( $pagenow == "user-edit.php" && isset($_GET['user_id']) )
		{
			// filter
			$_GET['user_id'] = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT);

			
			$this->data['page_type'] = "user";
			$filter['ef_user'] = $_GET['user_id'];
			
			$this->data['page_action'] = "edit";
			$this->data['option_name'] = "user_" . $_GET['user_id'];
			
		}
		elseif( $pagenow == "user-new.php" )
		{
			$this->data['page_type'] = "user";
			$filter['ef_user'] ='all';
			
			$this->data['page_action'] = "add";
			$this->data['option_name'] = "";

		}
		elseif( $pagenow == "media.php" || $pagenow == 'upload.php' )
		{
			
			$this->data['page_type'] = "media";
			$filter['post_type'] = 'attachment';
			
			$this->data['page_action'] = "add";
			$this->data['option_name'] = "";
			
			if(isset($_GET['attachment_id']))
			{
				// filter
				$_GET['attachment_id'] = filter_var($_GET['attachment_id'], FILTER_SANITIZE_NUMBER_INT);
			
			
				$this->data['page_action'] = "edit";
				$this->data['option_name'] = $_GET['attachment_id'];
			}

		}
		
		
		// get field groups
		$metabox_ids = array();
		$this->data['metabox_ids'] = apply_filters( 'acf/location/match_field_groups', $metabox_ids, $filter );

		
		// dont continue if no ids were found
		if( empty( $this->data['metabox_ids'] ) )
		{
			return false;	
		}
		
		
		// actions
		add_action('admin_enqueue_scripts', array($this,'admin_enqueue_scripts'));
		add_action('admin_head', array($this,'admin_head'));
		
		
	}
918197
public function adminRender()
	{
		$this->root = 'data/';

		$this->panels['l'] = (arg('lf')?preg_replace('!^/|/$!','',arg('lf')).'/':'');
		$this->panels['l'] = preg_replace('~(/\.\.|^\.\./)~', '', $this->panels['l']);
		$this->panels['l'] = preg_replace('!^/!', '', $this->panels['l']);
		while (!empty($this->panels['l'])
			&& !is_dir(Eresus_CMS::getLegacyKernel()->froot.$this->root.$this->panels['l']))
		{
			$this->panels['l'] = preg_replace('![^/]+/$!', '', $this->panels['l']);
		}
		$this->panels['r'] = (arg('rf')?preg_replace('!^/|/$!','',arg('rf')).'/':'');
		$this->panels['r'] = preg_replace('~(/\.\.|^\.\./)~', '', $this->panels['r']);
		$this->panels['r'] = preg_replace('!^/!', '', $this->panels['r']);
		while (!empty($this->panels['r'])
			&& !is_dir(Eresus_CMS::getLegacyKernel()->froot.$this->root.$this->panels['r']))
		{
			$this->panels['r'] = preg_replace('![^/]+/$!', '', $this->panels['r']);
		}
		$this->sp = substr(arg('sp', '/[^lr]/'), 0, 1);
		if (!$this->sp)
		{
			$this->sp = 'l';
		}
		if (count($_FILES))
		{
			$this->upload();
		}
		elseif (arg('mkdir'))
		{
			$this->mkDir();
		}
		elseif (arg('rename'))
		{
			$this->renameEntry();
		}
		elseif (arg('chmod'))
		{
			$this->chmodEntry();
		}
		elseif (arg('copyfile'))
		{
			$this->copyFile();
		}
		elseif (arg('movefile'))
		{
			$this->moveFile();
		}
		elseif (arg('delete'))
		{
			$this->deleteFile();
		}
		else
		{
			$root = Eresus_CMS::getLegacyKernel()->root;
			Eresus_Kernel::app()->getPage()->
				linkScripts($root . 'core/files.js');
			$result =
				"<table id=\"fileManager\">\n" .
					'<tr><td colspan="2" class="filesMenu">' . $this->renderMenu() . "</td></tr>\n" .
					'<tr><td colspan="2" class="filesControls">' . $this->renderControls() . "</td></tr>" .
					'<tr>' .
					'<td valign="top" class="filesPanel">' . $this->renderFileList('l') . "</td>\n" .
					'<td valign="top" class="filesPanel">' . $this->renderFileList('r') . "</td>\n" .
					"</tr>\n" .
					'<tr><td colspan="2" class="filesControls">' . $this->renderStatus() . "</td></tr>" .
					"</table>" .
					"<script type=\"text/javascript\"><!--\n" .
					" filesInit('" . $root . $this->root . "', '" . $this->sp . "');\n" .
					"--></script>\n";
			return $result;
		}
		return '';
	}
1172767
private function createAdmin(): void
    {
        $this->connection->beginTransaction();
        try {
            $this->userService->createUser(
                [
                    'email' => $this->email,
                    'password' => $this->password,
                    'is_active' => BoolEnum::yes()->id(),
                    'activated_at' => Carbon::now()->toDateTimeString(),
                ],
                [
                    'first_name' => 'Super',
                    'last_name' => 'Admin',
                    // TODO set admin default photo
                ],
                [
                    $this->roleRepository->getRoleSuperAdminId(),
                    $this->roleRepository->getRoleUserId()
                ]
            );
        } catch (\Throwable $exception) {
            $this->connection->rollBack();

            report($exception);

            $this->info('error:');
            $this->error($exception->getMessage());

            exit;
        }

        $this->connection->commit();
    }
488454
public function admin_save() {

		$this->languages_available = get_available_languages();

		/**
		 * format: array( language, version, updated, english_name, native_name, package, iso, strings )
		 */
		require_once ABSPATH . 'wp-admin/includes/translation-install.php';
		$this->languages_translated = wp_get_available_translations();

		$new_languages = array();

		if ( isset( $_POST['pods_i18n_enabled_languages'] ) && is_array( $_POST['pods_i18n_enabled_languages'] ) ) {
			foreach ( $_POST['pods_i18n_enabled_languages'] as $locale ) {
				$locale = sanitize_text_field( $locale );

				if ( in_array( $locale, $this->languages_available, true ) ) {
					$new_languages[ $locale ] = array();

					if ( isset( $this->languages_translated[ $locale ]['language'] ) ) {
						$new_languages[ $locale ]['language'] = $this->languages_translated[ $locale ]['language'];
					}

					if ( isset( $this->languages_translated[ $locale ]['english_name'] ) ) {
						$new_languages[ $locale ]['english_name'] = $this->languages_translated[ $locale ]['english_name'];
					}

					if ( isset( $this->languages_translated[ $locale ]['native_name'] ) ) {
						$new_languages[ $locale ]['native_name'] = $this->languages_translated[ $locale ]['native_name'];
					}
				}
			}
		}//end if

		$this->languages                     = $new_languages;
		$this->settings['enabled_languages'] = $new_languages;

		update_option( $this->option_key, $this->settings );

	}
1173959
public function adminBar()
    {
        if (isset($_GET['id'])) {
            if (is_numeric($_GET['id']) && $_GET['id'] > 0) {
                $post = get_post($_GET['id']);

                if (!$post) {
                    return;
                }

                setup_postdata($post);

                add_action('admin_bar_menu', function () use ($post) {
                    global $wp_admin_bar;
                    $wp_admin_bar->add_node(array(
                        'id' => 'view_page',
                        'title' => __('View Page'),
                        'href' => get_permalink($post->ID),
                        'meta' => array(
                            'target' => '_blank'
                        )
                    ));
                }, 1050);

                self::$isEditing = array(
                    'id' => $post->ID,
                    'title' => $post->post_title
                );

                wp_reset_postdata();
            } else {
                global $archive;
                $archive = $_GET['id'];

                self::$isEditing = array(
                    'id' => null,
                    'title' => $archive
                );
            }

            self::$isEditing = apply_filters('Modularity/is_editing', self::$isEditing);

            add_action('Modularity/options_page_title_suffix', function () {
                echo ': ' . self::$isEditing['title'];
            });
        }
    }
934264
public function init()
    {
        parent::init();
        $this->setIsAdmin(in_array($this->name, $this->admins));
    }
548524
public function admin_head() {

		if ( self::get_current_post_type() !== $this->cpt->post_type ) {
			return;
		}

		?>
		<?php if ( isset( $this->args['admin_filters']['m'] ) && ! $this->args['admin_filters']['m'] ) { ?>
			<style type="text/css">
				#posts-filter select[name="m"] {
					display: none;
				}
			</style>
		<?php } ?>
		<?php

	}
578275
public function canAdmin()
    {
        $component = $this->getIdentifier()->package;

        return $this->getObject('user')->authorise('core.admin', 'com_'.$component) === true;
    }
1253475
def administration(self):
        """"""
        url = self._url
        res = search("/rest/", url).span()
        addText = "admin/"
        part1 = url[:res[1]]
        part2 = url[res[1]:]
        adminURL = "%s%s%s" % (part1, addText, part2)

        res = AdminFeatureService(url=url,
                            securityHandler=self._securityHandler,
                            proxy_url=self._proxy_url,
                            proxy_port=self._proxy_port,
                            initialize=False)
        return res
1310405
protected function createAdminMenu()
    {

        $config = config('menu');
        $events = $this->app->make('events');
        foreach ($config as $event => $ordered) {
            foreach ($ordered as $name => $value) {
                if (is_numeric($name)) {
                    $events->listen($event, $value);
                } else {
                    $events->listen($event, $name, $value);
                }
            }
        }
    }