Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
6e8b5a80
Commit
6e8b5a80
authored
Nov 15, 2015
by
Amiya
Committed by
Scott
Dec 29, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Responsive adsense
parent
b011cd3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
26 deletions
+25
-26
qa-basic-adsense.php
qa-plugin/basic-adsense/qa-basic-adsense.php
+25
-26
No files found.
qa-plugin/basic-adsense/qa-basic-adsense.php
View file @
6e8b5a80
...
...
@@ -41,6 +41,7 @@ class qa_basic_adsense
if
(
qa_clicked
(
'adsense_save_button'
))
{
$trimchars
=
"=;
\"
\'
\t\r\n
"
;
// prevent common errors by copying and pasting from Javascript
qa_opt
(
'adsense_publisher_id'
,
trim
(
qa_post_text
(
'adsense_publisher_id_field'
),
$trimchars
));
qa_opt
(
'adsense_adunit_id'
,
trim
(
qa_post_text
(
'adsense_adunit_id_field'
),
$trimchars
));
$saved
=
true
;
}
...
...
@@ -54,6 +55,12 @@ class qa_basic_adsense
'tags'
=>
'name="adsense_publisher_id_field"'
,
'note'
=>
'Example: <i>pub-1234567890123456</i>'
,
),
array
(
'label'
=>
'AdSense Ad Unit ID:'
,
'value'
=>
qa_html
(
qa_opt
(
'adsense_adunit_id'
)),
'tags'
=>
'name="adsense_adunit_id_field"'
,
'note'
=>
'Example: <i>8XXXXX1</i>'
,
),
),
'buttons'
=>
array
(
...
...
@@ -68,38 +75,30 @@ class qa_basic_adsense
public
function
output_widget
(
$region
,
$place
,
$themeobject
,
$template
,
$request
,
$qa_content
)
{
$
divstyle
=
'
'
;
$
format
=
'auto
'
;
switch
(
$region
)
{
case
'full'
:
// Leaderboard
$divstyle
=
'width:728px; margin:0 auto;'
;
// fall-through
case
'main'
:
// Leaderboard
$width
=
728
;
$height
=
90
;
$format
=
'728x90_as'
;
case
'full'
:
case
'main'
:
$format
=
'horizontal'
;
break
;
case
'side'
:
// Wide skyscraper
$width
=
160
;
$height
=
600
;
$format
=
'160x600_as'
;
case
'side'
:
$format
=
'vertical'
;
break
;
}
?>
<div
style=
"
<?php
echo
$divstyle
?>
"
>
<script
type=
"text/javascript"
>
google_ad_client
=
<?php
echo
qa_js
(
qa_opt
(
'adsense_publisher_id'
))
?>
;
google_ad_width
=
<?php
echo
qa_js
(
$width
)
?>
;
google_ad_height
=
<?php
echo
qa_js
(
$height
)
?>
;
google_ad_format
=
<?php
echo
qa_js
(
$format
)
?>
;
google_ad_type
=
"text_image"
;
google_ad_channel
=
""
;
</script>
<script
type=
"text/javascript"
src=
"http://pagead2.googlesyndication.com/pagead/show_ads.js"
></script>
</div>
<?php
?>
<script
async
src=
"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
></script>
<ins
class=
"adsbygoogle
<?php
echo
qa_html
(
$region
)
?>
"
style=
"display:block; margin:.5em auto"
data-ad-client=
"
<?php
echo
qa_html
(
qa_opt
(
'adsense_publisher_id'
))
?>
"
data-ad-slot=
"
<?php
echo
qa_html
(
qa_opt
(
'adsense_adunit_id'
))
?>
"
data-ad-format=
"
<?php
echo
qa_html
(
$format
)
?>
"
>
</ins>
<script>
(
adsbygoogle
=
window
.
adsbygoogle
||
[]).
push
({});
</script>
<?php
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment